/** * MonitoringStack — a CloudWatch dashboard wired to up to three named * metrics, with an optional alarm per metric. * * The recurring hand-rolled shape the aws-bench corpus surfaced: a team * stands up a `cloudwatch.Dashboard`, a `cloudwatch.Metric` per resource it * cares about, and a near-identical `cloudwatch.Alarm` next to each one — 44 * combined dashboard+alarm+metric instantiations across the corpus' 8 real * CDK apps, nothing equivalent shipped in chant (epic #1139). * * Fixed `metric1..metric3` slots, not a `metrics: MetricSpec[]` array — a * loop building `Alarm` resources from an array is exactly the control-flow- * over-resources shape EVL002/EVL003 rule out for reference composites (see * `EksCluster`'s `addon1..addon3`, this directory). A fourth metric is a bare * `Alarm` + a hand-edited `CwDashboard.DashboardBody` the estate declares * directly. * * What is deliberately NOT here: * - Notification wiring. `alarm.alarmActions` on each metric takes ARNs the * caller already has (an SNS topic from `LambdaSns`, or hand-declared); * this composite does not create a `Topic`/`Subscription` itself — who * gets paged and on what channel is a real per-estate decision, not a * default worth guessing. `defaults.alarm1..3` is the escape hatch for * anything else on the alarm (e.g. `OKActions`, `DatapointsToAlarm`). * - Math-expression / composite / anomaly-detection alarms (`Alarm.Metrics`, * `AlarmModel`) — single-metric threshold alarms only. * - Dynamic (`Ref`/`GetAtt`/`Sub`) values inside the dashboard body. * `CwDashboard.DashboardBody` is one flat JSON string CloudFormation does * not template, so each metric's `namespace`/`metricName`/`dimension.value` * must be a literal the caller already knows — the physical name they set * on the monitored resource, not one CloudFormation generates. The `Alarm` * resources carry no such limit: `Dimensions` is a real structured * property, so `alarm.dimensionValue` accepts `Value` and can * reference a sibling resource by `Ref`/`GetAtt`. */ import { type Value } from "@intentius/chant"; import { Alarm, CwDashboard } from "../generated/index.js"; export interface MonitoringMetricSpec { /** Dashboard widget title, and the alarm's default `AlarmName`. */ title: string; /** CloudWatch namespace, e.g. `"AWS/Lambda"`, `"AWS/DynamoDB"`. */ namespace: string; /** Metric name within the namespace, e.g. `"Errors"`, `"ConsumedReadCapacityUnits"`. */ metricName: string; /** * Dimension identifying which resource emits the metric, e.g. * `{ name: "FunctionName", value: "my-fn" }`. Omit for an account/region- * wide metric. `value` must be a literal — see the dashboard-body note above. */ dimension?: { name: string; value: string; }; /** Statistic for both the widget and (if alarmed) the alarm. Default `"Sum"`. */ statistic?: string; /** Period in seconds, for both the widget and the alarm. Default `300`. */ period?: number; /** Alarm this metric when set; omit for a dashboard-only metric. */ alarm?: { threshold: number; /** Default `"GreaterThanThreshold"`. */ comparisonOperator?: string; /** Default `1`. */ evaluationPeriods?: number; treatMissingData?: "breaching" | "ignore" | "missing" | "notBreaching"; /** ARNs to notify on ALARM — an existing SNS topic, typically. */ alarmActions?: Value[]; /** * Dimension value for the alarm. Defaults to `dimension.value`; set this * instead when the alarm needs to track a `Ref`/`GetAtt` the dashboard * widget cannot (see the dashboard-body note above). */ dimensionValue?: Value; }; } export interface MonitoringStackProps { /** `Value`: a name is routinely built with `Sub`/`Ref` (#1366). */ dashboardName?: Value; metric1: MonitoringMetricSpec; metric2?: MonitoringMetricSpec; metric3?: MonitoringMetricSpec; tags?: Array<{ Key: string; Value: string; }>; defaults?: { dashboard?: Partial[0]>; alarm1?: Partial[0]>; alarm2?: Partial[0]>; alarm3?: Partial[0]>; }; } export declare const MonitoringStack: import("@intentius/chant").CompositeDefinition) | undefined; alarm2?: (import("@intentius/chant").Declarable & Record) | undefined; alarm1?: (import("@intentius/chant").Declarable & Record) | undefined; dashboard: import("@intentius/chant").Declarable & Record; }>; //# sourceMappingURL=monitoring-stack.d.ts.map