Skip to Content

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, or username and password).
  • 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 value label, so a trigger can aggregate it with max, avg or sum.

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

  1. Start Tares locally.

    tares up
  2. For Prometheus, open Sources → Add source → Prometheus. Enter the url and 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 at localhost: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 triggers

    You can also POST /api/sources with the same object.

  3. For OpenTelemetry metrics, open Sources → Add source → otlp. No config is required. The service label, taken from service.name, is the natural key. A label reads its value by path, so the service label uses resourceAttributes.service.name. A label with field: service gets no value from an OTLP event.

    - name: otel connector: otlp config: labels: - { name: service, field: resourceAttributes.service.name, primary: true }
  4. 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:4317

    On a secured instance (tares up --auth), exporters send an ingest-scoped API key as Authorization: Bearer <key>.

  5. If you use both routes and want them to join, mark the service label primary on both sources, as in the two examples above.

  6. 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 the service key.

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 value label that a trigger can aggregate. Filter the trigger to one metric by event_type, then aggregate value.
  • 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_quantile p99 rather than raw series, add a queries row with a single PromQL expression, an explicit event_type and a field. This is the advanced route for a computed metric.
  • If your applications already export OpenTelemetry, use the otlp connector 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_alerts connector is the better fit.

Still stuck? Get help

Last updated on