-
Notifications
You must be signed in to change notification settings - Fork 867
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
Separate HTTP client/server AttributesExtractors #4195
Separate HTTP client/server AttributesExtractors #4195
Conversation
@@ -21,7 +21,7 @@ | |||
* #onStart(AttributesBuilder, Object)} to have it available during sampling. | |||
* | |||
* @see DbAttributesExtractor | |||
* @see HttpAttributesExtractor | |||
* @see HttpClientAttributesExtractor |
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.
* @see HttpClientAttributesExtractor | |
* @see HttpClientAttributesExtractor | |
* @see HttpServerAttributesExtractor |
|
||
// TODO: these are specific to servers, should we remove those? | ||
set(attributes, SemanticAttributes.HTTP_TARGET, target(request)); | ||
set(attributes, SemanticAttributes.HTTP_HOST, host(request)); | ||
set(attributes, SemanticAttributes.HTTP_SCHEME, scheme(request)); |
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.
+1 for removing these. We can always add them later if there's really a compelling reason.
cc: @lmolkova
|
||
// TODO: this is specific to clients, should we remove this? | ||
set(attributes, SemanticAttributes.HTTP_URL, url(request)); |
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.
same, +1 for removing this and we can always add it later if there's really a compelling reason.
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 am not sure that we can remove this. I arbitrary took a couple of server instrumentation's extractor, and they all returned null
for attributes above
private String extractRoute(REQUEST request) { | ||
if (attributesExtractor instanceof HttpServerAttributesExtractor) { | ||
return ((HttpServerAttributesExtractor<REQUEST, ?>) attributesExtractor).route(request); | ||
} | ||
return null; | ||
} |
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.
is it worth HttpClientSpanNameExtractor
and HttpServerSpanNameExtractor
?
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.
Hmm, maybe we could have different factory methods in HttpSpanNameExtractor
? One accepting the client extractor, the other the server one
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.
instanceof
seems OK too from what I can tell
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.
Thanks for doing this!
private String extractRoute(REQUEST request) { | ||
if (attributesExtractor instanceof HttpServerAttributesExtractor) { | ||
return ((HttpServerAttributesExtractor<REQUEST, ?>) attributesExtractor).route(request); | ||
} | ||
return null; | ||
} |
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.
instanceof
seems OK too from what I can tell
👍 this is great, going to merge, TODOs make sense (to try) as follow-up(s) |
This PR splits
HttpAttributesExtractor
intoHttpClientAttributesExtractor
andHttpServerAttributesExtractor
- I need to do that before I implement the http headers semantic attributes that were recently added to the spec (because we'll want separate configurations for clients/servers).And maybe, if we decide on a solution here we'll be able to get #3700 done