# MetricStatConfig

Properties for a concrete metric.

NOTE: `unit` is no longer on this object since it is only used for `Alarms`, and doesn't mean what one
would expect it to mean there anyway. It is most likely to be misused.

- Source: [`aws-cloudwatch/lib/metric-types.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-cloudwatch/lib/metric-types.ts#L278)
- Type last changed: v2.175.0 · 10 Jan 2025

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_cloudwatch as cloudwatch } from 'aws-cdk-lib';

declare const value: any;
const metricStatConfig: cloudwatch.MetricStatConfig = {
  metricName: 'metricName',
  namespace: 'namespace',
  period: cdk.Duration.minutes(30),
  statistic: 'statistic',

  // the properties below are optional
  account: 'account',
  accountOverride: 'accountOverride',
  dimensions: [{
    name: 'name',
    value: value,
  }],
  region: 'region',
  regionOverride: 'regionOverride',
  unitFilter: cloudwatch.Unit.SECONDS,
};
```

## Properties

- `account`: string — Account which this metric comes from.

  **Default:** Deployment account.

- `accountOverride`: string — Account set directly on the metric, not inherited from the attached stack.

  **Default:** No override.

- `dimensions`: [Dimension](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.Dimension.html)[] = [] — The dimensions to apply to the alarm.

- `metricName`: string (required) — Name of the metric.

- `namespace`: string (required) — Namespace of the metric.

- `period`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) (required) — How many seconds to aggregate over.

- `region`: string — Region which this metric comes from.

  **Default:** Deployment region.

- `regionOverride`: string — Region set directly on the metric, not inherited from the attached stack.

  **Default:** No override.

- `statistic`: string (required) — Aggregation function to use (can be either simple or a percentile).

- `unitFilter`: [Unit](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.Unit.html) — Unit used to filter the metric stream.

  **Default:** Refer to all metric datums

  Only refer to datums emitted to the metric stream with the given unit and
  ignore all others. Only useful when datums are being emitted to the same
  metric stream under different units.

  This field has been renamed from plain `unit` to clearly communicate
  its purpose.
