Bastion.OpenTelemetry
lib/otel.march — Bastion.OpenTelemetry: OTLP HTTP/JSON span exporter.
Attaches to all Bastion telemetry events and POSTs spans to an OpenTelemetry collector in OTLP protobuf-JSON format.
── Usage ──────────────────────────────────────────────────────────────────────
-- At application startup:
Bastion.OpenTelemetry.start(
Bastion.OpenTelemetry.default_config("my_app")
)
-- With a custom endpoint and auth header:
Bastion.OpenTelemetry.start({
endpoint = "https://otel.example.com/v1/traces",
service_name = "my_app",
headers = [("Authorization", "Bearer <token>")],
})Types
Functions
Build a default OTLP config pointing at a local collector.
let cfg = Bastion.OpenTelemetry.default_config("my_app")Build an OTLP span payload and POST it to the collector asynchronously.
Errors from the HTTP call are silently ignored (fire-and-forget).
Bastion.OpenTelemetry.export_span(config, event_name, 42, meta_json)