Skip to content
DocumentationOpenTelemetry
OpenTelemetry
Query telemetry

Query telemetry

Query OpenTelemetry logs, traces, and metrics with SQL-backed tools in Altertable. Use the signal guides for individual records, then correlate signals or join them to business data with SQL.

In Altertable, the Logs explorer can group matching records into a segmentation chart over time. The Traces explorer can limit results to root spans, open a trace waterfall, and correlate a trace with its logs. Use SQL when you need to join telemetry to product, customer, or operational catalogs.

Query a signal

  • Logs contain log bodies, severity, and trace/span identifiers.
  • Traces contain request spans, timings, and service attributes.
  • Metrics contain gauge, sum, histogram, and summary points.

Correlate logs and traces

Join a log to its span using both trace_id and span_id:

SQL
SELECT
logs.timestamp,
logs.severity_text,
logs.body,
spans.service_name,
spans.name AS span_name
FROM opentelemetry.main.logs AS logs
JOIN opentelemetry.main.spans AS spans
ON logs.trace_id = spans.trace_id
AND logs.span_id = spans.span_id
WHERE logs.timestamp >= now() - INTERVAL '1 hour'
ORDER BY logs.timestamp DESC
LIMIT 100;

This query returns logs with matching spans. Logs without both identifiers or a matching span are not included. When joining telemetry to business data, also check customer or account identifiers and the time range.

Investigate with an agent

Agent prompt
Read https://altertable.ai/docs/opentelemetry/query.md for context. Help investigate errors from the last hour. Ask which service and telemetry signals to focus on, and show the evidence behind each finding.

For table schemas and accepted signals, see the data model. For the status of the Grafana integration, see Grafana availability.