userver: tracing Namespace Reference
Loading...
Searching...
No Matches
tracing Namespace Reference

Detailed Description

Opentracing support.

Classes

class  DefaultTracingManagerLocator
 Component that provides access to the actual TracingManager that is used in handlers and clients. More...
 
class  GenericTracingManager
 Generic tracing manager that knows about popular tracing headers and allows customising input and output headers. More...
 
class  InPlaceSpan
 Avoids an extra allocation by storing tracing::Span data in-place. More...
 
class  ScopeTime
 Type to measure execution time of a scope. More...
 
class  Span
 Measures the execution time of the current code block, links it with the parent tracing::Spans and stores that info in the log. More...
 
class  SpanBuilder
 Provides interface for editing Span, before final building. More...
 
class  TagScope
 RAII object that calls Span::AddTag/Span::AddTagFrozen function in constructor and reverts these actions in destructor. More...
 
class  Tracer
 
class  TracingManagerBase
 Base class for propagating trace context information in headers. More...
 
class  TracingManagerComponentBase
 Base component for implementing TracingManager component. More...
 

Typedefs

using TracerPtr = std::shared_ptr<Tracer>
 

Enumerations

enum class  Format : short {
  kYandexTaxi = 1 << 1 ,
  kYandex = 1 << 2 ,
  kOpenTelemetry = 1 << 3 ,
  kB3Alternative = 1 << 4
}
 
enum class  ReferenceType {
  kChild ,
  kReference
}
 

Functions

Format FormatFromString (std::string_view format)
 Converts a textual representation of format into tracing::Format enum.
 
bool TryFillSpanBuilderFromRequest (Format format, const server::http::HttpRequest &request, SpanBuilder &span_builder)
 
void FillRequestWithTracingContext (Format format, const tracing::Span &span, clients::http::RequestTracingEditor request)
 
void FillResponseWithTracingContext (Format format, const Span &span, server::http::HttpResponse &response)
 
void SetThrottleReason (std::string value)
 Sets a Span tag with overload reason.
 
void SetThrottleReason (Span &span, std::string &&value)
 
TracerPtr MakeTracer (std::string_view service_name, logging::LoggerPtr logger, std::string_view tracer_type="native")
 Make a tracer that could be set globally via tracing::Tracer::SetTracer.
 

Variables

const std::string kType
 
const std::string kHttpUrl
 
const std::string kHttpMetaType
 
const std::string kHttpMethod
 
const std::string kHttpStatusCode
 
const std::string kAttempts
 
const std::string kMaxAttempts
 
const std::string kTimeoutMs
 
const std::string kErrorFlag
 
const std::string kErrorMessage
 
const std::string kDatabaseType
 
const std::string kDatabaseMongoType
 
const std::string kDatabasePostgresType
 
const std::string kDatabaseRedisType
 
const std::string kDatabaseCollection
 
const std::string kDatabaseInstance
 
const std::string kDatabaseStatement
 
const std::string kDatabaseStatementName
 
const std::string kDatabaseStatementDescription
 
const std::string kPeerAddress
 

Typedef Documentation

◆ TracerPtr

using tracing::TracerPtr = std::shared_ptr<Tracer>

Definition at line 12 of file tracer_fwd.hpp.

Enumeration Type Documentation

◆ Format

enum class tracing::Format : short
strong
Enumerator
kYandexTaxi 

Yandex Taxi/Lavka/Eda/... tracing:

http::headers::kXYaTraceId -> tracing::Span::GetTraceId() -> http::headers::kXYaTraceId
http::headers::kXYaRequestId -> tracing::Span::GetParentLink(); tracing::Span::GetLink() -> http::headers::kXYaRequestId
http::headers::kXYaSpanId -> tracing::Span::GetParentId(); tracing::Span::GetSpanId() -> http::headers::kXYaSpanId
kYandex 

Yandex Search tracing: http::headers::kXRequestId -> tracing::Span::GetTraceId() -> http::headers::kXRequestId

kOpenTelemetry 

Use http::headers::opentelemetry::kTraceState and http::headers::opentelemetry::kTraceParent headers to fill the tracing::opentelemetry::TraceParentData as per OpenTelemetry.

kB3Alternative 

Openzipkin b3 alternative propagation, where Span ID goes to partern ID:

b3::kTraceId -> tracing::Span::GetTraceId() -> b3::kTraceId
b3::kSpanId -> tracing::Span::GetParentId(); tracing::Span::GetSpanId() -> b3::kSpanId
span.GetParentId() -> b3::kParentSpanId

See https://github.com/openzipkin/b3-propagation for more info.

Definition at line 49 of file manager.hpp.

◆ ReferenceType

enum class tracing::ReferenceType
strong

Definition at line 9 of file tracer_fwd.hpp.