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

オープン
#426 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
66/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
go

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Go
スター
2
フォーク
6
平均マージ
23時間 44分
マージ済み PR(30日)
133

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

stacklok/toolhive-core のほかの issue

stacklok/toolhive-core の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。