CloudWatch Constructs¶
Monitoring dashboards, alarms, and metrics.
cw
¶
Modules¶
config_generators
¶
Modules¶
sfn
¶
StateMachineMetricConfigGenerator
dataclass
¶StateMachineMetricConfigGenerator(
state_machine: IStateMachine,
state_machine_name: str,
dimension_map: dict = field(init=False),
)
get_execution_completion_metric
¶get the execution completion metric for the state machine
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name_override
|
Optional[str]
|
override for name used. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
GraphMetricConfig
|
GraphMetricConfig |
Source code in src/aibs_informatics_cdk_lib/constructs_/cw/config_generators/sfn.py
get_execution_invocations_metric
¶get the execution invocations metric for the state machine
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name_override
|
Optional[str]
|
override for name used. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
GraphMetricConfig
|
GraphMetricConfig |
Source code in src/aibs_informatics_cdk_lib/constructs_/cw/config_generators/sfn.py
get_execution_failures_metric
¶get_execution_failures_metric(
name_override: str | None = None,
discriminator: str | None = None,
alarm_threshold: int = 1,
alarm_evaluation_periods: int = 3,
alarm_datapoints_to_alarm: int = 1,
) -> GraphMetricConfig
get the execution failures metric for the state machine
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name_override
|
Optional[str]
|
override for name used. Defaults to state machine name. |
None
|
discriminator
|
Optional[str]
|
Required if grouping with other metric configs that specify the same metric math. Defaults to "0". |
None
|
alarm_threshold
|
int
|
Alarm threshold used. Defaults to 1. |
1
|
alarm_evaluation_periods
|
int
|
Alarm evaluation periods. Defaults to 3. |
3
|
alarm_datapoints_to_alarm
|
int
|
Alarm datapoints to alarm. Defaults to 1. |
1
|
Returns:
| Type | Description |
|---|---|
GraphMetricConfig
|
Graph metric config for execution failures |
Source code in src/aibs_informatics_cdk_lib/constructs_/cw/config_generators/sfn.py
get_execution_timing_metric
¶get_execution_timing_metric(
name_override: str | None = None,
discriminator: str | None = None,
time_unit: SFN_TIME_UNITS = "minutes",
) -> GraphMetricConfig
get the execution time metric for the state machine
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name_override
|
Optional[str]
|
override for name used. Defaults to state machine name. |
None
|
discriminator
|
Optional[str]
|
Required if grouping with other metric configs that specify the same metric math. Defaults to "0". |
None
|
time_unit
|
SFN_TIME_UNITS
|
unit of time to use for metric. Defaults to "minutes". |
'minutes'
|
Returns:
| Type | Description |
|---|---|
GraphMetricConfig
|
GraphMetricConfig |
Source code in src/aibs_informatics_cdk_lib/constructs_/cw/config_generators/sfn.py
dashboard
¶
Classes¶
DashboardMixins
¶
Bases: EnvBaseConstructMixins
add_graphs
¶add_graphs(
grouped_metric_configs: list[GroupedGraphMetricConfig],
namespace: str,
period: Duration,
alarm_id_discriminator: str,
alarm_topic: Topic | None,
dimensions: dict[str, Any],
) -> None
Adds graphs to a dashboard based on metrics configs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grouped_metric_configs
|
List[GroupedGraphMetricConfig]
|
config |
required |
namespace
|
str
|
default namespace for metrics, can be overridden in configs |
required |
period
|
Duration
|
default duration |
required |
alarm_id_discriminator
|
str
|
a non token disciminator for alarms |
required |
alarm_name_discriminator
|
str
|
common name alarm discriminator |
required |
alarm_topic
|
Optional[Topic]
|
optional SNS topic to send alarm notifications |
required |
dimensions
|
Dict[str, Any]
|
dimensions to generate metrics from |
required |
Source code in src/aibs_informatics_cdk_lib/constructs_/cw/dashboard.py
create_widgets_and_alarms
¶create_widgets_and_alarms(
grouped_metric_configs: list[GroupedGraphMetricConfig],
namespace: str,
period: Duration,
alarm_id_discriminator: str,
alarm_topic: Topic | None,
dimensions: dict[str, Any],
) -> tuple[list[IWidget], list[IAlarm]]
Create graph widgets and alarms from configs
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grouped_metric_configs
|
List[GroupedGraphMetricConfig]
|
configs |
required |
namespace
|
str
|
default metric namespace |
required |
period
|
Duration
|
default duration |
required |
alarm_name_discriminator
|
str
|
alarm discriminator name |
required |
alarm_topic
|
Optional[Topic]
|
optional sns topic for alarms |
required |
dimensions
|
Dict[str, Any]
|
|
required |
Returns:
| Type | Description |
|---|---|
tuple[list[IWidget], list[IAlarm]]
|
Tuple[List[cw.IWidget], List[cw.IAlarm]]: List of widgets and list of alarms |
Source code in src/aibs_informatics_cdk_lib/constructs_/cw/dashboard.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |