-
Notifications
You must be signed in to change notification settings - Fork 501
[CONFIGURATION] File configuration - sampler model #3468
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 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6d19359
[CONFIGURATION] File configuration - sampler model
marcalff 1c4a7a8
Refresh code from PR #2518, to fix review comments.
marcalff 1d307da
Merge branch 'main' into merge_config_sampler_model
dbarker 6f02e1e
Merge branch 'main' into merge_config_sampler_model
marcalff f1aa13c
Merge branch 'main' into merge_config_sampler_model
marcalff 3fa3c9d
Merge branch 'main' into merge_config_sampler_model
marcalff a1efa5a
Refresh code from PR #2518, to fix review comments (clang-tidy)
marcalff 1e11e06
Merge branch 'main' into merge_config_sampler_model
marcalff 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
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
sdk/include/opentelemetry/sdk/configuration/always_off_sampler_configuration.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,32 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "opentelemetry/sdk/configuration/sampler_configuration.h" | ||
| #include "opentelemetry/sdk/configuration/sampler_configuration_visitor.h" | ||
| #include "opentelemetry/version.h" | ||
|
|
||
| OPENTELEMETRY_BEGIN_NAMESPACE | ||
| namespace sdk | ||
| { | ||
| namespace configuration | ||
| { | ||
|
|
||
| // YAML-SCHEMA: schema/tracer_provider.json | ||
| // YAML-NODE: always_off | ||
| class AlwaysOffSamplerConfiguration : public SamplerConfiguration | ||
| { | ||
| public: | ||
| AlwaysOffSamplerConfiguration() = default; | ||
| ~AlwaysOffSamplerConfiguration() override = default; | ||
|
|
||
| void Accept(SamplerConfigurationVisitor *visitor) const override | ||
| { | ||
| visitor->VisitAlwaysOff(this); | ||
| } | ||
| }; | ||
|
|
||
| } // namespace configuration | ||
| } // namespace sdk | ||
| OPENTELEMETRY_END_NAMESPACE |
29 changes: 29 additions & 0 deletions
29
sdk/include/opentelemetry/sdk/configuration/always_on_sampler_configuration.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,29 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "opentelemetry/sdk/configuration/sampler_configuration.h" | ||
| #include "opentelemetry/sdk/configuration/sampler_configuration_visitor.h" | ||
| #include "opentelemetry/version.h" | ||
|
|
||
| OPENTELEMETRY_BEGIN_NAMESPACE | ||
| namespace sdk | ||
| { | ||
| namespace configuration | ||
| { | ||
|
|
||
| // YAML-SCHEMA: schema/tracer_provider.json | ||
| // YAML-NODE: always_on | ||
| class AlwaysOnSamplerConfiguration : public SamplerConfiguration | ||
| { | ||
| public: | ||
| AlwaysOnSamplerConfiguration() = default; | ||
| ~AlwaysOnSamplerConfiguration() override = default; | ||
|
|
||
| void Accept(SamplerConfigurationVisitor *visitor) const override { visitor->VisitAlwaysOn(this); } | ||
| }; | ||
|
|
||
| } // namespace configuration | ||
| } // namespace sdk | ||
| OPENTELEMETRY_END_NAMESPACE |
39 changes: 39 additions & 0 deletions
39
sdk/include/opentelemetry/sdk/configuration/jaeger_remote_sampler_configuration.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,39 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <memory> | ||
| #include <string> | ||
|
|
||
| #include "opentelemetry/sdk/configuration/sampler_configuration.h" | ||
| #include "opentelemetry/sdk/configuration/sampler_configuration_visitor.h" | ||
| #include "opentelemetry/version.h" | ||
|
|
||
| OPENTELEMETRY_BEGIN_NAMESPACE | ||
| namespace sdk | ||
| { | ||
| namespace configuration | ||
| { | ||
|
|
||
| // YAML-SCHEMA: schema/tracer_provider.json | ||
| // YAML-NODE: jaeger_remote | ||
| class JaegerRemoteSamplerConfiguration : public SamplerConfiguration | ||
| { | ||
| public: | ||
| JaegerRemoteSamplerConfiguration() = default; | ||
| ~JaegerRemoteSamplerConfiguration() override = default; | ||
|
|
||
| void Accept(SamplerConfigurationVisitor *visitor) const override | ||
| { | ||
| visitor->VisitJaegerRemote(this); | ||
| } | ||
|
|
||
| std::string endpoint; | ||
| size_t interval{0}; | ||
| std::unique_ptr<SamplerConfiguration> initial_sampler; | ||
| }; | ||
|
|
||
| } // namespace configuration | ||
| } // namespace sdk | ||
| OPENTELEMETRY_END_NAMESPACE | ||
40 changes: 40 additions & 0 deletions
40
sdk/include/opentelemetry/sdk/configuration/parent_based_sampler_configuration.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,40 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <memory> | ||
|
|
||
| #include "opentelemetry/sdk/configuration/sampler_configuration.h" | ||
| #include "opentelemetry/sdk/configuration/sampler_configuration_visitor.h" | ||
| #include "opentelemetry/version.h" | ||
|
|
||
| OPENTELEMETRY_BEGIN_NAMESPACE | ||
| namespace sdk | ||
| { | ||
| namespace configuration | ||
| { | ||
|
|
||
| // YAML-SCHEMA: schema/tracer_provider.json | ||
| // YAML-NODE: parent_based | ||
| class ParentBasedSamplerConfiguration : public SamplerConfiguration | ||
| { | ||
| public: | ||
| ParentBasedSamplerConfiguration() = default; | ||
| ~ParentBasedSamplerConfiguration() override = default; | ||
|
|
||
| void Accept(SamplerConfigurationVisitor *visitor) const override | ||
| { | ||
| visitor->VisitParentBased(this); | ||
| } | ||
|
|
||
| std::unique_ptr<SamplerConfiguration> root; | ||
marcalff marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| std::unique_ptr<SamplerConfiguration> remote_parent_sampled; | ||
| std::unique_ptr<SamplerConfiguration> remote_parent_not_sampled; | ||
| std::unique_ptr<SamplerConfiguration> local_parent_sampled; | ||
| std::unique_ptr<SamplerConfiguration> local_parent_not_sampled; | ||
| }; | ||
|
|
||
| } // namespace configuration | ||
| } // namespace sdk | ||
| OPENTELEMETRY_END_NAMESPACE | ||
29 changes: 29 additions & 0 deletions
29
sdk/include/opentelemetry/sdk/configuration/sampler_configuration.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,29 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "opentelemetry/version.h" | ||
|
|
||
| OPENTELEMETRY_BEGIN_NAMESPACE | ||
| namespace sdk | ||
| { | ||
| namespace configuration | ||
| { | ||
|
|
||
| class SamplerConfigurationVisitor; | ||
|
|
||
| // YAML-SCHEMA: schema/tracer_provider.json | ||
| // YAML-NODE: Sampler | ||
| class SamplerConfiguration | ||
| { | ||
| public: | ||
| SamplerConfiguration() = default; | ||
| virtual ~SamplerConfiguration() = default; | ||
|
|
||
| virtual void Accept(SamplerConfigurationVisitor *visitor) const = 0; | ||
| }; | ||
|
|
||
| } // namespace configuration | ||
| } // namespace sdk | ||
| OPENTELEMETRY_END_NAMESPACE |
37 changes: 37 additions & 0 deletions
37
sdk/include/opentelemetry/sdk/configuration/sampler_configuration_visitor.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,37 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "opentelemetry/version.h" | ||
|
|
||
| OPENTELEMETRY_BEGIN_NAMESPACE | ||
| namespace sdk | ||
| { | ||
| namespace configuration | ||
| { | ||
|
|
||
| class AlwaysOffSamplerConfiguration; | ||
| class AlwaysOnSamplerConfiguration; | ||
| class JaegerRemoteSamplerConfiguration; | ||
| class ParentBasedSamplerConfiguration; | ||
| class TraceIdRatioBasedSamplerConfiguration; | ||
| class ExtensionSamplerConfiguration; | ||
|
|
||
| class SamplerConfigurationVisitor | ||
| { | ||
| public: | ||
| SamplerConfigurationVisitor() = default; | ||
| virtual ~SamplerConfigurationVisitor() = default; | ||
|
|
||
| virtual void VisitAlwaysOff(const AlwaysOffSamplerConfiguration *model) = 0; | ||
| virtual void VisitAlwaysOn(const AlwaysOnSamplerConfiguration *model) = 0; | ||
| virtual void VisitJaegerRemote(const JaegerRemoteSamplerConfiguration *model) = 0; | ||
| virtual void VisitParentBased(const ParentBasedSamplerConfiguration *model) = 0; | ||
| virtual void VisitTraceIdRatioBased(const TraceIdRatioBasedSamplerConfiguration *model) = 0; | ||
| virtual void VisitExtension(const ExtensionSamplerConfiguration *model) = 0; | ||
| }; | ||
|
|
||
| } // namespace configuration | ||
| } // namespace sdk | ||
| OPENTELEMETRY_END_NAMESPACE |
34 changes: 34 additions & 0 deletions
34
sdk/include/opentelemetry/sdk/configuration/trace_id_ratio_based_sampler_configuration.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,34 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "opentelemetry/sdk/configuration/sampler_configuration.h" | ||
| #include "opentelemetry/sdk/configuration/sampler_configuration_visitor.h" | ||
| #include "opentelemetry/version.h" | ||
|
|
||
| OPENTELEMETRY_BEGIN_NAMESPACE | ||
| namespace sdk | ||
| { | ||
| namespace configuration | ||
| { | ||
|
|
||
| // YAML-SCHEMA: schema/tracer_provider.json | ||
| // YAML-NODE: trace_id_ratio_based | ||
| class TraceIdRatioBasedSamplerConfiguration : public SamplerConfiguration | ||
| { | ||
| public: | ||
| TraceIdRatioBasedSamplerConfiguration() = default; | ||
| ~TraceIdRatioBasedSamplerConfiguration() override = default; | ||
|
|
||
| void Accept(SamplerConfigurationVisitor *visitor) const override | ||
| { | ||
| visitor->VisitTraceIdRatioBased(this); | ||
| } | ||
|
|
||
| double ratio{0.0}; | ||
| }; | ||
|
|
||
| } // namespace configuration | ||
| } // namespace sdk | ||
| OPENTELEMETRY_END_NAMESPACE |
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.