Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/switchyard-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ containing `opus`, `sonnet`, then `haiku`. Other ties preserve the route's targe
## Metrics

`GET /metrics` exposes Prometheus text from the server's process-wide OpenTelemetry provider.
Outbound OTLP export is disabled unless `SWITCHYARD_TELEMETRY` is explicitly enabled with a truthy
value such as `1` or `true`; configuring `OTEL_EXPORTER_OTLP_*` alone is not treated as telemetry
opt-in. The local `/metrics` endpoint remains available either way.
Routed-call compatibility metrics are:

| Metric | Type | Labels | Meaning |
Expand Down
4 changes: 4 additions & 0 deletions crates/switchyard-server/src/observability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use crate::{ServerError, ServerResult, metrics};

const DEFAULT_LOG_FILTER: &str = "info,opentelemetry=warn";
const DEFAULT_SERVICE_NAME: &str = "switchyard-server";
const SWITCHYARD_TELEMETRY_ENV: &str = "SWITCHYARD_TELEMETRY";

struct Observability {
tracer_provider: Option<SdkTracerProvider>,
Expand Down Expand Up @@ -76,6 +77,9 @@ pub(crate) fn otlp_enabled(signal: &str) -> bool {
if env_var_is_true("OTEL_SDK_DISABLED") {
return false;
}
if !env_var_is_true(SWITCHYARD_TELEMETRY_ENV) {
return false;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both env vars?

if env::var(format!("OTEL_{signal}_EXPORTER"))
.ok()
.filter(|value| !value.trim().is_empty())
Expand Down
Loading