opentracing-c
OpenTracing C API
tracer.h
Go to the documentation of this file.
1 #ifndef OPENTRACINGC_TRACER_H
2 #define OPENTRACINGC_TRACER_H
3 
4 #include <opentracing-c/config.h>
6 #include <opentracing-c/span.h>
7 #include <opentracing-c/visibility.h>
8 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif /* __cplusplus */
14 
16 typedef struct opentracing_tag {
18  char* key;
22 
29 
34 
39 
45 
50 
54  int num_tags;
56 
61 typedef struct opentracing_tracer {
64 
79  void (*close)(struct opentracing_tracer* tracer) OPENTRACINGC_NONNULL_ALL;
80 
87  opentracing_span* (*start_span)(struct opentracing_tracer* tracer,
88  const char* operation_name)
89  OPENTRACINGC_NONNULL_ALL;
90 
98  opentracing_span* (*start_span_with_options)(
99  struct opentracing_tracer* tracer,
100  const char* operation_name,
101  const opentracing_start_span_options* options) OPENTRACINGC_NONNULL(1,
102  2);
103 
112  struct opentracing_tracer* tracer,
114  const opentracing_span_context* span_context) OPENTRACINGC_NONNULL_ALL;
115 
124  struct opentracing_tracer* tracer,
126  const opentracing_span_context* span_context) OPENTRACINGC_NONNULL_ALL;
127 
141  struct opentracing_tracer* tracer,
142  int (*callback)(void*, const char*, size_t),
143  void* arg,
144  const opentracing_span_context* span_context)
145  OPENTRACINGC_NONNULL(1, 2, 4);
146 
155  struct opentracing_tracer* tracer,
157  const opentracing_span_context* span_context) OPENTRACINGC_NONNULL_ALL;
158 
172  struct opentracing_tracer* tracer,
174  opentracing_span_context** span_context) OPENTRACINGC_NONNULL_ALL;
175 
189  struct opentracing_tracer* tracer,
191  opentracing_span_context** span_context) OPENTRACINGC_NONNULL_ALL;
192 
211  struct opentracing_tracer* tracer,
212  int (*callback)(void*, char*, size_t),
213  void* arg,
214  opentracing_span_context** span_context) OPENTRACINGC_NONNULL(1, 2, 4);
215 
229  struct opentracing_tracer* tracer,
231  opentracing_span_context** span_context) OPENTRACINGC_NONNULL_ALL;
233 
240 OPENTRACINGC_EXPORT opentracing_tracer* opentracing_global_tracer(void);
241 
248 OPENTRACINGC_EXPORT void opentracing_init_global_tracer(
249  opentracing_tracer* tracer) OPENTRACINGC_NONNULL_ALL;
250 
251 #ifdef __cplusplus
252 }
253 #endif /* __cplusplus */
254 
255 #endif /* OPENTRACINGC_TRACER_H */
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.
Definition: tracer.h:210
Duration type to calculate precise intervals (should use monotonic clock).
Definition: common.h:37
HTTP headers reader.
Definition: propagation.h:133
struct opentracing_start_span_options opentracing_start_span_options
Options used when calling start_span_with_options().
opentracing_propagation_error_code
Error codes for errors occurring in span context propagation.
Definition: propagation.h:16
struct opentracing_tag opentracing_tag
Simple tag representation.
const opentracing_span_reference * references
Array of references.
Definition: tracer.h:38
OPENTRACINGC_EXPORT void opentracing_init_global_tracer(opentracing_tracer *tracer) OPENTRACINGC_NONNULL_ALL
Install a global tracer.
Definition: tracer.c:232
Simple tag representation.
Definition: tracer.h:16
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.
Definition: tracer.h:111
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.
Definition: tracer.h:228
opentracing_duration start_time_steady
Start time using monotonic clock.
Definition: tracer.h:28
int num_references
Number of references in array.
Definition: tracer.h:44
Definition: span.h:125
The inject carrier for the opentracing_propagation_format_text_map.
Definition: propagation.h:65
Destructible interface.
Definition: destructible.h:16
const opentracing_tag * tags
Array of tags.
Definition: tracer.h:49
extract() carrier for a custom format.
Definition: propagation.h:146
The extract() carrier for the opentracing_propagation_format_text_map with it, the caller can decode ...
Definition: propagation.h:95
inject() carrier for a custom format.
Definition: propagation.h:169
opentracing_timestamp start_time_system
Start time using realtime clock.
Definition: tracer.h:33
OPENTRACINGC_EXPORT opentracing_tracer * opentracing_global_tracer(void)
Get the tracer singleton.
Definition: tracer.c:227
Options used when calling start_span_with_options().
Definition: tracer.h:24
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.
Definition: tracer.h:140
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.
Definition: tracer.h:171
struct opentracing_tracer opentracing_tracer
Tracer interface.
Tracer interface.
Definition: tracer.h:61
opentracing_destructible base
Base class member.
Definition: tracer.h:63
Timestamp type to represent absolute time (should use system clock).
Definition: common.h:43
void(* close)(struct opentracing_tracer *tracer) OPENTRACINGC_NONNULL_ALL
Close the tracer.
Definition: tracer.h:79
HTTP headers writer.
Definition: propagation.h:124
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.
Definition: tracer.h:154
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.
Definition: tracer.h:188
int num_tags
Number of tags in array.
Definition: tracer.h:54
Span interface.
Definition: span.h:161
Tagged union that can represent a number of value types.
Definition: value.h:30
Span context interface.
Definition: span.h:20
char * key
String key.
Definition: tracer.h:18
opentracing_value value
Generic value type.
Definition: tracer.h:20
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.
Definition: tracer.h:123