opentracing-c
OpenTracing C API
Data Fields
opentracing_span_context Struct Reference

Span context interface. More...

#include <opentracing-c/span.h>

Inheritance diagram for opentracing_span_context:
[legend]
Collaboration diagram for opentracing_span_context:
[legend]

Data Fields

opentracing_destructible base
 Base class member. More...
 
void(* foreach_baggage_item )(struct opentracing_span_context *span_context, opentracing_bool(*f)(void *arg, const char *key, const char *value), void *arg)
 Calls a function for each baggage item in the span context. More...
 
const void * type_descriptor
 Unique data used to identify tracing vendor span type. More...
 
unsigned int type_descriptor_length
 Number of bytes the type descriptor occupies in memory.
 
- Data Fields inherited from opentracing_destructible
void(* destroy )(struct opentracing_destructible *destructible) OPENTRACINGC_NONNULL_ALL
 Destructor to clean up any resources allocated to the instance. More...
 

Detailed Description

Span context interface.

Span context represents span state that must be propagated to descendant spans and across boundaries (e.g. trace I:D, span ID, baggage).

Field Documentation

◆ base

opentracing_destructible opentracing_span_context::base

Base class member.

◆ foreach_baggage_item

void(* opentracing_span_context::foreach_baggage_item) (struct opentracing_span_context *span_context, opentracing_bool(*f)(void *arg, const char *key, const char *value), void *arg)

Calls a function for each baggage item in the span context.

If the function returns opentracing_false, it will not be called again, and foreach_baggage_item will return immediately.

Parameters
span_contextSpan context instance.
fCallback function. Takes a user-defined argument, the baggage key, and the baggage value.
argArgument to pass to callback function.

◆ type_descriptor

const void* opentracing_span_context::type_descriptor

Unique data used to identify tracing vendor span type.

Necessary for tracer to cast span to vendor's type during extract().

See also
extract()

Below is a sample of a potential tracer creating a new span with a unique type descriptor.

static const char* custom_span_context_identifier = "example_vendor";
typedef struct custom_span_context {
...
} custom_span_context;
custom_span_context ctx;
((opentracing_span_context*) &ctx)->type_descriptor =
custom_span_context_identifier;
((opentracing_span_context*) &ctx)->type_descriptor_length =
strlen(custom_span_context_identifier) + 1;

The documentation for this struct was generated from the following file: