The content in this page is organized in the same order as the OpenTelemetry Specification.
All the MUST items in the original specification are implemented.
Context is implemented as a wrapper of NamedTuple, which means it is immutable. Each Task has exactly ONE
Context instance, which is injected into the task_local_storage of the current_task by the parent task automatically.
!!! warning Type piracy is used to the propagate context between tasks. See more discussions in #32
create_key is used to create a context key. But it is not exported yet because it seems to be only used internally until now.
Base.getindex(::Context, key) is implemented so to get a value in a Context, one can simply call ctx[key] to get
the associated value of a key in a ctx.
Setting value of a Context is not directly supported. Given that Context is immutable, updating an immutable object
in Julia seems strange. We provide the with_context function to create a new context based on the key-value
pairs in the current_context. This syntax is more common than the attach/detach operations in the original
specification.
Modules = [OpenTelemetryAPI]
Pages = ["context.jl"]
Private = false
inject_context! and extract_context are provided based on the original specification.
The GLOBAL_PROPAGATOR is set to a CompositePropagator, with multiple dispatch, each inner propagator can be
customized to handle different contexts and carriers. Since it's mainly used internally for now, it's not exposed yet.
Modules = [OpenTelemetryAPI]
Pages = ["propagator_basic.jl", "textmap_propagator.jl"]
Private = false
The relationship between trace provider, tracer, span context and span is depicted below:
┌────────────────────────────┐
│ AbstractSpan │
│ ┌──────────────────────┐ │
│ │ Tracer │ │
│ │ ┌────────────────┐ │ │
│ │ │ Abstract │ │ │
│ │ │ TracerProvider │ │ │
│ │ └────────────────┘ │ │
│ │ instrumentation │ │
│ │ ┌────────────────┐ │ │
│ │ │ name │ │ │
│ │ │ version │ │ │
│ │ └────────────────┘ │ │
│ └──────────────────────┘ │
└────────────────────────────┘
In OpenTelemetryAPI.jl, only one concrete AbstractTracerProvider
(the DummyTracerProvider) is provided. It is set as the default
global_tracer_provider. Without SDK installed, the with_span
will only create a NonRecordingSpan. This is to make the OpenTelemetryAPI.jl
lightweight enough so that instrumentation package users can happily add it as a
dependency without losing performance.
Modules = [OpenTelemetryAPI]
Pages = ["tracer_provider.jl"]
Private = false
The relationship between MeterProvider, Meter and different instruments are depicted below:
┌─────────────────────────────┐
│AbstractInstrument │
│ │
│ name │
│ unit │
│ description │
│ │
│ meter │
│ ┌───────────────────────┐ │
│ │Meter │ │
│ │ │ │
│ │ provider │ │
│ │ ┌────────────────┐ │ │
│ │ │ Abstract │ │ │
│ │ │ MeterProvider │ │ │
│ │ └────────────────┘ │ │
│ │ name │ │
│ │ version │ │
│ │ schema_url │ │
│ │ │ │
│ │ instrumentation │ │
│ │ ┌────────────────┐ │ │
│ │ │ name │ │ │
│ │ │ version │ │ │
│ │ └────────────────┘ │ │
│ │ instruments │ │
│ │ │ │
│ │ * Counter │ │
│ │ * Histogram │ │
│ │ * UpDownCounter │ │
│ │ * ObservableCounter│ │
│ │ * Observable │ │
│ │ UpDownCounter │ │
│ └───────────────────────┘ │
│ │
└─────────────────────────────┘
- An
Instrumentbelongs to aMeter, eachMetermay contain many differentInstruments. Similarly, aMeterbelongs to aMeterProviderand aMeterProvidermay contain many differentMeters.
Modules = [OpenTelemetryAPI]
Pages = ["metric_provider.jl"]
Private = false
All instruments provided here can be classified into two categories: AbstractSyncInstrument and AbstractAsyncInstrument.
Modules = [OpenTelemetryAPI]
Pages = ["instruments.jl"]
Private = false
The idea is simple, a OtelLogTransformer is provided to transform each logging message into a LogRecord. To understand how to use it, users should be familiar with how TransformerLogger from LoggingExtras.jl works.
Modules = [OpenTelemetryAPI]
Pages = ["log.jl"]
Private = false
Modules = [OpenTelemetryAPI]