Skip to content

Remove url from HttpServerAttributesExtractor#4209

Merged
trask merged 26 commits intoopen-telemetry:mainfrom
trask:remove-url-from-http-server-attributes-extractor
Oct 3, 2021
Merged

Remove url from HttpServerAttributesExtractor#4209
trask merged 26 commits intoopen-telemetry:mainfrom
trask:remove-url-from-http-server-attributes-extractor

Conversation

@trask
Copy link
Copy Markdown
Member

@trask trask commented Sep 27, 2021

follow-up to #4195

resolves #3700
resolves #3699

if (publicAddress == null) {
return null;
}
return publicAddress.builder().build().getScheme();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we use

Suggested change
return publicAddress.builder().build().getScheme();
return publicAddress.get().getScheme();

instead of building another copy?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

oh that's much better(!)

@trask trask marked this pull request as ready for review September 29, 2021 03:26
.containsOnly(
entry(SemanticAttributes.HTTP_METHOD, "POST"),
entry(SemanticAttributes.HTTP_URL, "http://github.com"),
entry(SemanticAttributes.HTTP_TARGET, "github.com"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suspect I fudged - this test case should probably be changed to something that looks more normal, e.g. /repositories/1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed 😄

@Nullable
protected String host(Request request) {
return null;
URI uri = publicAddress.get();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Private method to get the public address (the simplification I was hoping for with my TODO didn't materialize...

Comment on lines +26 to +27
**[1]:** Most server instrumentation captures `http.scheme`, `http.host`, and `http.target`
(and does not capture `http.url`).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
**[1]:** Most server instrumentation captures `http.scheme`, `http.host`, and `http.target`
(and does not capture `http.url`).
**[1]:** Most server instrumentations capture `http.scheme`, `http.host`, and `http.target`
(and do not capture `http.url`).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I went back and forth on this 😂

@trask trask merged commit 92394ad into open-telemetry:main Oct 3, 2021
@trask trask deleted the remove-url-from-http-server-attributes-extractor branch October 3, 2021 16:17
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.

Don't capture http.scheme, http.host and http.target if already capturing http.url Remove unnecessary URL construction

4 participants