aws / aws/aws-cdk

Feature Request: LATEST keyword for metric dimensions

Open
#26,946 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-lambda effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

Currently, all metric dimensions need to be populated with specific values that match your metrics. Just as we have metric math function keywords, I'd like to be able to use keywords for dimension maps.

Specifically, I'd like a CDK option to query the latest value added to a dimension.

### Use Case

I'm using CDK to monitor metrics for my mobile app. I'd like an option to query a metric by the latest app version automatically, without having to update the version number manually.

For example, my metric dimensions currently look something like this:
```
const app_metric: Metric = new Metric({
// other information
dimensionsMap: {
AppVersion: 'x.xxxxx.x', // needs updating with every app release
},
});
```

I propose a keyword so that I can achieve the same results like this:
```
const app_metric: Metric = new Metric({
// other information
dimensionsMap: {
AppVersion: LATEST, // automatically updates
},
});
```

### Proposed Solution

I propose adding a LATEST keyword that automatically detects and populates the dimension with the corresponding value that was added most recently.

For example, in regards to app versions, we would query the latest value added to the AppVersion dimension. CDK would identify that metrics with version "13.2" started coming in later than metrics with version "13.1", and return 13.2 as the latest value.

This requires CDK to track time stamps of when each value in a dimension was added, so a simpler solution is to just add this functionality for values that can be parsed into numerics by removing all non-numerical characters in a string. For example, "13.2" would be parsed into "132", and this would be evaluated as higher than "131" (from version "13.1"), so CDK will return "13.2" as the latest value.

### Other Information

Some use cases may log the latest values as lowest values, so perhaps the keyword would be separated out into LOWEST and HIGHEST. These could also be options in the LATEST enum: Latest.LOWEST and Latest.HIGHEST.

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.79.1

### Environment details (OS name and version, etc.)

macOS 13.3.1

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named; begin by locating the CDK metric-dimensions implementation and its tests. The issue needs an agreed definition of “latest” and how dimension values are discovered before implementation; done would include documented behavior and coverage for the chosen semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, observability-sre
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.