Enabling OpenTelemetry
Set the--otel CLI flag or OTEL_ENABLED environment variable:
Configuring the exporter
Isthmus uses OTLP gRPC exporters for both traces and metrics. The OTel SDK reads standard environment variables to configure the exporter endpoint:
These are standard OTel SDK environment variables — not Isthmus-specific. See the OTel SDK docs for the full list.
Example: local Jaeger
http://localhost:16686 to see traces.
Example: Grafana Tempo + Prometheus
Example: MCP client config
Traces
Isthmus emits two types of spans:Query spans
Every SQL query executed through thequery tool creates a span:
If the query fails (validation error, execution error), the error is recorded on the span.
Tool call spans
Every MCP tool call (discover, describe_table, query) creates a span:
Tool call spans are parents of query spans — so a
query tool call shows the full lifecycle: MCP dispatch, SQL validation, query execution, and masking.
Metrics
Isthmus exposes four metrics:Useful queries
If your backend supports PromQL or a similar query language:Service resource
Isthmus registers itself with the following OTel resource attributes:
These appear in your tracing UI and can be used to filter traces.
Graceful shutdown
When Isthmus receivesSIGTERM or SIGINT, it flushes all pending traces and metrics before exiting (with a 5-second timeout). This ensures no data is lost during graceful shutdown.
When OTel is disabled
When--otel is not set (the default), all tracing and metrics use no-op implementations. There is zero overhead — no goroutines, no allocations, no network calls. You can safely leave OTel disabled in development.
Semantic conventions
Isthmus follows the OpenTelemetry Semantic Conventions for database spans:db.system="postgresql"(database semconv)db.operation.namefor the operation typedb.statementfor the SQL querydb.response.rowsfor the result size