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

Setup PublicEndpointFn option #2342

Merged
merged 2 commits into from Jul 7, 2022
Merged

Setup PublicEndpointFn option #2342

merged 2 commits into from Jul 7, 2022

Conversation

dmathieu
Copy link
Member

@dmathieu dmathieu commented Jun 9, 2022

Marking all endpoints as public is a pretty good way to avoid orphan spans.
However, this is an all-or-nothing situation, which is rarely accurate. For example, a public API could have both external and internal customers.
External customers' requests need to be considered as public, while internal ones need not to.

This introduces a WithPublicEndpointFn option, which allows setting a specific request as public or not based on the return value of a function.
A specific TraceContext baggage could then be set on all internal requests, to keep the context while discarding it for any request which doesn't have it.

@codecov
Copy link

codecov bot commented Jun 9, 2022

Codecov Report

Merging #2342 (b76c0c6) into main (099c817) will decrease coverage by 0.0%.
The diff coverage is 100.0%.

❗ Current head b76c0c6 differs from pull request most recent head 756c3fd. Consider uploading reports for the commit 756c3fd to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #2342     +/-   ##
=======================================
- Coverage   74.3%   74.2%   -0.1%     
=======================================
  Files        144     144             
  Lines       6563    6569      +6     
=======================================
+ Hits        4877    4880      +3     
- Misses      1543    1546      +3     
  Partials     143     143             
Impacted Files Coverage Δ
instrumentation/net/http/otelhttp/config.go 87.8% <100.0%> (+0.5%) ⬆️
instrumentation/net/http/otelhttp/handler.go 79.5% <100.0%> (-1.6%) ⬇️

Copy link
Contributor

@dashpole dashpole left a comment

Choose a reason for hiding this comment

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

I can see this being useful for kubernetes/kubernetes#103186 :).

instrumentation/net/http/otelhttp/config.go Show resolved Hide resolved
@dmathieu
Copy link
Member Author

dmathieu commented Jul 7, 2022

There was a blurp in one of the rebases, which made the test code non-parseable. I've rebased from my initial commit (dropping the merge commits).

@MrAlias MrAlias merged commit 7abe987 into open-telemetry:main Jul 7, 2022
@dmathieu dmathieu deleted the public-endpoint-fn branch July 7, 2022 16:03
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.

None yet

5 participants