opentracing-c
OpenTracing C API
Data Fields
opentracing_tracer Struct Reference

Tracer interface. More...

#include <opentracing-c/tracer.h>

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

Data Fields

opentracing_destructible base
 Base class member. More...
 
void(* close )(struct opentracing_tracer *tracer) OPENTRACINGC_NONNULL_ALL
 Close the tracer. More...
 
opentracing_span *(* start_span )(struct opentracing_tracer *tracer, const char *operation_name) OPENTRACINGC_NONNULL_ALL
 Equivalent to calling start_span_with_options with options as NULL. More...
 
opentracing_span *(* start_span_with_options )(struct opentracing_tracer *tracer, const char *operation_name, const opentracing_start_span_options *options) OPENTRACINGC_NONNULL(1
 Start a new span with provided options. More...
 
opentracing_span *(*) opentracing_propagation_error_code(* inject_text_map )(struct opentracing_tracer *tracer, opentracing_text_map_writer *carrier, const opentracing_span_context *span_context) OPENTRACINGC_NONNULL_ALL
 Inject span context into text map carrier. More...
 
opentracing_propagation_error_code(* inject_http_headers )(struct opentracing_tracer *tracer, opentracing_http_headers_writer *carrier, const opentracing_span_context *span_context) OPENTRACINGC_NONNULL_ALL
 Inject span context into HTTP headers carrier. More...
 
opentracing_propagation_error_code(* inject_binary )(struct opentracing_tracer *tracer, int(*callback)(void *, const char *, size_t), void *arg, const opentracing_span_context *span_context) OPENTRACINGC_NONNULL(1
 Inject span context into binary carrier. More...
 
opentracing_propagation_error_code(*) opentracing_propagation_error_code(* inject_custom )(struct opentracing_tracer *tracer, opentracing_custom_carrier_writer *carrier, const opentracing_span_context *span_context) OPENTRACINGC_NONNULL_ALL
 Inject span context into custom carrier. More...
 
opentracing_propagation_error_code(* extract_text_map )(struct opentracing_tracer *tracer, opentracing_text_map_reader *carrier, opentracing_span_context **span_context) OPENTRACINGC_NONNULL_ALL
 Extract span context from carrier. More...
 
opentracing_propagation_error_code(* extract_http_headers )(struct opentracing_tracer *tracer, opentracing_http_headers_reader *carrier, opentracing_span_context **span_context) OPENTRACINGC_NONNULL_ALL
 Extract span context from carrier. More...
 
opentracing_propagation_error_code(* extract_binary )(struct opentracing_tracer *tracer, int(*callback)(void *, char *, size_t), void *arg, opentracing_span_context **span_context) OPENTRACINGC_NONNULL(1
 Extract span context from carrier. More...
 
opentracing_propagation_error_code(*) opentracing_propagation_error_code(* extract_custom )(struct opentracing_tracer *tracer, opentracing_custom_carrier_reader *carrier, opentracing_span_context **span_context) OPENTRACINGC_NONNULL_ALL
 Extract span context from carrier. 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

Tracer interface.

Field Documentation

◆ base

opentracing_destructible opentracing_tracer::base

Base class member.

◆ close

void(* opentracing_tracer::close) (struct opentracing_tracer *tracer) OPENTRACINGC_NONNULL_ALL

Close the tracer.

This may do nothing, flush pending spans, or whatever else a tracing implementation decides close should mean. If not called before the destruction of the tracer, the tracer must perform the equivalent of close upon destruction.

Attention
The main distinction between close and destroy is whether or not the tracer is in a valid state after the call. Upon destruction, subsequent use of a tracer may result in undefined behavior (i.e. members may be set to NULL causing deference of NULL member). However, after close, the tracer must not remain in an undefined state.
Parameters
tracerTracer instance.

◆ extract_binary

opentracing_propagation_error_code(* opentracing_tracer::extract_binary) (struct opentracing_tracer *tracer, int(*callback)(void *, char *, size_t), void *arg, opentracing_span_context **span_context) OPENTRACINGC_NONNULL(1

Extract span context from carrier.

Note
If the tracer cannot allocate a span, it should return the opentracing_propagation_error_code_unknown error code and set span_context to NULL.
Parameters
tracerTracer instance.
callbackBinary carrier callback. Passed user-defined argument, data buffer, and data buffer length. May be called multiple times to provide data from binary stream. Must return number of bytes read, with a negative number indicating an error, and zero indicating end of stream.
argBinary carrier callback argument.
[out]span_contextSpan context pointer to return decoded span. Set to NULL on propagation failure or out of memory.
Returns
Error code indicating success or failure.

◆ extract_custom

opentracing_propagation_error_code(*) opentracing_propagation_error_code(* opentracing_tracer::extract_custom) (struct opentracing_tracer *tracer, opentracing_custom_carrier_reader *carrier, opentracing_span_context **span_context) OPENTRACINGC_NONNULL_ALL

Extract span context from carrier.

Note
If the tracer cannot allocate a span, it should return the opentracing_propagation_error_code_unknown error code and set span_context to NULL.
Parameters
tracerTracer instance.
carrierCustom carrier.
[out]span_contextSpan context pointer to return decoded span. Set to NULL on propagation failure or out of memory.
Returns
Error code indicating success or failure.

◆ extract_http_headers

opentracing_propagation_error_code(* opentracing_tracer::extract_http_headers) (struct opentracing_tracer *tracer, opentracing_http_headers_reader *carrier, opentracing_span_context **span_context) OPENTRACINGC_NONNULL_ALL

Extract span context from carrier.

Note
If the tracer cannot allocate a span, it should return the opentracing_propagation_error_code_unknown error code and set span_context to NULL.
Parameters
tracerTracer instance.
carrierHTTP headers carrier.
[out]span_contextSpan context pointer to return decoded span. Set to NULL on propagation failure or out of memory.
Returns
Error code indicating success or failure.

◆ extract_text_map

opentracing_propagation_error_code(* opentracing_tracer::extract_text_map) (struct opentracing_tracer *tracer, opentracing_text_map_reader *carrier, opentracing_span_context **span_context) OPENTRACINGC_NONNULL_ALL

Extract span context from carrier.

Note
If the tracer cannot allocate a span, it should return the opentracing_propagation_error_code_unknown error code and set span_context to NULL.
Parameters
tracerTracer instance.
carrierText map carrier.
[out]span_contextSpan context pointer to return decoded span. Set to NULL on propagation failure or out of memory.
Returns
Error code indicating success or failure.

◆ inject_binary

opentracing_propagation_error_code(* opentracing_tracer::inject_binary) (struct opentracing_tracer *tracer, int(*callback)(void *, const char *, size_t), void *arg, const opentracing_span_context *span_context) OPENTRACINGC_NONNULL(1

Inject span context into binary carrier.

Parameters
tracerTracer instance.
callbackBinary carrier callback. Passed a user-defined argument, the binary data chunk, and the length of the binary data chunk. May be called multiple times in a row to write entire span context. Return non-zero to indicate write error.
argBinary carrier callback argument.
span_contextSpan context to serialize to carrier.
Returns
Error code indicating success or failure.

◆ inject_custom

opentracing_propagation_error_code(*) opentracing_propagation_error_code(* opentracing_tracer::inject_custom) (struct opentracing_tracer *tracer, opentracing_custom_carrier_writer *carrier, const opentracing_span_context *span_context) OPENTRACINGC_NONNULL_ALL

Inject span context into custom carrier.

Parameters
tracerTracer instance.
carrierCustom carrier.
span_contextSpan context to serialize to carrier.
Returns
Error code indicating success or failure.

◆ inject_http_headers

opentracing_propagation_error_code(* opentracing_tracer::inject_http_headers) (struct opentracing_tracer *tracer, opentracing_http_headers_writer *carrier, const opentracing_span_context *span_context) OPENTRACINGC_NONNULL_ALL

Inject span context into HTTP headers carrier.

Parameters
tracerTracer instance.
carrierHTTP headers carrier.
span_contextSpan context to serialize to carrier.
Returns
Error code indicating success or failure.

◆ inject_text_map

opentracing_span*(*) opentracing_propagation_error_code(* opentracing_tracer::inject_text_map) (struct opentracing_tracer *tracer, opentracing_text_map_writer *carrier, const opentracing_span_context *span_context) OPENTRACINGC_NONNULL_ALL

Inject span context into text map carrier.

Parameters
tracerTracer instance.
carrierText map carrier.
span_contextSpan context to serialize to carrier.
Returns
Error code indicating success or failure.

◆ start_span

opentracing_span*(* opentracing_tracer::start_span) (struct opentracing_tracer *tracer, const char *operation_name) OPENTRACINGC_NONNULL_ALL

Equivalent to calling start_span_with_options with options as NULL.

Parameters
tracerTracer instance.
operation_nameName of operation associated with span.
Returns
Span pointer on success, NULL otherwise.

◆ start_span_with_options

opentracing_span*(* opentracing_tracer::start_span_with_options) (struct opentracing_tracer *tracer, const char *operation_name, const opentracing_start_span_options *options) OPENTRACINGC_NONNULL(1

Start a new span with provided options.

Parameters
tracerTracer instance.
operation_nameName of operation associated with span.
optionsOptions to override default span initialization values.
Returns
Span pointer on success, NULL otherwise.

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