Module: Datadog::Tracing::OTelThreadContext

Defined in:
lib/datadog/tracing/otel_thread_context.rb,
ext/libdatadog_api/otel_thread_context.c

Overview

Publishes a per-thread OpenTelemetry context record into a thread-local slot, so an out-of-process reader (e.g. the eBPF profiler) can discover it.

See the "OTel Thread Context" OTEP: https://github.com/open-telemetry/opentelemetry-specification/blob/main/oteps/profiles/4947-thread-ctx.md

Native functions are implemented in ext/libdatadog_api/otel_thread_context.c

Defined Under Namespace

Modules: Testing

Class Method Summary collapse

Class Method Details

._native_clear ⇒ Object



27
# File 'ext/libdatadog_api/otel_thread_context.c', line 27

static VALUE native_clear(VALUE _self);

._native_enable ⇒ Object



29
# File 'ext/libdatadog_api/otel_thread_context.c', line 29

static VALUE native_enable(VALUE _self);

._native_set ⇒ Object



26
# File 'ext/libdatadog_api/otel_thread_context.c', line 26

static VALUE native_set(VALUE _self, VALUE trace_id, VALUE span_id, VALUE local_root_span_id);

._native_supported? ⇒ Boolean

Returns:

  • (Boolean)


28
# File 'ext/libdatadog_api/otel_thread_context.c', line 28

static VALUE native_supported_p(VALUE _self);

.clear ⇒ Object



28
29
30
# File 'lib/datadog/tracing/otel_thread_context.rb', line 28

def clear
  _native_clear
end

.enable! ⇒ Object



18
19
20
21
22
# File 'lib/datadog/tracing/otel_thread_context.rb', line 18

def enable!
  return false unless supported?

  _native_enable
end

.set(trace_id:, span_id:, local_root_span_id:) ⇒ Object



24
25
26
# File 'lib/datadog/tracing/otel_thread_context.rb', line 24

def set(trace_id:, span_id:, local_root_span_id:)
  _native_set(trace_id, span_id, local_root_span_id)
end

.supported? ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/datadog/tracing/otel_thread_context.rb', line 14

def supported?
  Datadog::Core::LIBDATADOG_API_FAILURE.nil? && _native_supported?
end