-
Notifications
You must be signed in to change notification settings - Fork 597
[SDK] refactor: exemplar filters #4267
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
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
21c3ab6
feat: examplar filters
proost b13986f
test: using mock
proost 8dc295b
doc: update change log
proost f99c77b
style: follow lint
proost 99d868a
Merge branch 'main' of github.com:open-telemetry/opentelemetry-cpp in…
proost a12d4c3
ci: higher test timeout
proost d793892
Merge branch 'main' of github.com:open-telemetry/opentelemetry-cpp in…
proost 60b9440
Merge branch 'main' of github.com:open-telemetry/opentelemetry-cpp in…
proost fd50a26
Merge branch 'main' of github.com:open-telemetry/opentelemetry-cpp in…
proost 5733f19
Merge branch 'main' into feat-exemplar-filters
dbarker ca5c78e
BREAKING: remove timestamp from OfferMeasurement
proost f4e1873
Merge branch 'feat-exemplar-filters' of github.com:proost/opentelemet…
proost 27b0702
Merge branch 'main' of github.com:open-telemetry/opentelemetry-cpp in…
proost af8d052
perf: use ExemplarFilterEnabled
proost 30496c0
fix: remove span context validation
proost 47625e6
style: rollback ctor order
proost cdac424
Merge branch 'main' of github.com:open-telemetry/opentelemetry-cpp in…
proost acd26fd
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
proost 5eddcd2
doc: update breaking change
proost 058a013
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
proost 685210e
Merge branch 'main' into feat-exemplar-filters
dbarker bcb6a0b
Merge branch 'main' into feat-exemplar-filters
dbarker 4418990
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
proost d86e581
Merge branch 'feat-exemplar-filters' of https://github.com/proost/ope…
proost 14c9c6b
Merge branch 'main' of github.com:open-telemetry/opentelemetry-cpp in…
proost 7bf2585
perf: remove allocation to heap
proost f979f57
Merge branch 'feat-exemplar-filters' of github.com:proost/opentelemet…
proost 42a13bd
Merge branch 'main' of github.com:open-telemetry/opentelemetry-cpp in…
proost 3645456
doc: update changelog
proost b314b34
fix: offer with attributes
proost 1d37a96
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
proost b95fecd
Merge branch 'main' into feat-exemplar-filters
dbarker de91279
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
proost 774ad44
Merge branch 'feat-exemplar-filters' of https://github.com/proost/ope…
proost e2dc0f4
Merge branch 'main' into feat-exemplar-filters
marcalff 0e5c5de
Merge branch 'main' of github.com:open-telemetry/opentelemetry-cpp in…
proost File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
sdk/include/opentelemetry/sdk/metrics/exemplar/filter_predicate.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #pragma once | ||
|
|
||
| #ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW | ||
|
|
||
| # include "opentelemetry/context/context.h" | ||
| # include "opentelemetry/sdk/metrics/exemplar/filter_type.h" | ||
| # include "opentelemetry/trace/context.h" | ||
| # include "opentelemetry/trace/span_context.h" | ||
| # include "opentelemetry/version.h" | ||
|
|
||
| OPENTELEMETRY_BEGIN_NAMESPACE | ||
| namespace sdk | ||
| { | ||
| namespace metrics | ||
| { | ||
|
|
||
| /** | ||
| * Decides whether a measurement is eligible to be offered to the exemplar reservoir. | ||
| * | ||
| * - kAlwaysOff : no measurement is eligible (exemplar sampling disabled). | ||
| * - kAlwaysOn : every measurement is eligible. | ||
| * - kTraceBased : eligible only when recorded inside a valid, sampled span. | ||
| */ | ||
| inline bool ExemplarFilterEnabled(ExemplarFilterType filter_type, | ||
| const opentelemetry::context::Context &context) noexcept | ||
| { | ||
| switch (filter_type) | ||
| { | ||
| case ExemplarFilterType::kAlwaysOn: | ||
| return true; | ||
| case ExemplarFilterType::kAlwaysOff: | ||
| return false; | ||
| default: // TraceBased. | ||
| const opentelemetry::trace::SpanContext span_context = | ||
| opentelemetry::trace::GetSpanContext(context); | ||
| return span_context.IsValid() && span_context.IsSampled(); | ||
| } | ||
| } | ||
|
|
||
| } // namespace metrics | ||
| } // namespace sdk | ||
| OPENTELEMETRY_END_NAMESPACE | ||
|
|
||
| #endif // ENABLE_METRICS_EXEMPLAR_PREVIEW |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.