Program Listing for File parent.h
↰ Return to documentation for file (/home/docs/checkouts/readthedocs.org/user_builds/opentelemetry-cpp/checkouts/v1.0.0/sdk/include/opentelemetry/sdk/trace/samplers/parent.h
)
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "opentelemetry/sdk/common/atomic_shared_ptr.h"
#include "opentelemetry/sdk/trace/sampler.h"
OPENTELEMETRY_BEGIN_NAMESPACE
namespace sdk
{
namespace trace
{
namespace trace_api = opentelemetry::trace;
class ParentBasedSampler : public Sampler
{
public:
explicit ParentBasedSampler(std::shared_ptr<Sampler> delegate_sampler) noexcept;
SamplingResult ShouldSample(
const trace_api::SpanContext &parent_context,
trace_api::TraceId trace_id,
nostd::string_view name,
trace_api::SpanKind span_kind,
const opentelemetry::common::KeyValueIterable &attributes,
const trace_api::SpanContextKeyValueIterable &links) noexcept override;
nostd::string_view GetDescription() const noexcept override;
private:
const std::shared_ptr<Sampler> delegate_sampler_;
const std::string description_;
};
} // namespace trace
} // namespace sdk
OPENTELEMETRY_END_NAMESPACE