How do I get OpenTelemetry metric series into Tares?
Tares receives OpenTelemetry metrics over OTLP/HTTP at POST /v1/metrics, so you create an otlp source and point your SDK or Collector exporter at the Tares daemon. Metrics are pushed to Tares, so there is no polling interval and no query to write. One source covers every service, and resource attributes such as service.name become labels.
How it works
The OpenTelemetry connector is a push connector. Your exporter sends logs, traces and metrics to the Tares daemon, and Tares stores them as events under one otlp source.
- Endpoints. OTLP/HTTP arrives at
/v1/logs,/v1/tracesand/v1/metricson the daemon. OTLP/gRPC is optional and listens on port 4317. - One source for every service. Resource attributes, for example
service.name, become labels. Everything an OTel SDK or Collector exports correlates by service with no per-service setup. - Label paths. A label reads its value from a path into the event. Use
resourceAttributes.<key>for resource attributes,attributes.<key>for the attributes of a log record, span or data point, andtextfor the rendered log line. The service label isresourceAttributes.service.name. There is no bareservicefield in an OTLP event, so a label that usesfield: servicegets no value. - Prometheus is the polled alternative. If your metrics already live in a Prometheus server, the Prometheus connector polls the metrics you pick by name or by a label they carry. You write no PromQL. OpenTelemetry metrics skip that server and go straight to the OTLP endpoint.
Set it up
-
Start Tares and open the console, or use a connected agent. In the console go to Sources, then Add source, then otlp. The connector has no required config. Or ask your agent: “Use tares to create an OTLP source keyed by service.” The agent calls
create_sourcefor you. You can also sendPOST /api/sourceswith the object below. -
Save the source with the service label. The
fieldvalue isresourceAttributes.service.name, and the label is the primary one:
- name: otel
connector: otlp
config:
labels:
- { name: service, field: resourceAttributes.service.name, primary: true }-
If you join these metrics with another source, such as a Prometheus source, mark a label with the same name,
service, as primary on both sources. That gives both sources the same key to correlate on. -
Point your exporter at the daemon. Set the endpoint for OTLP/HTTP, or for gRPC if you installed the extra:
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:8787 # OTLP/HTTP → /v1/{logs,traces,metrics}
# or gRPC (otlp-grpc extra): OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317- For gRPC, install the
otlp-grpcextra first. The receiver then listens on port 4317. SetTARES_OTLP_GRPC_PORTto change the port, or tooffto disable it:
pip install 'tares[otlp-grpc]'-
If your Tares instance has auth on, the exporter sends a Bearer Authorization header holding an ingest-scoped API key. Without auth on, you do not need the header.
-
Verify. Open the source and check Recent events, which shows spans, logs and metric points as they arrive. Then open Explore, which lists services under the
servicekey.
The AI SRE guide shows what you can do with the data once it is flowing.
What you get
- OpenTelemetry metric points land in Tares as events as soon as your exporter sends them.
- One
otlpsource ingests every service. Theservicelabel comes fromresourceAttributes.service.name, so metrics, logs and traces from the same service share one key. - You can watch services arrive in Explore under the
servicekey and inspect each point in Recent events. - You keep your existing instrumentation. Only the exporter endpoint changes, and the same endpoint also takes your logs and traces.
- If you also poll Prometheus, marking
serviceprimary on both sources lets the two sets of data line up on the same key.
When something else fits
- Your metrics already live in a Prometheus server and you want to pick them by name or label: use the Prometheus connector, which polls on an interval and needs no PromQL.
- You only need logs, traces or metrics from a service that does not export OTLP: check the OpenTelemetry connector page first, then choose the connector that matches how the data leaves that service.