Feature request: Add multiple dimensets to the same Metrics instance #6198
Labels
feature-request
feature request
metrics
revisit
Maintainer to provide update or revisit prioritization in the next cycle
Use case
Overview
Enabling the AWS Powertools Python package to support multiple dimension sets for the same
Metrics
instance would significantly enhance the packages monitoring capabilities. This feature would allow users to gain more granular insights and comprehensive views of their applications by creating aggregating metrics across various dimensions.Reference Code
This feature request is akin to the
aws_embedded_metrics
(code link)put_dimensions
method which adds a dimension set to a commonMetricsContext
. The metrics then get serialized into Embedded Metric Format (EMF) with multiple dimension sets (code link).Example Use Case
This is a simplified example that demonstrates my use case. In my usecase, one of these dimensions's values is not known in advance. Instead, it is dynamically retrieved.
I am monitoring a lambda that gets deployed to two environments (beta and production) across three regions (
us-east-1
,us-west-1
, andeu-west-1
). My lambda produces application-specific metrics such asSuccessfulRequests
,FailedRequests
, andRetryCount
. By creating multiple dimension sets across these three dimensions, I can create aggregate metrics which enable a comprehensive view of my application.The generated EMF log may look something like this:
Benefits
Solution/User Experience
The following is an example uses a new
add_dimension_set
method defined in theAmazonCloudWatchEMFProvider
class.Considerations:
From my point of view, these are a few considerations that will need to be accounted for as part of this feature request.
add_dimension
add the dimension to all dimension sets? How does it work when invoked before or after theadd_dimension_set
method?add_dimension_set
handle duplicate dimensions? What about duplicate dimension keys, but differing values?add_dimension_set
) ?Alternatives
I've considered the following alternatives. Each of these solutions come up short compared to an easy-to-use method in powertools that lets me add multiple dimension set to the same metric value.
aws-embedded-metrics-python
EphemeralMetrics
for each dimensionsetAcknowledgment
The text was updated successfully, but these errors were encountered: