-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into http-propagate
- Loading branch information
Showing
12 changed files
with
179 additions
and
112 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
15 changes: 9 additions & 6 deletions
15
api/include/opentelemetry/trace/propagation/detail/context.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 |
---|---|---|
@@ -1,26 +1,29 @@ | ||
#pragma once | ||
#include "opentelemetry/context/context.h" | ||
#include "opentelemetry/trace/default_span.h" | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
namespace trace | ||
{ | ||
namespace propagation | ||
{ | ||
namespace detail | ||
{ | ||
|
||
inline trace::SpanContext GetCurrentSpan(const context::Context &context) | ||
inline nostd::shared_ptr<trace::Span> GetSpan(const context::Context &context) | ||
{ | ||
context::ContextValue span = context.GetValue(trace::kSpanKey); | ||
if (nostd::holds_alternative<nostd::shared_ptr<trace::Span>>(span)) | ||
{ | ||
return nostd::get<nostd::shared_ptr<trace::Span>>(span).get()->GetContext(); | ||
return nostd::get<nostd::shared_ptr<trace::Span>>(span); | ||
} | ||
return nostd::shared_ptr<trace::Span>(new DefaultSpan(SpanContext::GetInvalid())); | ||
} | ||
|
||
inline context::Context SetSpan(context::Context &context, nostd::shared_ptr<trace::Span> span) | ||
{ | ||
|
||
return trace::SpanContext::GetInvalid(); | ||
return context.SetValue(kSpanKey, span); | ||
} | ||
|
||
} // namespace detail | ||
} // namespace propagation | ||
} // namespace trace | ||
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
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
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
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
Oops, something went wrong.