Skip to content

Per-Instance Library Contexts

Latest

Choose a tag to compare

@zaga00 zaga00 released this 20 Jul 14:52

Overview

Major release with an API and ABI break since v2.2.1 (library version 7:0:0). Provider state moved into per-instance handles and the new otelc_ctx library context replaces the previous global state, so multiple tracers, meters and loggers -- and with them several independently configured consumers, such as HAProxy OpenTelemetry filter instances -- now coexist in a single process. Existing consumers cannot recompile or link against the new shared object without source-level changes.

Breaking changes

  • otelc_init() now returns a struct otelc_ctx * and takes an optional signals context name; otelc_tracer_create(), otelc_meter_create() and otelc_logger_create() take that context, and otelc_deinit() releases it.
  • otelc_statistics() takes a meter argument for the per-meter instrument and view counters.
  • The ryml backend now rejects duplicate YAML keys at load.

What's new

  • Multiple instances per process: per-instance provider state and exporter logfiles, per-meter instrument and view handle maps, and reference-counted span maps across tracer destroys.
  • Named signals contexts: one YAML document holds several independent signal definitions, selected by name with a 'default' fallback; the legacy flat 2.x layout is still accepted. otelc_ctx_nstate_get() reports how the context name resolved against each signal section, and otelc_close_cfg() releases the parsed document early.
  • The meter hot path nearly doubled the single-instance metric throughput at high worker counts: shared-mutex handle maps, flat-vector attribute intermediates and a case-folded constant-time instrument index.
  • A per-signal enabled flag with a set_enabled operation gates telemetry creation at runtime, and a top-level handle_map_shards YAML key overrides the handle-map shard count.

Hardening

  • Destroying the last tracer releases the spans left open; every span and span context operation tolerates the handle maps torn down with that tracer, and creating a span context without a tracer fails instead of crashing.
  • Concurrent error reporting no longer double-frees a shared message, allocation failure inside a constructor returns an error instead of escaping the C API, and carrier injection releases the previous content instead of orphaning it.
  • The debug build presents one consistent debug ABI through its pkg-config file, the memory tracker tolerates being disabled while other threads allocate, and allocation callbacks are accepted only as a matching pair.

Build

  • The CMake build reached parity with the autotools output, from the generated headers through the pkg-config metadata to the option surface, and the semantic convention extraction runs on any POSIX awk.

The ChangeLog file carries the complete release notes.

Full Changelog: v2.2.1...v3.0.0