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

Add ability to set custom subscopes on response metrics. #3524

Merged
merged 2 commits into from
May 26, 2021

Conversation

nbroyles
Copy link
Collaborator

This PR allows clients to set a special header, M3-Custom-Response-Metrics-Scope,
so that the response metrics can be created under the specified subscope.
Subscopes will be re-used if the same subscope is specified across multiple
requests.

What this PR does / why we need it:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing and/or backwards incompatible change?:


Does this PR require updating code package or user-facing documentation?:


This PR allows clients to set a special header, M3-Custom-Response-Metrics-Scope,
so that the response metrics can be created under the specified subscope.
Subscopes will be re-used if the same subscope is specified across multiple
requests.
@@ -73,6 +77,13 @@ func ResponseMetrics(opts options.MiddlewareOptions) mux.MiddlewareFunc {
path = "unknown"
}

customScopeName := r.Header.Get(headers.CustomResponseMetricsScope)
if customScopeName != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: can potentially generalize the case without a header to go through the same path? Not necessarily worth bothering with though

Copy link
Collaborator

@arnikola arnikola left a comment

Choose a reason for hiding this comment

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

LGTM

@nbroyles nbroyles enabled auto-merge (squash) May 26, 2021 22:36
@nbroyles nbroyles merged commit 1f7e0bc into master May 26, 2021
@nbroyles nbroyles deleted the nb/custom-scopes branch May 26, 2021 22:41
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.

2 participants