OtelBridge (otel_bridge v0.1.1)

Copy Markdown View Source

Bridges Telemetry.Metrics definitions into OpenTelemetry metrics.

The public API stays intentionally small:

  • callers define metric spec modules implementing OtelBridge.Spec
  • callers optionally attach observer children for gauge-like metrics
  • backend policy is selected via OtelBridge.Profile modules

Typical usage

children = [
  {OtelBridge,
   specs: [MyApp.Metrics],
   measurements: [{MyApp.Measurements, :dispatch, []}],
   meta: [service: "my_app"]}
]

Summary

Functions

Returns a standard supervisor child spec for OtelBridge.

Builds a metric reader config from a named or module-based backend profile.

Filters a list of Telemetry.Metrics definitions down to the metric shapes handled by the bridge runtime.

Starts the OtelBridge supervision tree.

Types

option()

@type option() ::
  {:metrics, [Telemetry.Metrics.t()]}
  | {:specs, [module()]}
  | {:optional_specs, [module()]}
  | {:measurements, [module() | {module(), atom(), [term()]}]}
  | {:meta, keyword()}
  | {:poller, keyword()}
  | {:observer_children, [Supervisor.child_spec()]}

Functions

child_spec(opts)

@spec child_spec([option()]) :: Supervisor.child_spec()

Returns a standard supervisor child spec for OtelBridge.

metric_reader!(profile, opts)

@spec metric_reader!(
  OtelBridge.Profile.profile_ref(),
  keyword()
) :: map()

Builds a metric reader config from a named or module-based backend profile.

prepare_metrics(metrics)

@spec prepare_metrics([Telemetry.Metrics.t()]) :: [Telemetry.Metrics.t()]

Filters a list of Telemetry.Metrics definitions down to the metric shapes handled by the bridge runtime.

start_link(opts)

@spec start_link([option()]) :: Supervisor.on_start()

Starts the OtelBridge supervision tree.

This is the main entrypoint most applications should use.