mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-02-01 13:07:51 +02:00
4e94f405ab
As discussed in a previous SIG meeting, this PR adds support for setting a default value for [`service.instance.id`](https://github.com/open-telemetry/semantic-conventions/tree/main/docs/resource#service-experimental) according to semantic conventions: > Implementations, such as SDKs, are recommended to generate a random Version 1 or Version 4 [RFC 4122](https://www.ietf.org/rfc/rfc4122.txt) UUID, but are free to use an inherent unique ID as the source of this value if stability is desirable. In that case, the ID SHOULD be used as source of a UUID Version 5 and SHOULD use the following UUID as the namespace: `4d63009a-8d0f-11ee-aad7-4c796ed8e320`. This PR follows the recommendation and populates `service.instance.id` with a random Version 4 UUID. The functionality is guarded by the `OTEL_GO_X_RESOURCE` feature flag environment variable. There are plans to declare `service.instance.id` stable and also make it a required attribute (similar to `service.name`). Once this happens, the functionality can be made available regardless of whether `OTEL_GO_X_RESOURCE` is set. Closes https://github.com/open-telemetry/opentelemetry-go-contrib/issues/5423 --------- Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com> Co-authored-by: Tyler Yahn <codingalias@gmail.com>