-
public final class OpenObservePropagationHelperFor internal usage only. Helper class for handling OpenObserve context propagation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classOpenObservePropagationHelper.Companion
-
Method Summary
Modifier and Type Method Description final BooleanisExtractedContext(OpenObserveSpanContext context)Determines if the provided OpenObserveSpanContext represents an extracted context. final UnitsetTraceContext(HttpRequestInfoBuilder requestInfoBuilder, String traceId, String spanId, Integer samplingPriority)Sets the trace context information as a tag on the request. final OpenObserveSpanContextextractParentContext(OpenObserveTracer tracer, HttpRequestInfo request)Extracts the parent span context from the request. final OpenObserveSpanContextcreateExtractedContext(String traceId, String spanId, Integer samplingPriority)Creates a OpenObserveSpanContext object that represents an extracted context from the given parameters. final <ERROR CLASS>propagateSampledHeaders(HttpRequestInfoBuilder builder, OpenObserveTracer tracer, OpenObserveSpan span, Set<TracingHeaderType> tracingHeaderTypes)Injects trace context headers for a sampled request. final <ERROR CLASS>propagateNotSampledHeaders(HttpRequestInfoBuilder builder, OpenObserveTracer tracer, OpenObserveSpan span, Set<TracingHeaderType> tracingHeaderTypes, TraceContextInjection injectionType, String traceOrigin)Handles trace context headers for a non-sampled request. final <ERROR CLASS>removeAllTracingHeaders(HttpRequestInfoBuilder builder)Removes all tracing headers from the request. final BooleanextractSamplingDecision(HttpRequestInfo request)Extracts the sampling decision from the request. -
-
Method Detail
-
isExtractedContext
final Boolean isExtractedContext(OpenObserveSpanContext context)
Determines if the provided OpenObserveSpanContext represents an extracted context.
- Parameters:
context- The OpenObserveSpanContext to be evaluated.
-
setTraceContext
final Unit setTraceContext(HttpRequestInfoBuilder requestInfoBuilder, String traceId, String spanId, Integer samplingPriority)
Sets the trace context information as a tag on the request.
- Parameters:
requestInfoBuilder- the request builder to add the trace context to.traceId- the trace ID to set.spanId- the span ID to set.samplingPriority- the sampling priority for the trace.
-
extractParentContext
final OpenObserveSpanContext extractParentContext(OpenObserveTracer tracer, HttpRequestInfo request)
Extracts the parent span context from the request. Checks both the request tags and headers for trace context information.
- Parameters:
tracer- the tracer to use for context extraction.request- the HTTP request info to extract context from.
-
createExtractedContext
final OpenObserveSpanContext createExtractedContext(String traceId, String spanId, Integer samplingPriority)
Creates a OpenObserveSpanContext object that represents an extracted context from the given parameters.
- Parameters:
traceId- The unique identifier for the trace.spanId- The unique identifier for the span.samplingPriority- The sampling priority value for determining the trace's sampling behavior.
-
propagateSampledHeaders
final <ERROR CLASS> propagateSampledHeaders(HttpRequestInfoBuilder builder, OpenObserveTracer tracer, OpenObserveSpan span, Set<TracingHeaderType> tracingHeaderTypes)
Injects trace context headers for a sampled request.
- Parameters:
builder- the request builder to add headers to.tracer- the tracer to use for context injection.span- the span containing the trace context.tracingHeaderTypes- the set of header types to inject.
-
propagateNotSampledHeaders
final <ERROR CLASS> propagateNotSampledHeaders(HttpRequestInfoBuilder builder, OpenObserveTracer tracer, OpenObserveSpan span, Set<TracingHeaderType> tracingHeaderTypes, TraceContextInjection injectionType, String traceOrigin)
Handles trace context headers for a non-sampled request. Depending on the injection type, may remove or inject headers with drop sampling priority.
- Parameters:
builder- the request builder to modify headers on.tracer- the tracer to use for context injection.span- the span containing the trace context.tracingHeaderTypes- the set of header types to handle.injectionType- whether to inject headers for non-sampled requests.traceOrigin- optional trace origin to include in headers.
-
removeAllTracingHeaders
final <ERROR CLASS> removeAllTracingHeaders(HttpRequestInfoBuilder builder)
Removes all tracing headers from the request. This is useful when starting a new independent trace for redirect requests.
- Parameters:
builder- the request builder to remove headers from.
-
extractSamplingDecision
final Boolean extractSamplingDecision(HttpRequestInfo request)
Extracts the sampling decision from the request. Checks headers and tags for existing sampling decisions.
- Parameters:
request- the HTTP request info to extract sampling decision from.
-
-
-
-