forked from open-telemetry/opentelemetry-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ETW Exporter] Tail based sampling support (open-telemetry#1780)
- Loading branch information
Showing
4 changed files
with
127 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
38 changes: 38 additions & 0 deletions
38
exporters/etw/include/opentelemetry/exporters/etw/etw_tail_sampler.h
This file contains 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,38 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
#include "opentelemetry/sdk/trace/sampler.h" | ||
#include "opentelemetry/trace/span.h" | ||
|
||
#pragma once | ||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
namespace exporter | ||
{ | ||
namespace etw | ||
{ | ||
|
||
class TailSampler | ||
{ | ||
public: | ||
// convert to etw span if required for getters on span. | ||
// auto etw_span = static_cast<const opentelemetry::exporter::etw::Span*>(&span); | ||
// Decision based on | ||
// Span::GetStatus() | ||
// Span::GetProperties() | ||
// Span::GetContext() | ||
virtual opentelemetry::sdk::trace::SamplingResult ShouldSample( | ||
const opentelemetry::trace::Span &span) noexcept = 0; | ||
}; | ||
|
||
class AlwaysOnTailSampler : public TailSampler | ||
{ | ||
public: | ||
opentelemetry::sdk::trace::SamplingResult ShouldSample( | ||
const opentelemetry::trace::Span &span) noexcept override | ||
{ | ||
return {opentelemetry::sdk::trace::Decision::RECORD_AND_SAMPLE}; | ||
} | ||
}; | ||
|
||
} // namespace etw | ||
} // namespace exporter | ||
OPENTELEMETRY_END_NAMESPACE |
This file contains 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 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