move otel_http_client from swarm-queue-client into swarm-controller
This commit is contained in:
parent
361396cab8
commit
f3be08f6b6
9 changed files with 52 additions and 70 deletions
|
|
@ -118,8 +118,8 @@ fn build_provider(interval: Duration) -> Result<SdkMeterProvider> {
|
|||
// `.with_http_client(..)`: unlike the hive tier's own exporters, this
|
||||
// one crosses a real trust boundary (the swarm-tier `otlp/swarm`
|
||||
// receiver checks a bearer token's audience, see
|
||||
// `swarm_queue_client::otel_http_client`'s module doc) — a plain
|
||||
// endpoint-only client would be refused at the receiver.
|
||||
// `crate::otel_http_client`'s module doc) — a plain endpoint-only
|
||||
// client would be refused at the receiver.
|
||||
let exporter = MetricExporter::builder()
|
||||
.with_http()
|
||||
.with_protocol(Protocol::HttpJson)
|
||||
|
|
@ -135,8 +135,8 @@ fn build_provider(interval: Duration) -> Result<SdkMeterProvider> {
|
|||
.build())
|
||||
}
|
||||
|
||||
/// Build the [`swarm_queue_client::otel_http_client::AuthenticatedHttpClient`]
|
||||
/// this exporter pushes through.
|
||||
/// Build the [`crate::otel_http_client::AuthenticatedHttpClient`] this
|
||||
/// exporter pushes through.
|
||||
///
|
||||
/// The queue identity (`SWARM_CONTROLLER_OIDC_*`) is read fresh here rather
|
||||
/// than threaded in from a caller — by the time this runs, [`endpoint`] has
|
||||
|
|
@ -160,8 +160,8 @@ fn build_provider(interval: Duration) -> Result<SdkMeterProvider> {
|
|||
/// this unit for the same reason the forge client needs no special
|
||||
/// handling either) — a second, narrower trust bundle here would just be
|
||||
/// the same fact stated twice.
|
||||
pub(crate) fn authenticated_http_client()
|
||||
-> Result<swarm_queue_client::otel_http_client::AuthenticatedHttpClient> {
|
||||
pub(crate) fn authenticated_http_client() -> Result<crate::otel_http_client::AuthenticatedHttpClient>
|
||||
{
|
||||
let cfg = swarm_queue_client::QueueConfig::from_env("SWARM_CONTROLLER")
|
||||
.context("reading the queue identity this daemon authenticates its OTLP push with")?
|
||||
.ok_or_else(|| {
|
||||
|
|
@ -175,13 +175,11 @@ pub(crate) fn authenticated_http_client()
|
|||
"SWARM_CONTROLLER_OTEL_AUDIENCE is unset, but OTEL_EXPORTER_OTLP_ENDPOINT is — the nix \
|
||||
module sets both together",
|
||||
)?;
|
||||
Ok(
|
||||
swarm_queue_client::otel_http_client::AuthenticatedHttpClient::new(
|
||||
reqwest::blocking::Client::new(),
|
||||
cfg,
|
||||
audience,
|
||||
),
|
||||
)
|
||||
Ok(crate::otel_http_client::AuthenticatedHttpClient::new(
|
||||
reqwest::blocking::Client::new(),
|
||||
cfg,
|
||||
audience,
|
||||
))
|
||||
}
|
||||
|
||||
/// `service.name = swarm-controller` plus whatever the operator set in
|
||||
|
|
|
|||
Loading…
Reference in a new issue