swarm-queue-client: add an authenticated HttpClient for OTLP exporters (otel-auth feature)

This commit is contained in:
damocles 2026-08-26 22:38:18 +02:00 committed by mara
commit 7913be5435
5 changed files with 147 additions and 0 deletions

View file

@ -30,6 +30,18 @@ kv = ["async-nats/kv"]
# `cargo check -p swarm-nats-auth` — no `kv` anywhere in that build —
# surfaced it as `cannot find jetstream in async_nats`).
notices = ["async-nats/jetstream"]
# OFF by default, same reasoning as `kv`/`notices` above: only a caller
# wiring an OTLP exporter's `HttpClient` seam to this crate's identity
# (today, `swarm-controller`'s `vcs_metrics`/`hive_jobq_metrics`) needs
# `opentelemetry_http`/`async-trait`/`bytes`/`http` pulled in — a plain
# queue-connect-only consumer (the auth-callout responder, a hive
# publishing its status) has no reason to carry them.
otel-auth = [
"dep:opentelemetry-http",
"dep:async-trait",
"dep:bytes",
"dep:http",
]
[dependencies]
# Bare (no `kv`/`jetstream`) unless a consumer opts into the `kv` feature
@ -45,6 +57,12 @@ async-nats.workspace = true
# feature's comment above), and `cargo check -p swarm-queue-client` alone
# must not depend on what else is in the build.
reqwest = { workspace = true, features = ["blocking"] }
# All four `optional = true`, gated behind the `otel-auth` feature above —
# see that feature's own comment for why.
opentelemetry-http = { workspace = true, optional = true }
async-trait = { workspace = true, optional = true }
bytes = { workspace = true, optional = true }
http = { workspace = true, optional = true }
serde.workspace = true
serde_json.workspace = true
# A library, so its errors are a matchable enum rather than an opaque