|
1 |
| -import { MetricDataQuery, SliMetricBaseProps } from './slo'; |
2 | 1 | import { ComparisonOperator, MetricStatistic, MetricType } from './constants';
|
3 | 2 | import { KeyAttributes } from './keyAttributes';
|
4 | 3 |
|
5 |
| -// /** |
6 |
| -// * Base properties for SLI metric configuration |
7 |
| -// */ |
8 |
| -// export type SliMetricBaseProps = { |
9 |
| -// /** |
10 |
| -// * The threshold value for the metric |
11 |
| -// * |
12 |
| -// * @required |
13 |
| -// */ |
14 |
| -// readonly metricThreshold: number; |
15 |
| -// |
16 |
| -// /** |
17 |
| -// * The comparison operator |
18 |
| -// * |
19 |
| -// * @default - Based on metric type |
20 |
| -// */ |
21 |
| -// readonly comparisonOperator?: ComparisonOperator; |
22 |
| -// } & (ApplicationSignalsMetricProps | CloudWatchMetricProps); |
23 |
| -// |
24 |
| -// /** |
25 |
| -// * Period-based metric properties |
26 |
| -// */ |
27 |
| -// export interface PeriodBasedMetricProps extends SliMetricBaseProps { |
28 |
| -// /** |
29 |
| -// * The period in seconds |
30 |
| -// * |
31 |
| -// * @required |
32 |
| -// */ |
33 |
| -// readonly periodSeconds: number; |
34 |
| -// |
35 |
| -// /** |
36 |
| -// * The statistic to use |
37 |
| -// * |
38 |
| -// * @required |
39 |
| -// */ |
40 |
| -// readonly statistic: MetricStatistic; |
41 |
| -// } |
42 |
| -// |
43 |
| -// /** |
44 |
| -// * Request-based metric properties |
45 |
| -// */ |
46 |
| -// export interface RequestBasedMetricProps extends SliMetricBaseProps { |
47 |
| -// /** |
48 |
| -// * The good count metrics |
49 |
| -// * Required for request-based SLOs |
50 |
| -// * |
51 |
| -// * @required |
52 |
| -// */ |
53 |
| -// readonly goodCountMetrics: MetricDataQuery[]; |
54 |
| -// |
55 |
| -// /** |
56 |
| -// * The total count metrics |
57 |
| -// * Required for request-based SLOs |
58 |
| -// * |
59 |
| -// * @required |
60 |
| -// */ |
61 |
| -// readonly totalCountMetrics: MetricDataQuery[]; |
62 |
| -// |
63 |
| -// /** |
64 |
| -// * The bad count metrics |
65 |
| -// * Optional for request-based SLOs |
66 |
| -// * |
67 |
| -// * @default - undefined |
68 |
| -// */ |
69 |
| -// readonly badCountMetrics?: MetricDataQuery[]; |
70 |
| -// } |
71 |
| - |
72 |
| - |
73 | 4 | /**
|
74 | 5 | * Interface for metric dimension
|
75 | 6 | */
|
@@ -290,37 +221,128 @@ export interface MetricDataQuery {
|
290 | 221 | * Period-based metric properties with Application Signals
|
291 | 222 | */
|
292 | 223 | export interface PeriodBasedAppSignalsMetricProps extends SliMetricBaseProps {
|
| 224 | + /** |
| 225 | + * The type of metric being measured |
| 226 | + * Can be LATENCY or AVAILABILITY |
| 227 | + * |
| 228 | + * @required |
| 229 | + */ |
293 | 230 | readonly metricType: MetricType;
|
| 231 | + |
| 232 | + /** |
| 233 | + * Key attributes for the service being monitored |
| 234 | + * Must include at least one of Type, Name, and Environment |
| 235 | + * |
| 236 | + * @required |
| 237 | + */ |
294 | 238 | readonly keyAttributes: { [key: string]: string };
|
| 239 | + |
| 240 | + /** |
| 241 | + * The name of the operation being measured |
| 242 | + * Used to filter metrics for specific operation |
| 243 | + * |
| 244 | + */ |
295 | 245 | readonly operationName?: string;
|
| 246 | + |
| 247 | + /** |
| 248 | + * The period in seconds for metric aggregation |
| 249 | + * Must be a multiple of 60 |
| 250 | + * |
| 251 | + * @required |
| 252 | + */ |
296 | 253 | readonly periodSeconds: number;
|
| 254 | + |
| 255 | + /** |
| 256 | + * The statistic to use for aggregation |
| 257 | + * Examples: Average, Sum, p99 |
| 258 | + * |
| 259 | + * @required |
| 260 | + */ |
297 | 261 | readonly statistic: MetricStatistic;
|
298 | 262 | }
|
299 | 263 |
|
300 | 264 | /**
|
301 | 265 | * Period-based metric properties with CloudWatch metrics
|
302 | 266 | */
|
303 | 267 | export interface PeriodBasedCloudWatchMetricProps extends SliMetricBaseProps {
|
| 268 | + /** |
| 269 | + * The metric data queries to execute |
| 270 | + * Can include raw metrics and math expressions |
| 271 | + * |
| 272 | + * @required |
| 273 | + */ |
304 | 274 | readonly metricDataQueries: MetricDataQuery[];
|
| 275 | + |
| 276 | + /** |
| 277 | + * The period in seconds for metric aggregation |
| 278 | + * Must be a multiple of 60 |
| 279 | + * |
| 280 | + * @required |
| 281 | + */ |
305 | 282 | readonly periodSeconds: number;
|
| 283 | + |
| 284 | + /** |
| 285 | + * The statistic to use for aggregation |
| 286 | + * Examples: Average, Sum, p99 |
| 287 | + * |
| 288 | + * @required |
| 289 | + */ |
306 | 290 | readonly statistic: MetricStatistic;
|
307 | 291 | }
|
308 | 292 |
|
309 | 293 | /**
|
310 | 294 | * Request-based metric properties with Application Signals
|
311 | 295 | */
|
312 | 296 | export interface RequestBasedAppSignalsMetricProps extends SliMetricBaseProps {
|
| 297 | + /** |
| 298 | + * The type of metric being measured |
| 299 | + * Can be LATENCY or AVAILABILITY |
| 300 | + * |
| 301 | + * @required |
| 302 | + */ |
313 | 303 | readonly metricType: MetricType;
|
| 304 | + |
| 305 | + /** |
| 306 | + * Key attributes for the applications being monitored |
| 307 | + * Must include at least one of Type, Name, and Environment |
| 308 | + * |
| 309 | + * @required |
| 310 | + */ |
314 | 311 | readonly keyAttributes: { [key: string]: string };
|
| 312 | + |
| 313 | + /** |
| 314 | + * The name of the operation being measured |
| 315 | + * |
| 316 | + */ |
315 | 317 | readonly operationName?: string;
|
316 | 318 | }
|
317 | 319 |
|
318 | 320 | /**
|
319 | 321 | * Request-based metric properties with CloudWatch metrics
|
320 | 322 | */
|
321 | 323 | export interface RequestBasedCloudWatchMetricProps extends SliMetricBaseProps {
|
| 324 | + /** |
| 325 | + * Metrics that count successful requests |
| 326 | + * Optional if can be derived from total - bad |
| 327 | + * Used to calculate success rate |
| 328 | + * |
| 329 | + * @required |
| 330 | + */ |
322 | 331 | readonly goodCountMetrics: MetricDataQuery[];
|
| 332 | + |
| 333 | + /** |
| 334 | + * Metrics that count total requests |
| 335 | + * Used as denominator for success rate |
| 336 | + * |
| 337 | + * @required |
| 338 | + */ |
323 | 339 | readonly totalCountMetrics: MetricDataQuery[];
|
| 340 | + |
| 341 | + /** |
| 342 | + * Metrics that count failed requests |
| 343 | + * Optional if can be derived from total - good |
| 344 | + * |
| 345 | + */ |
324 | 346 | readonly badCountMetrics?: MetricDataQuery[];
|
325 | 347 | }
|
326 | 348 |
|
|
0 commit comments