open-telemetry / open-telemetry/opentelemetry-cpp

Generate a `service.instance.id` if it is not present?

Open
#1,908 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

do-not-stale issue:blocked spec-compliance
Dominant language
C++
Stars
1.4k
Forks
632
Avg merge
1d 13h
Merged PRs (30d)
75

Description

Spec says https://github.com/open-telemetry/opentelemetry-specification/tree/v1.6.1/specification/resource/semantic_conventions#service

MUST be unique for each instance of the same service.namespace,service.name pair (in other words service.namespace,service.name,service.instance.id triplet MUST be globally unique). The ID helps to distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled service). It is preferable for the ID to be persistent and stay the same for the lifetime of the service instance, however it is acceptable that the ID is ephemeral and changes during important lifetime events for the service (e.g. service restarts). If the service has no inherent unique ID that can be used as the value of this attribute it is recommended to generate a random Version 1 or Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use Version 5, see RFC 4122 for more recommendations).

The built-in default Resource doesn't appear to do this. While it is not mandatory by specification, it is important when scaling a service horizontally.

https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md#single-writer

https://github.com/open-telemetry/opentelemetry-specification/blob/7e9ba1683995c34846b942fbc23c3290610e9347/specification/compatibility/prometheus_and_openmetrics.md#resource-attributes

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue identifies the built-in default Resource and links the OpenTelemetry service resource and metrics specifications, but names no implementation file or test. Start by locating the default Resource behavior and its existing tests, then compare it with the cited guidance. Done should include agreed service.instance.id behavior and tests covering it.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.