-
Notifications
You must be signed in to change notification settings - Fork 941
Require service.instance.id and define how to generate it. #3222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,7 @@ groups: | |
| examples: ["Shop"] | ||
| - id: instance.id | ||
| type: string | ||
| requirement_level: required | ||
| brief: > | ||
| The string ID of the service instance. | ||
| note: > | ||
|
|
@@ -45,6 +46,19 @@ groups: | |
| 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). | ||
|
|
||
| SDKs are required to follow the following algorithm when generating | ||
| `service.instance.id`: | ||
|
Comment on lines
+50
to
+51
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we would merge any requirement like this, we will need to allow for plenty of time for our SDKs to adopt the change and gather feedback on how this works in practice before being able to call it stable.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm going to update this PR so that the algorithmic part is carved out as its own thing that can be stabilized independently of the meaning of |
||
|
|
||
| - If the user has provided a `service.instance.id`, via environment | ||
| variable, configuration or custom resource detection, this will | ||
| always be used and honored over generated ids. | ||
| - When the SDK is running in an environment where a non-ambiguous IP | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is impossible to detect such environments in general. Or do you have a concrete example? More importantly, I think the IP cannot be used, because it identifies the host, not the service. Multiple different services could be running with the same IP (on the same host, or in different private networks but still reporting to the same backend). I think the id is supposed to be unique without combining it with service.name. |
||
| address exists, the ID should be set to this IP address. | ||
| - When the environment the SDK targets provides a stable identifier | ||
| matching the goals of `service.instance.id`, then this may be used. | ||
|
Comment on lines
+56
to
+59
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like these are pretty vague requirements. As a maintainer, I have no idea how I would go about implementing these.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My problem is not that they are vague, but that they are quite arbitrary. E.g., why does IP address (2) have a priority over other possible stable native IDs (3)? Not to mention that with stacking of containers, the IP clearly does not meet the uniqueness requirement. I think the definition at L38 already lays out the requirements for instance ID. The exact algorithm should not be required, but can be a recommendation (sans the IP part).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The IP portion is vague. Figured in java we would use I do agree with @yurishkuro that "with stacking of containers, the IP clearly does not meet the uniqueness requirement".
What about adjusting the algorithm to allow other non-custom resource detectors to provide a
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jsuereth any chance you have time to make a couple small tweaks to this PR to reflect this feedback? IMO, this is really close.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. I wanted to get the other PRs through (for which this relies on, IMO). Give me a few days to retweak thewording and add more justification on WHY we need this. There's a lot of good concerns to address, and I want to make sure the updated PR addresses all of them. Unfortunately, can't mark this as draft due to already having one approval. |
||
| - When no other source is available the SDK MUST generate an ID. This | ||
| ID SHOULD follow version 1, 4 or 5 of RFC 4122. | ||
| examples: ["627cc493-f310-47de-96bd-71410b7dec09"] | ||
| - id: version | ||
| type: string | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -55,6 +55,7 @@ These are the attributes which MUST be provided by the SDK | |||||
| as specified in the [Resource SDK specification](../sdk.md#sdk-provided-resource-attributes): | ||||||
|
|
||||||
| - [`service.name`](#service) | ||||||
| - [`service.instance.id`](#service) | ||||||
|
|
||||||
| ## Service | ||||||
|
|
||||||
|
|
@@ -67,14 +68,24 @@ as specified in the [Resource SDK specification](../sdk.md#sdk-provided-resource | |||||
| |---|---|---|---|---| | ||||||
| | `service.name` | string | Logical name of the service. [1] | `shoppingcart` | Required | | ||||||
| | `service.namespace` | string | A namespace for `service.name`. [2] | `Shop` | Recommended | | ||||||
| | `service.instance.id` | string | The string ID of the service instance. [3] | `627cc493-f310-47de-96bd-71410b7dec09` | Recommended | | ||||||
| | `service.instance.id` | string | The string ID of the service instance. [3] | `627cc493-f310-47de-96bd-71410b7dec09` | Required | | ||||||
| | `service.version` | string | The version string of the service API or implementation. | `2.0.0` | Recommended | | ||||||
|
|
||||||
| **[1]:** MUST be the same for all instances of horizontally scaled services. If the value was not specified, SDKs MUST fallback to `unknown_service:` concatenated with [`process.executable.name`](process.md#process), e.g. `unknown_service:bash`. If `process.executable.name` is not available, the value MUST be set to `unknown_service`. | ||||||
|
|
||||||
| **[2]:** A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. `service.name` is expected to be unique within the same namespace. If `service.namespace` is not specified in the Resource then `service.name` is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace. | ||||||
|
|
||||||
| **[3]:** 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). | ||||||
| SDKs are required to follow the following algorithm when generating `service.instance.id`: | ||||||
| - If the user has provided a `service.instance.id`, via environment | ||||||
| variable, configuration or custom resource detection, this will | ||||||
| always be used and honored over generated ids. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| - When the SDK is running in an environment where a non-ambiguous IP | ||||||
| address exists, the ID should be set to this IP address. | ||||||
| - When the environment the SDK targets provides a stable identifier | ||||||
| matching the goals of `service.instance.id`, then this may be used. | ||||||
| - When no other source is available the SDK MUST generate an ID. This | ||||||
| ID SHOULD follow version 1, 4 or 5 of RFC 4122. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we define this UUID stuff as part of the algorithm to generate
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| <!-- endsemconv --> | ||||||
|
|
||||||
| Note: `service.namespace` and `service.name` are not intended to be concatenated for the purpose of forming a single globally unique name for the service. For example the following 2 sets of attributes actually describe 2 different services (despite the fact that the concatenation would result in the same string): | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be required. I understand that generating the ID can be done in an easy way and built into the SDK, but that is not enough of an argument to make this a required attribute IMHO.