Skip to content

Commit be971ee

Browse files
Moved Service attributes to registry (open-telemetry#758)
Co-authored-by: Joao Grassi <[email protected]>
1 parent bc41469 commit be971ee

File tree

9 files changed

+129
-68
lines changed

9 files changed

+129
-68
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ body:
5252
- area:process
5353
- area:rpc
5454
- area:server
55+
- area:service
5556
- area:source
5657
- area:thread
5758
- area:tls

.github/ISSUE_TEMPLATE/change_proposal.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ body:
4545
- area:process
4646
- area:rpc
4747
- area:server
48+
- area:service
4849
- area:source
4950
- area:thread
5051
- area:tls

.github/ISSUE_TEMPLATE/new-conventions.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ body:
5454
- area:process
5555
- area:rpc
5656
- area:server
57+
- area:service
5758
- area:source
5859
- area:thread
5960
- area:tls

docs/attributes-registry/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Currently, the following namespaces exist:
5858
* [Process](process.md)
5959
* [RPC](rpc.md)
6060
* [Server](server.md)
61+
* [Service](service.md)
6162
* [Source](source.md)
6263
* [Thread](thread.md)
6364
* [TLS](tls.md)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!--- Hugo front matter used to generate the website version of this page:
2+
--->
3+
4+
# Service
5+
6+
## Service Attributes
7+
8+
<!-- semconv registry.service(omit_requirement_level) -->
9+
| Attribute | Type | Description | Examples | Stability |
10+
|---|---|---|---|---|
11+
| `service.instance.id` | string | The string ID of the service instance. [1] | `627cc493-f310-47de-96bd-71410b7dec09` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
12+
| `service.name` | string | Logical name of the service. [2] | `shoppingcart` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
13+
| `service.namespace` | string | A namespace for `service.name`. [3] | `Shop` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
14+
| `service.version` | string | The version string of the service API or implementation. The format is not defined by these conventions. | `2.0.0`; `a01dbef8a` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
15+
16+
**[1]:** MUST be unique for each instance of the same `service.namespace,service.name` pair (in other words
17+
`service.namespace,service.name,service.instance.id` triplet MUST be globally unique). The ID helps to
18+
distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled
19+
service).
20+
21+
Implementations, such as SDKs, are recommended to generate a random Version 1 or Version 4 [RFC
22+
4122](https://www.ietf.org/rfc/rfc4122.txt) UUID, but are free to use an inherent unique ID as the source of
23+
this value if stability is desirable. In that case, the ID SHOULD be used as source of a UUID Version 5 and
24+
SHOULD use the following UUID as the namespace: `4d63009a-8d0f-11ee-aad7-4c796ed8e320`.
25+
26+
UUIDs are typically recommended, as only an opaque value for the purposes of identifying a service instance is
27+
needed. Similar to what can be seen in the man page for the
28+
[`/etc/machine-id`](https://www.freedesktop.org/software/systemd/man/machine-id.html) file, the underlying
29+
data, such as pod name and namespace should be treated as confidential, being the user's choice to expose it
30+
or not via another resource attribute.
31+
32+
For applications running behind an application server (like unicorn), we do not recommend using one identifier
33+
for all processes participating in the application. Instead, it's recommended each division (e.g. a worker
34+
thread in unicorn) to have its own instance.id.
35+
36+
It's not recommended for a Collector to set `service.instance.id` if it can't unambiguously determine the
37+
service instance that is generating that telemetry. For instance, creating an UUID based on `pod.name` will
38+
likely be wrong, as the Collector might not know from which container within that pod the telemetry originated.
39+
However, Collectors can set the `service.instance.id` if they can unambiguously determine the service instance
40+
for that telemetry. This is typically the case for scraping receivers, as they know the target address and
41+
port.
42+
43+
**[2]:** 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`.
44+
45+
**[3]:** 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.
46+
<!-- endsemconv -->

docs/resource/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ as specified in the [Resource SDK specification](https://github.com/open-telemet
8282
<!-- semconv service -->
8383
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
8484
|---|---|---|---|---|---|
85-
| `service.name` | string | Logical name of the service. [1] | `shoppingcart` | `Required` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
86-
| `service.version` | string | The version string of the service API or implementation. The format is not defined by these conventions. | `2.0.0`; `a01dbef8a` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
85+
| [`service.name`](../attributes-registry/service.md) | string | Logical name of the service. [1] | `shoppingcart` | `Required` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
86+
| [`service.version`](../attributes-registry/service.md) | string | The version string of the service API or implementation. The format is not defined by these conventions. | `2.0.0`; `a01dbef8a` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
8787

8888
**[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`.
8989
<!-- endsemconv -->
@@ -99,8 +99,8 @@ as specified in the [Resource SDK specification](https://github.com/open-telemet
9999
<!-- semconv service_experimental -->
100100
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
101101
|---|---|---|---|---|---|
102-
| `service.instance.id` | string | The string ID of the service instance. [1] | `627cc493-f310-47de-96bd-71410b7dec09` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
103-
| `service.namespace` | string | A namespace for `service.name`. [2] | `Shop` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
102+
| [`service.instance.id`](../attributes-registry/service.md) | string | The string ID of the service instance. [1] | `627cc493-f310-47de-96bd-71410b7dec09` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
103+
| [`service.namespace`](../attributes-registry/service.md) | string | A namespace for `service.name`. [2] | `Shop` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
104104

105105
**[1]:** MUST be unique for each instance of the same `service.namespace,service.name` pair (in other words
106106
`service.namespace,service.name,service.instance.id` triplet MUST be globally unique). The ID helps to

model/registry/service.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
groups:
2+
- id: registry.service
3+
prefix: service
4+
type: attribute_group
5+
brief: >
6+
A service instance.
7+
attributes:
8+
- id: name
9+
type: string
10+
brief: >
11+
Logical name of the service.
12+
note: >
13+
MUST be the same for all instances of horizontally scaled services.
14+
If the value was not specified, SDKs MUST fallback to `unknown_service:` concatenated
15+
with [`process.executable.name`](process.md#process), e.g. `unknown_service:bash`.
16+
If `process.executable.name` is not available, the value MUST be set to `unknown_service`.
17+
examples: ["shoppingcart"]
18+
stability: stable
19+
- id: version
20+
type: string
21+
brief: >
22+
The version string of the service API or implementation. The format is not defined by these conventions.
23+
examples: ["2.0.0", "a01dbef8a"]
24+
stability: stable
25+
- id: namespace
26+
type: string
27+
stability: experimental
28+
brief: >
29+
A namespace for `service.name`.
30+
note: >
31+
A string value having a meaning that helps to distinguish a group of services,
32+
for example the team name that owns a group of services.
33+
`service.name` is expected to be unique within the same namespace.
34+
If `service.namespace` is not specified in the Resource then `service.name`
35+
is expected to be unique for all services that have no explicit namespace defined
36+
(so the empty/unspecified namespace is simply one more valid namespace).
37+
Zero-length namespace string is assumed equal to unspecified namespace.
38+
examples: ["Shop"]
39+
- id: instance.id
40+
type: string
41+
stability: experimental
42+
brief: >
43+
The string ID of the service instance.
44+
note: |
45+
MUST be unique for each instance of the same `service.namespace,service.name` pair (in other words
46+
`service.namespace,service.name,service.instance.id` triplet MUST be globally unique). The ID helps to
47+
distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled
48+
service).
49+
50+
Implementations, such as SDKs, are recommended to generate a random Version 1 or Version 4 [RFC
51+
4122](https://www.ietf.org/rfc/rfc4122.txt) UUID, but are free to use an inherent unique ID as the source of
52+
this value if stability is desirable. In that case, the ID SHOULD be used as source of a UUID Version 5 and
53+
SHOULD use the following UUID as the namespace: `4d63009a-8d0f-11ee-aad7-4c796ed8e320`.
54+
55+
UUIDs are typically recommended, as only an opaque value for the purposes of identifying a service instance is
56+
needed. Similar to what can be seen in the man page for the
57+
[`/etc/machine-id`](https://www.freedesktop.org/software/systemd/man/machine-id.html) file, the underlying
58+
data, such as pod name and namespace should be treated as confidential, being the user's choice to expose it
59+
or not via another resource attribute.
60+
61+
For applications running behind an application server (like unicorn), we do not recommend using one identifier
62+
for all processes participating in the application. Instead, it's recommended each division (e.g. a worker
63+
thread in unicorn) to have its own instance.id.
64+
65+
It's not recommended for a Collector to set `service.instance.id` if it can't unambiguously determine the
66+
service instance that is generating that telemetry. For instance, creating an UUID based on `pod.name` will
67+
likely be wrong, as the Collector might not know from which container within that pod the telemetry originated.
68+
However, Collectors can set the `service.instance.id` if they can unambiguously determine the service instance
69+
for that telemetry. This is typically the case for scraping receivers, as they know the target address and
70+
port.
71+
examples: ["627cc493-f310-47de-96bd-71410b7dec09"]

model/resource/service.yaml

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,6 @@ groups:
55
brief: >
66
A service instance.
77
attributes:
8-
- id: name
9-
type: string
10-
stability: stable
8+
- ref: service.name
119
requirement_level: required
12-
brief: >
13-
Logical name of the service.
14-
note: >
15-
MUST be the same for all instances of horizontally scaled services.
16-
If the value was not specified, SDKs MUST fallback to `unknown_service:` concatenated
17-
with [`process.executable.name`](process.md#process), e.g. `unknown_service:bash`.
18-
If `process.executable.name` is not available, the value MUST be set to `unknown_service`.
19-
examples: ["shoppingcart"]
20-
- id: version
21-
type: string
22-
stability: stable
23-
brief: >
24-
The version string of the service API or implementation. The format is not defined by these conventions.
25-
examples: ["2.0.0", "a01dbef8a"]
10+
- ref: service.version

model/resource/service_experimental.yaml

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,5 @@ groups:
55
brief: >
66
A service instance.
77
attributes:
8-
- id: namespace
9-
type: string
10-
stability: experimental
11-
brief: >
12-
A namespace for `service.name`.
13-
note: >
14-
A string value having a meaning that helps to distinguish a group of services,
15-
for example the team name that owns a group of services.
16-
`service.name` is expected to be unique within the same namespace.
17-
If `service.namespace` is not specified in the Resource then `service.name`
18-
is expected to be unique for all services that have no explicit namespace defined
19-
(so the empty/unspecified namespace is simply one more valid namespace).
20-
Zero-length namespace string is assumed equal to unspecified namespace.
21-
examples: ["Shop"]
22-
- id: instance.id
23-
type: string
24-
stability: experimental
25-
brief: >
26-
The string ID of the service instance.
27-
note: |
28-
MUST be unique for each instance of the same `service.namespace,service.name` pair (in other words
29-
`service.namespace,service.name,service.instance.id` triplet MUST be globally unique). The ID helps to
30-
distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled
31-
service).
32-
33-
Implementations, such as SDKs, are recommended to generate a random Version 1 or Version 4 [RFC
34-
4122](https://www.ietf.org/rfc/rfc4122.txt) UUID, but are free to use an inherent unique ID as the source of
35-
this value if stability is desirable. In that case, the ID SHOULD be used as source of a UUID Version 5 and
36-
SHOULD use the following UUID as the namespace: `4d63009a-8d0f-11ee-aad7-4c796ed8e320`.
37-
38-
UUIDs are typically recommended, as only an opaque value for the purposes of identifying a service instance is
39-
needed. Similar to what can be seen in the man page for the
40-
[`/etc/machine-id`](https://www.freedesktop.org/software/systemd/man/machine-id.html) file, the underlying
41-
data, such as pod name and namespace should be treated as confidential, being the user's choice to expose it
42-
or not via another resource attribute.
43-
44-
For applications running behind an application server (like unicorn), we do not recommend using one identifier
45-
for all processes participating in the application. Instead, it's recommended each division (e.g. a worker
46-
thread in unicorn) to have its own instance.id.
47-
48-
It's not recommended for a Collector to set `service.instance.id` if it can't unambiguously determine the
49-
service instance that is generating that telemetry. For instance, creating an UUID based on `pod.name` will
50-
likely be wrong, as the Collector might not know from which container within that pod the telemetry originated.
51-
However, Collectors can set the `service.instance.id` if they can unambiguously determine the service instance
52-
for that telemetry. This is typically the case for scraping receivers, as they know the target address and
53-
port.
54-
examples: ["627cc493-f310-47de-96bd-71410b7dec09"]
8+
- ref: service.namespace
9+
- ref: service.instance.id

0 commit comments

Comments
 (0)