telemetry/providers: set service.instance.id on the OTel resource so replicas stay distinct

Aperta
#426 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
66/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go

Direzione di ricerca

Start with telemetry/providers/providers.go and trace how New applies WithAttributes, WithFromEnv, and WithHost. Check the existing tests for provider resource attributes and how they cover CustomAttributes and OTEL_RESOURCE_ATTRIBUTES; then verify the default instance ID uses POD_NAME when set and hostname otherwise, while an explicit caller value wins.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

needs-triage
Problem

The resource built in telemetry/providers/providers.go (resource.New with WithAttributes, WithFromEnv, WithHost) sets service.name and service.version but never service.instance.id, the attribute the OTel semantic conventions designate for telling instances of the same service apart.

Consumers running more than one replica and pushing OTLP metrics to a collector whose Prometheus exporter is configured the default way (resource attributes are not converted to labels) get identical label sets from every replica. Each scrape then reflects whichever replica pushed last, so cumulative counters appear to flip between replicas' values. Prometheus reads every flip as a counter reset, which makes rate() and increase() report activity when nothing is happening.

Current behavior

The only per-replica attribute is host.name, which is only visible downstream if the collector enables resource_to_telemetry_conversion. Callers can work around this with WithCustomAttributes or OTEL_RESOURCE_ATTRIBUTES, but every consumer has to know to.

Request

Set service.instance.id by default when the caller hasn't provided one (via CustomAttributes or OTEL_RESOURCE_ATTRIBUTES). A reasonable source is POD_NAME when present, falling back to the hostname. An explicit value from the caller should always win.

Impact

Any service built on this package that runs multiple replicas against a default collector exporter.

Lingua principale
Go
Stelle
2
Fork
6
Merge medio
23h 44m
PR unite (30g)
133

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di stacklok/toolhive-core

Tutte le issue di stacklok/toolhive-core

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.