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

Fix maxdimassociator to loop through all mappings #1081

Merged
merged 1 commit into from
Aug 1, 2023

Conversation

cristiangreco
Copy link
Collaborator

@cristiangreco cristiangreco commented Jul 31, 2023

Mappings in the new associator are sorted by decreasing number of dimensions, e.g.

[ Mapping_Dim_A_Dim_B, Mapping_Dim_A_Dim_C, Mapping_Dim_A ]

If trying to map a metric with Dim_A, Dim_B and Dim_C, the current implementation would pic the first mapping (Mapping_Dim_A_Dim_B) because it already matches part of the metric dimensions and would try to find a match for dimensions names and values. However, if values don't match it would give up and mark the metric to be skipped.

The new implementation continues to loop through the regex mappings to check if there another one that contains the metric dimensions. In the example above, Mapping_Dim_A_Dim_C would match again and the algo would try again to find a match for dimensions names and values.

This should fix cases where ListMetrics returns metrics with more dimensions than can be extracted from the ARN regex. E.g. for ApiGateway the ARN contains only the ApiId dimension, but we should now be able to match metrics that contains both ApiId and Method (as long as the ApiId value matches).

Mappings in the new associator are sorted by decreasing number of
dimensions, e.g.

[ Mapping_Dim_A_Dim_B, Mapping_Dim_A_Dim_C, Mapping_Dim_A ]

If trying to map a metric with Dim_A, Dim_B and Dim_C, the current
implementation would pic the first mapping (Mapping_Dim_A_Dim_B) because
it already matches part of the metric dimensions and would try to find
a match for dimensions names and values. However, if values don't match
it would give up and mark the metric to be skipped.

The new implementation continues to loop through the regex mappings to
check if there another one that contains the metric dimensions. In the
example above, Mapping_Dim_A_Dim_C would match again and the algo would
try again to find a match for dimensions names and values.

This should fix cases where ListMetrics returns metrics with more
dimensions than can be extracted from the ARN regex. E.g. for ApiGateway
the ARN contains only the ApiId dimension, but we should now be able to
match metrics that contains both ApiId and Method (as long as the ApiId
value matches).
@cristiangreco cristiangreco force-pushed the cristian/fix-maxdimassoc-mapping-cycle branch 2 times, most recently from 72270b0 to 7c16594 Compare July 31, 2023 18:20
@cristiangreco cristiangreco marked this pull request as ready for review August 1, 2023 09:18
@cristiangreco cristiangreco merged commit d091557 into master Aug 1, 2023
3 of 4 checks passed
cristiangreco added a commit that referenced this pull request Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant