-
Notifications
You must be signed in to change notification settings - Fork 1k
Add http client url template customizer #15217
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
base: main
Are you sure you want to change the base?
Conversation
Declarative config is ready to be used, so we should support declarative config only - similar to how you have to use declarative config for more advanced method config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering how this customizer is/should be related to the recently added InstrumenterCustomizer. They are closely related, so maybe InstrumenterCustomizer can just be extended.
...elemetry/instrumentation/api/incubator/semconv/http/HttpExperimentalAttributesExtractor.java
Show resolved
Hide resolved
...ntelemetry/javaagent/tooling/instrumentation/http/RegexUrlTemplateCustomizerInitializer.java
Outdated
Show resolved
Hide resolved
I don't know how to implement this on top of |
implemented |
...elemetry/instrumentation/api/incubator/semconv/http/HttpClientUrlTemplateCustomizerTest.java
Outdated
Show resolved
Hide resolved
something like but that's not thought through |
|
I wonder what the right place to document this is, in particular the declarative config syntax. Maybe a javadoc or README? |
The first hurdle is that you need to somehow tell which instrumenters are for http clients, incidentally I was planning to implement something for it. Assuming you can do it then you'd need some way to detect whether this attribute is already set. This can be done by calling |
Add an SPI for customizing http client
url.templateattribute and the http client span name that is computed from it. This PR also includes a regular expression based customizer that allows for matching the http client url agains regular expressions to produce url templates. It can be configured by settingotel.instrumentation.http.client.url-template-rulesto a semicolon separated string consisting of replacement rules where each rule is a comma separated triplet of regex pattern used to match url, replacement, whether this rule can override existing url template (optional parameter). Url template is computed viapattern.matcher(url).replaceFirst(replacement)so replacement can contain capture groups used in the pattern. Note that since url templates are experimentalotel.instrumentation.http.client.emit-experimental-telemetryalso needs to be set.