How do I get Prometheus metrics into Tares?
Tares polls your Prometheus server for the metrics you pick by name or by label, with no PromQL to write. Each series becomes a metric event on every poll tick. If your metrics come from OpenTelemetry instead, you point the exporter at the Tares OTLP endpoint and the metrics are pushed in.
How it works
Tares has two routes for metrics, and you choose by where the metrics live.
Prometheus route, polled. The prometheus connector reads a reachable Prometheus server on an interval.
- You give Tares the base URL, for example
http://localhost:9090, and any auth (bearer_token, orusernameandpassword). - Tares runs discovery against the URL and lists the server’s metrics and labels for you to pick from.
- You pick by name (a metric name or a
prefix_*pattern) or by label (pick a label, then tick the metrics that carry it). - Your picks compile into a single selector that ingests every chosen metric. Each event is named by its own metric name.
- The numeric value is stored as a number-typed
valuelabel, so a trigger can aggregate it withmax,avgorsum.
OpenTelemetry route, pushed. The otlp connector receives OTLP/HTTP logs, traces and metrics at POST /v1/{logs,traces,metrics}. One source ingests every service. Resource attributes such as service.name become labels, so what an OTel SDK or Collector exports correlates by service with no per-service setup. For OTLP/gRPC, install the otlp-grpc extra, and the receiver listens on :4317.
In both cases the events can be joined with your other sources on a shared key. For the wider picture of how Tares uses them, see AI SRE.
Set it up
-
Start Tares locally.
tares up -
For Prometheus, open Sources → Add source → Prometheus. Enter the
urland any auth, then choose Discover. Tick the metrics to ingest by name or by label, and confirm. Tares proposes the entity key and labels from a sample.You can also ask a connected agent: “Use tares to ingest the
pg_*metrics from the Prometheus atlocalhost:9090.” The agent discovers the metrics, samples your picks, tests one poll and creates the source. You name the metrics, and it never writes PromQL.The console and agent generate the config for you, so you rarely write it by hand. It looks like this:
- name: metrics connector: prometheus poll: 10s config: url: http://localhost:9090 queries: - promql: '{__name__=~"(pg_stat_database_xact_commit|pg_up)"}' # generated from your picks by_name: true labels: - { name: service, field: metric.service, primary: true } - { name: value, field: value, type: number } # the metric value, aggregate it in triggersYou can also
POST /api/sourceswith the same object. -
For OpenTelemetry metrics, open Sources → Add source → otlp. No config is required. The
servicelabel, taken fromservice.name, is the natural key. A label reads its value by path, so the service label usesresourceAttributes.service.name. A label withfield: servicegets no value from an OTLP event.- name: otel connector: otlp config: labels: - { name: service, field: resourceAttributes.service.name, primary: true } -
Point the exporter at Tares.
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:8787 # OTLP/HTTP → /v1/{logs,traces,metrics} # or gRPC (otlp-grpc extra): OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317On a secured instance (
tares up --auth), exporters send aningest-scoped API key asAuthorization: Bearer <key>. -
If you use both routes and want them to join, mark the
servicelabel primary on both sources, as in the two examples above. -
Verify. On the Prometheus source, Recent events shows one event per series per poll, and Fields shows the labels and the numeric
value. On the OTLP source, Recent events shows spans, logs and metric points as they arrive, and Explore lists services under theservicekey.
What you get
- Metrics you pick, ingested without writing a query. Discovery lists what the server has and you tick what you want.
- One event per series per poll from Prometheus, each named by its metric name.
- A number-typed
valuelabel that a trigger can aggregate. Filter the trigger to one metric byevent_type, then aggregatevalue. - Pushed OpenTelemetry metrics, alongside logs and traces, from one OTLP source that covers every service.
- Events from both routes that you can join with logs, deploys and alerts on the same key. Details on each connector are on the Prometheus connector page and the OpenTelemetry connector page.
When something else fits
- If you want a derived rate or a
histogram_quantilep99 rather than raw series, add aqueriesrow with a single PromQL expression, an explicitevent_typeand afield. This is the advanced route for a computed metric. - If your applications already export OpenTelemetry, use the
otlpconnector rather than polling, since the data is pushed to Tares as it is produced. - If you want the alerts your Prometheus rules have fired rather than the metrics, the
prometheus_alertsconnector is the better fit.