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 builders for setting optional attributes on HTTP extractors #5347

Conversation

mateuszrzeszutek
Copy link
Member

No description provided.

@mateuszrzeszutek mateuszrzeszutek requested a review from a team February 11, 2022 08:51
Comment on lines +107 to +112
HttpClientAttributesExtractor.builder(new TestHttpClientAttributesGetter())
.captureHttpHeaders(
CapturedHttpHeaders.create(
singletonList("Custom-Request-Header"),
singletonList("Custom-Response-Header")))
.build();
Copy link
Member

Choose a reason for hiding this comment

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

what do you think of hiding CapturedHttpHeaders and exposing captureHttpRequestHeaders and captureHttpResponseHeaders on the builders?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I'd probably prefer leaving this as it is, it's a bit simpler this way.

If I added captureHttpRequestHeaders(List<String>) I'd have to take the following things into account:

  • is it additive? does . captureHttpRequestHeaders(["abc"]).captureHttpRequestHeaders(["def"]) capture ["abc", "def"] or does the second call overwrite the first one?
  • do the default (configured) values get overwritten, or appended to?

With captureHttpHeaders(CapturedHttpHeaders) it's clear (I hope so? 😅 ) that the previous setting is overwritten. (Maybe I should rename it to setCapturedHttpHeaders after all...)

Copy link
Member

Choose a reason for hiding this comment

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

cc @anuraaga for any API thoughts

Copy link
Contributor

Choose a reason for hiding this comment

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

How about

setCapturedRequestHeaders
setCapturedResponseHeaders

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll do that in a separate PR - this requires changing all our HTTP library instrumentations, so the amount of changes will be pretty significant.

@mateuszrzeszutek mateuszrzeszutek force-pushed the http-attribute-extractor-builders branch from 583e894 to a44bcbf Compare March 8, 2022 08:53
@mateuszrzeszutek mateuszrzeszutek merged commit 4a98dae into open-telemetry:main Mar 8, 2022
@mateuszrzeszutek mateuszrzeszutek deleted the http-attribute-extractor-builders branch March 8, 2022 16:21
RashmiRam pushed a commit to RashmiRam/opentelemetry-auto-instr-java that referenced this pull request May 23, 2022
…-telemetry#5347)

* Add builders for setting optional attributes on HTTP extractors

* errorprone

* fix compilation failure
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.

3 participants