Interface SamplingResult

    • Method Detail

      • create

        static SamplingResult create​(SamplingResult.Decision decision,
                                     io.opentelemetry.api.common.Attributes attributes)
        Returns a SamplingResult with the given attributes and getDecision() returning decision.

        This is meant for use by custom Sampler implementations.

        Using create(Decision) instead of this method is slightly faster and shorter if you don't need attributes.

        Parameters:
        decision - The decision made on the span.
        attributes - The attributes to return from getAttributes(). A different object instance with the same elements may be returned.
        Returns:
        A SamplingResult with the attributes equivalent to attributes and the provided decision.
      • getDecision

        SamplingResult.Decision getDecision()
        Return decision on whether a span should be recorded, recorded and sampled or not recorded.
        Returns:
        sampling result.
      • getUpdatedTraceState

        default io.opentelemetry.api.trace.TraceState getUpdatedTraceState​(io.opentelemetry.api.trace.TraceState parentTraceState)
        Return an optionally-updated TraceState, based on the parent TraceState. This may return the same TraceState that was provided originally, or an updated one.
        Parameters:
        parentTraceState - The TraceState from the parent span. Might be an empty TraceState, if there is no parent. This will be the same TraceState that was passed in via the SpanContext parameter on the Sampler.shouldSample(Context, String, String, Span.Kind, Attributes, List) call.