Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: LATEST keyword for metric dimensions #26946

Open
2 tasks
hhxiagithub opened this issue Aug 30, 2023 · 1 comment
Open
2 tasks

Feature Request: LATEST keyword for metric dimensions #26946

hhxiagithub opened this issue Aug 30, 2023 · 1 comment
Labels
@aws-cdk/aws-lambda Related to AWS Lambda effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@hhxiagithub
Copy link

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

@hhxiagithub hhxiagithub added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Aug 30, 2023
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Aug 30, 2023
@peterwoodworth peterwoodworth added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Aug 30, 2023
@peterwoodworth
Copy link
Contributor

Thanks for the request. Do know where the documentation for setting appVersion is so I can read more?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda Related to AWS Lambda effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

2 participants