opentracing-c
OpenTracing C API
Data Fields
opentracing_span Struct Reference

Span interface. More...

#include <opentracing-c/span.h>

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

Data Fields

opentracing_destructible base
 Base class member. More...
 
void(* finish )(struct opentracing_span *span) OPENTRACINGC_NONNULL_ALL
 Sets the end timestamp and finalizes span state. More...
 
void(* finish_with_options )(struct opentracing_span *span, const opentracing_finish_span_options *options) OPENTRACINGC_NONNULL(1)
 Like finish() but with explicit control over timestamps and log data. More...
 
opentracing_span_context *(* span_context )(struct opentracing_span *span) OPENTRACINGC_NONNULL_ALL
 Yields the opentracing_span_context for this span. More...
 
void(* set_operation_name )(struct opentracing_span *span, const char *operation_name) OPENTRACINGC_NONNULL_ALL
 Sets or changes the operation name. More...
 
void(* set_tag )(struct opentracing_span *span, const char *key, const opentracing_value *value) OPENTRACINGC_NONNULL_ALL
 Adds a tag to the span. More...
 
void(* log_fields )(struct opentracing_span *span, const opentracing_log_field *fields, int num_fields) OPENTRACINGC_NONNULL(1)
 Record key:value logging data about a span. More...
 
void(* set_baggage_item )(struct opentracing_span *span, const char *key, const char *value) OPENTRACINGC_NONNULL_ALL
 Sets a key:value pair on this span and its span context that also propagates to descendants of this span. More...
 
const char *(* baggage_item )(const struct opentracing_span *span, const char *key) OPENTRACINGC_NONNULL_ALL
 Gets the value for a baggage item given its key. More...
 
struct opentracing_tracer *(* tracer )(const struct opentracing_span *span) OPENTRACINGC_NONNULL_ALL
 Provides access to the tracer that created this span. More...
 
- 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 interface.

Field Documentation

◆ baggage_item

const char*(* opentracing_span::baggage_item) (const struct opentracing_span *span, const char *key) OPENTRACINGC_NONNULL_ALL

Gets the value for a baggage item given its key.

Parameters
spanSpan instance.
keyBaggage key.
Returns
If baggage key found, returns baggage value, otherwise returns empty string.

◆ base

opentracing_destructible opentracing_span::base

Base class member.

◆ finish

void(* opentracing_span::finish) (struct opentracing_span *span) OPENTRACINGC_NONNULL_ALL

Sets the end timestamp and finalizes span state.

With the exception of calls to context (which are always allowed), finish must be the last call made to any span instance, and to do otherwise leads to undefined behavior.

Parameters
spanSpan instance.
See also
context

◆ finish_with_options

void(* opentracing_span::finish_with_options) (struct opentracing_span *span, const opentracing_finish_span_options *options) OPENTRACINGC_NONNULL(1)

Like finish() but with explicit control over timestamps and log data.

Parameters
spanSpan instance.
optionsOptions to override in span completion.
See also
finish

◆ log_fields

void(* opentracing_span::log_fields) (struct opentracing_span *span, const opentracing_log_field *fields, int num_fields) OPENTRACINGC_NONNULL(1)

Record key:value logging data about a span.

Parameters
spanSpan instance.
fieldsArray of log fields. Values must be copied from argument. Caller must free fields when finished using them.
num_fieldsNumber of log fields.
See also
finish_with_options

◆ set_baggage_item

void(* opentracing_span::set_baggage_item) (struct opentracing_span *span, const char *key, const char *value) OPENTRACINGC_NONNULL_ALL

Sets a key:value pair on this span and its span context that also propagates to descendants of this span.

set_baggage_item() enables powerful functionality given a full-stack opentracing integration (e.g. arbitrary application data from a mobile app can make it, transparently, all the way into the depths of a storage system), and with it some powerful costs: use this feature with care.

Attention
set_baggage_item() will only propagate baggage items to future causal descendants of the associated span.
Use this thoughtfully and with care. Every key and value is copied into every local and remote child of the associated span, and that can add up to a lot of network and CPU overhead.
Parameters
spanSpan instance.
keyBaggage key.
valueBaggage value.

◆ set_operation_name

void(* opentracing_span::set_operation_name) (struct opentracing_span *span, const char *operation_name) OPENTRACINGC_NONNULL_ALL

Sets or changes the operation name.

Parameters
spanSpan instance.
operation_nameNew operation name.

◆ set_tag

void(* opentracing_span::set_tag) (struct opentracing_span *span, const char *key, const opentracing_value *value) OPENTRACINGC_NONNULL_ALL

Adds a tag to the span.

If there is a pre-existing tag set for key, it is overwritten. Tag values can be numeric types, strings, or bools. The behavior of other tag value types is undefined at the OpenTracing level. If a tracing system does not know how to handle a particular value type, it may ignore the tag, but shall not panic.

Parameters
spanSpan instance.
keyTag key. Value copied into new allocated string.
valueTag value. Value copied into opentracing_value.

◆ span_context

opentracing_span_context*(* opentracing_span::span_context) (struct opentracing_span *span) OPENTRACINGC_NONNULL_ALL

Yields the opentracing_span_context for this span.

Note that the return value of context is still valid after a call to finish, as is a call to span_context after a call to finish.

Parameters
spanSpan instance.
Returns
Span context associated with this span.
See also
finish

◆ tracer

struct opentracing_tracer*(* opentracing_span::tracer) (const struct opentracing_span *span) OPENTRACINGC_NONNULL_ALL

Provides access to the tracer that created this span.

Parameters
spanSpan instance.
Returns
Tracer instance that created this span.

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