Skip to Content

How does an OTLP source know which service each log, span or metric came from?

Tares reads the service from the resource attributes on every OTLP log, span and metric, and turns service.name into the service label. One otlp source ingests every service, so everything your SDKs and Collectors export correlates by service with no per-service setup. Explore lists the services under the service key.

How it works

The otlp connector receives OTLP/HTTP logs, traces and metrics at POST /v1/logs, /v1/traces and /v1/metrics. It can also receive OTLP/gRPC if you install the otlp-grpc extra.

You create one source for all your services. Each event carries the resource attributes of the process that sent it, and Tares turns those attributes into labels. The label named service reads its value from resourceAttributes.service.name, so each log line, span and metric point is tagged with the service that emitted it.

A label reads its value from one of three places in the event, by path:

  • resourceAttributes followed by a key reads a resource attribute, for example resourceAttributes.service.name.
  • attributes followed by a key reads an attribute of a log record, span or data point.
  • text reads the rendered log line.

The path matters. OTLP events have no bare service field, so a label that reads a field named service gets no value. Always point the service label at resourceAttributes.service.name.

Because the service label is marked primary, it is the natural key for the source. Events from different services stay in one source and are told apart by that key.

Set it up

  1. Create the source. Ask a connected agent with “Use tares to create an OTLP source keyed by service.”, or go to Sources, Add source, otlp. There is no required config. You can also send the same object to POST /api/sources.

  2. Declare the service label with this source definition:

- name: otel connector: otlp config: labels: - { name: service, field: resourceAttributes.service.name, primary: true }
  1. Point your exporter at Tares. Use OTLP/HTTP, or gRPC if you installed the otlp-grpc 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
  1. Make sure each service sets service.name in its OTel resource. That attribute is what fills the service label. Tares needs no other per-service configuration.

  2. If your Tares has auth on, the sender uses a Bearer Authorization header holding an ingest-scoped API key. Without auth, you send nothing extra.

  3. Verify. Recent events shows spans, logs and metric points as they arrive. Explore lists your services under the service key.

The full field reference is on the OpenTelemetry connector page.

What you get

  • One source for every service. You add a new service by exporting to the same endpoint, not by creating another source.
  • Logs, traces and metrics from the same service share one service label, so they line up when you look at that service.
  • A service list in Explore under the service key, which tells you at a glance that each service is reporting.
  • Extra labels when you want them. Other resource attributes are available as resourceAttributes followed by the key, and per-record or per-span attributes as attributes followed by the key.

Once your services are labeled this way, see AI SRE for how Tares watches signals and investigates incidents.

When something else fits

  • If a service does not set service.name, the service label has nothing to read. Set it in the SDK or Collector resource, or add another label from a different resource attribute.
  • If you want a service-specific label that is not a resource attribute, read it from attributes followed by the key instead. That works for log records, spans and data points.
  • If the system you want to ingest does not speak OpenTelemetry, use the webhook connector for pushed JSON or a polled connector such as http_poll.

Still stuck? Get help

Last updated on