Skip to main content

create_public_api_span

Function create_public_api_span 

Source
pub fn create_public_api_span(
    ctx: &Context<'_>,
    tracer: Option<Arc<dyn Tracer>>,
    public_api_instrumentation: Option<PublicApiInstrumentationInformation>,
) -> Option<Arc<dyn Span>>
Expand description

Creates a span for the public API instrumentation policy.

This function creates a span for the public API instrumentation policy based on the public API information in the context.

If no PublicApiInstrumentationInformation is provided, then this function will look in the Context for a PublicApiInstrumentationInformation value, if it is not present, it will return None.

§Arguments

  • ctx: The context containing the public API information.
  • tracer: An optional tracer to use for creating the span.
  • public_api_instrumentation: Optional public API instrumentation information.

§Returns

An optional span if the public API information is present and a tracer is available.

If the context already has a span, it will return None to avoid nested spans. If the context does not have a tracer it will use the value of the tracer argument. If no tracer can be determined, it will return None.