Line data Source code
1 : #include "source/extensions/tracers/opentelemetry/samplers/always_on/always_on_sampler.h" 2 : 3 : #include <memory> 4 : #include <sstream> 5 : #include <string> 6 : 7 : #include "source/common/config/datasource.h" 8 : #include "source/extensions/tracers/opentelemetry/span_context.h" 9 : 10 : namespace Envoy { 11 : namespace Extensions { 12 : namespace Tracers { 13 : namespace OpenTelemetry { 14 : 15 : SamplingResult AlwaysOnSampler::shouldSample(const absl::optional<SpanContext> parent_context, 16 : const std::string& /*trace_id*/, 17 : const std::string& /*name*/, OTelSpanKind /*kind*/, 18 : OptRef<const Tracing::TraceContext> /*trace_context*/, 19 0 : const std::vector<SpanContext>& /*links*/) { 20 0 : SamplingResult result; 21 0 : result.decision = Decision::RECORD_AND_SAMPLE; 22 0 : if (parent_context.has_value()) { 23 0 : result.tracestate = parent_context.value().tracestate(); 24 0 : } 25 0 : return result; 26 0 : } 27 : 28 0 : std::string AlwaysOnSampler::getDescription() const { return "AlwaysOnSampler"; } 29 : 30 : } // namespace OpenTelemetry 31 : } // namespace Tracers 32 : } // namespace Extensions 33 : } // namespace Envoy