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

Aggregate Micrometer "uri" label values under uri template #1493

Merged
merged 5 commits into from Sep 1, 2021

Conversation

martinacat
Copy link
Contributor

@martinacat martinacat commented Aug 26, 2021

Overview

Use path expression rather than explicit value for Micrometer uri labels

This new default means that the value of the uri metric label becomes /get/{id} rather than /get/123

  • Changes the default value of the uri label
  • Adds a bunch of new unit tests around that feature

Motivation

This change provides better aggregation, protecting time series databases such as Prometheus from a large influx of time series (high-cardinality metrics).

Currently - as noted in #1481 - enabling feign client metrics from config on clients with a parametrized urls creates a scenario where a new time series is produced for each value of the provided parameter. This provides extremely high-cardinality metrics at a fast rate endangering the underlying time series database. (Resolves #1481, related to #873)

When traffic is significant, collecting client metrics with an uri expression such as reservation/{reservationId} can generate tens of thousands of time series (one for each value of the label, a potentially infinite set), putting Prometheus at risk. Enabling OOTB metrics without being aware of the high cardinality of some metrics is quite easy to do, so we thought we could protect some users by changing the default behavior

Testing

  • Unit tests written
  • Approach was also tested on one of my existing applications as described in this comment

Screen Shot 2021-08-26 at 12 38 08 PM

Questions

  • Is there any integration or regression tests that are worth expanding to cover this feature?
  • Which CHANGELOG can I add this feature to?

Thank you for your time! 😊

…abels

* e.g. "/get/{id}" rather than "/get/123"
* this provides better aggregation, protecting the time series database
@martinacat martinacat changed the title [WIP] Use expression rather than explicit value for Micrometer "uri" labels Aggregate Micrometer "uri" label values under path expression Aug 26, 2021
@martinacat martinacat marked this pull request as ready for review August 26, 2021 18:35
@martinacat
Copy link
Contributor Author

Might be of interest for @velo and @tommyk-gears 😊

@martinacat martinacat changed the title Aggregate Micrometer "uri" label values under path expression Aggregate Micrometer "uri" label values under uri template Aug 27, 2021
}

@Test
public void clientMetricsHaveUriLabel() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this tests to the AbstractMetricsTestBase, likely this will fail for dropwizard-metrics which would need to be made consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see - I originally placed it in AbstractMetricsTestBase, however I realised that dropwizard-metrics don't attach uri and thought that was a design decision. If necessary I can add uri on dropwizard 4 and 5 - is that what we would like? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have moved the tests in AbstractMetricsTestBase and made dropwizard-metrics 4 & 5 consistent :)

@martinacat martinacat requested a review from velo September 1, 2021 13:52
@velo velo merged commit c715049 into OpenFeign:master Sep 1, 2021
@martinacat martinacat deleted the uri-label-value-as-expression branch October 27, 2021 09:18
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.

Feign Micrometer processes slugs in URIs
2 participants