Skip to content

Commit b139a97

Browse files
authored
Generate semantic conventions 1.31.0 (#4471)
* Generate semantic conventions 1.31.0 We cannot bump weaver because something changed in the format of the notes and requires update in the jinja templates. Added trimming when rendering metrics to fix rendering of multiline brief attributes that broke rendering of hw_metrics. * Add changelog
1 parent 2450943 commit b139a97

27 files changed

+655
-60
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
- semantic-conventions: Bump to 1.31.0
11+
([#4471](https://github.com/open-telemetry/opentelemetry-python/pull/4471))
1012
- Add type annotations to context's attach & detach
1113
([#4346](https://github.com/open-telemetry/opentelemetry-python/pull/4346))
1214
- Fix OTLP encoders missing instrumentation scope schema url and attributes

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cicd_attributes.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
The pipeline run goes through these states during its lifecycle.
3636
"""
3737

38+
CICD_PIPELINE_RUN_URL_FULL: Final = "cicd.pipeline.run.url.full"
39+
"""
40+
The [URL](https://wikipedia.org/wiki/URL) of the pipeline run, providing the complete address in order to locate and identify the pipeline run.
41+
"""
42+
3843
CICD_PIPELINE_TASK_NAME: Final = "cicd.pipeline.task.name"
3944
"""
4045
The human readable name of a task within a pipeline. Task here most closely aligns with a [computing process](https://wikipedia.org/wiki/Pipeline_(computing)) in a pipeline. Other terms for tasks include commands, steps, and procedures.
@@ -47,7 +52,7 @@
4752

4853
CICD_PIPELINE_TASK_RUN_URL_FULL: Final = "cicd.pipeline.task.run.url.full"
4954
"""
50-
The [URL](https://wikipedia.org/wiki/URL) of the pipeline run providing the complete address in order to locate and identify the pipeline run.
55+
The [URL](https://wikipedia.org/wiki/URL) of the pipeline task run, providing the complete address in order to locate and identify the pipeline task run.
5156
"""
5257

5358
CICD_PIPELINE_TASK_TYPE: Final = "cicd.pipeline.task.type"

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloud_attributes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
CLOUD_RESOURCE_ID: Final = "cloud.resource_id"
4747
"""
48-
Cloud provider-specific native identifier of the monitored cloud resource (e.g. an [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) on AWS, a [fully qualified resource ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) on Azure, a [full resource name](https://cloud.google.com/apis/design/resource_names#full_resource_name) on GCP).
48+
Cloud provider-specific native identifier of the monitored cloud resource (e.g. an [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) on AWS, a [fully qualified resource ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) on Azure, a [full resource name](https://google.aip.dev/122#full-resource-names) on GCP).
4949
Note: On some cloud providers, it may not be possible to determine the full ID at startup,
5050
so it may be necessary to set `cloud.resource_id` as a span attribute instead.
5151

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/code_attributes.py

+19-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
CODE_FILEPATH: Final = "code.filepath"
3333
"""
34-
Deprecated, use `code.file.path` instead.
34+
Deprecated: Replaced by `code.file.path`.
3535
"""
3636

3737
CODE_FUNCTION: Final = "code.function"
@@ -41,7 +41,22 @@
4141

4242
CODE_FUNCTION_NAME: Final = "code.function.name"
4343
"""
44-
The method or function name, or equivalent (usually rightmost part of the code unit's name).
44+
The method or function fully-qualified name without arguments. The value should fit the natural representation of the language runtime, which is also likely the same used within `code.stacktrace` attribute value.
45+
Note: Values and format depends on each language runtime, thus it is impossible to provide an exhaustive list of examples.
46+
The values are usually the same (or prefixes of) the ones found in native stack trace representation stored in
47+
`code.stacktrace` without information on arguments.
48+
49+
Examples:
50+
51+
* Java method: `com.example.MyHttpService.serveRequest`
52+
* Java anonymous class method: `com.mycompany.Main$1.myMethod`
53+
* Java lambda method: `com.mycompany.Main$$Lambda/0x0000748ae4149c00.myMethod`
54+
* PHP function: `GuzzleHttp\\Client::transfer
55+
* Go function: `github.com/my/repo/pkg.foo.func5`
56+
* Elixir: `OpenTelemetry.Ctx.new`
57+
* Erlang: `opentelemetry_ctx:new`
58+
* Rust: `playground::my_module::my_cool_func`
59+
* C function: `fopen`.
4560
"""
4661

4762
CODE_LINE_NUMBER: Final = "code.line.number"
@@ -56,10 +71,10 @@
5671

5772
CODE_NAMESPACE: Final = "code.namespace"
5873
"""
59-
The "namespace" within which `code.function.name` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function.name` form a unique identifier for the code unit.
74+
Deprecated: Value should be included in `code.function.name` which is expected to be a fully-qualified name.
6075
"""
6176

6277
CODE_STACKTRACE: Final = "code.stacktrace"
6378
"""
64-
A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG.
79+
A stacktrace as a string in the natural representation for the language runtime. The representation is identical to [`exception.stacktrace`](/docs/exceptions/exceptions-spans.md#stacktrace-representation).
6580
"""

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cpu_attributes.py

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
from enum import Enum
1616
from typing import Final
1717

18+
CPU_LOGICAL_NUMBER: Final = "cpu.logical_number"
19+
"""
20+
The logical CPU number [0..n-1].
21+
"""
22+
1823
CPU_MODE: Final = "cpu.mode"
1924
"""
2025
The mode of the CPU.

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,14 @@
7777
DB_COLLECTION_NAME: Final = "db.collection.name"
7878
"""
7979
The name of a collection (table, container) within the database.
80-
Note: It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
80+
Note: It is RECOMMENDED to capture the value as provided by the application
81+
without attempting to do any case normalization.
8182
8283
The collection name SHOULD NOT be extracted from `db.query.text`,
83-
unless the query format is known to only ever have a single collection name present.
84+
when the database system supports cross-table queries in non-batch operations.
8485
85-
For batch operations, if the individual operations are known to have the same collection name
86-
then that collection name SHOULD be used.
86+
For batch operations, if the individual operations are known to have the same
87+
collection name then that collection name SHOULD be used.
8788
"""
8889

8990
DB_CONNECTION_STRING: Final = "db.connection_string"
@@ -209,7 +210,7 @@
209210
without attempting to do any case normalization.
210211
211212
The operation name SHOULD NOT be extracted from `db.query.text`,
212-
unless the query format is known to only ever have a single operation name present.
213+
when the database system supports cross-table queries in non-batch operations.
213214
214215
For batch operations, if the individual operations are known to have the same operation name
215216
then that operation name SHOULD be used prepended by `BATCH `,
@@ -233,13 +234,13 @@
233234
"""
234235
Low cardinality representation of a database query text.
235236
Note: `db.query.summary` provides static summary of the query text. It describes a class of database queries and is useful as a grouping key, especially when analyzing telemetry for database calls involving complex queries.
236-
Summary may be available to the instrumentation through instrumentation hooks or other means. If it is not available, instrumentations that support query parsing SHOULD generate a summary following [Generating query summary](../../docs/database/database-spans.md#generating-a-summary-of-the-query-text) section.
237+
Summary may be available to the instrumentation through instrumentation hooks or other means. If it is not available, instrumentations that support query parsing SHOULD generate a summary following [Generating query summary](../database/database-spans.md#generating-a-summary-of-the-query-text) section.
237238
"""
238239

239240
DB_QUERY_TEXT: Final = "db.query.text"
240241
"""
241242
The database query being executed.
242-
Note: For sanitization see [Sanitization of `db.query.text`](../../docs/database/database-spans.md#sanitization-of-dbquerytext).
243+
Note: For sanitization see [Sanitization of `db.query.text`](../database/database-spans.md#sanitization-of-dbquerytext).
243244
For batch operations, if the individual operations are known to have the same query text then that query text SHOULD be used, otherwise all of the individual query texts SHOULD be concatenated with separator `; ` or some other database system specific separator if more applicable.
244245
Even though parameterized query text can potentially have sensitive data, by using a parameterized query the user is giving a strong signal that any sensitive data will be passed as parameter values, and the benefit to observability of capturing the static part of the query text by default outweighs the risk.
245246
"""

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/enduser_attributes.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,20 @@
1616

1717
ENDUSER_ID: Final = "enduser.id"
1818
"""
19-
Deprecated: Replaced by `user.id` attribute.
19+
Unique identifier of an end user in the system. It maybe a username, email address, or other identifier.
20+
Note: Unique identifier of an end user in the system.
21+
22+
> [!Warning]
23+
> This field contains sensitive (PII) information.
24+
"""
25+
26+
ENDUSER_PSEUDO_ID: Final = "enduser.pseudo.id"
27+
"""
28+
Pseudonymous identifier of an end user. This identifier should be a random value that is not directly linked or associated with the end user's actual identity.
29+
Note: Pseudonymous identifier of an end user.
30+
31+
> [!Warning]
32+
> This field contains sensitive (linkable PII) information.
2033
"""
2134

2235
ENDUSER_ROLE: Final = "enduser.role"

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/gen_ai_attributes.py

+71-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@
1515
from enum import Enum
1616
from typing import Final
1717

18+
from deprecated import deprecated
19+
20+
GEN_AI_AGENT_DESCRIPTION: Final = "gen_ai.agent.description"
21+
"""
22+
Free-form description of the GenAI agent provided by the application.
23+
"""
24+
25+
GEN_AI_AGENT_ID: Final = "gen_ai.agent.id"
26+
"""
27+
The unique identifier of the GenAI agent.
28+
"""
29+
30+
GEN_AI_AGENT_NAME: Final = "gen_ai.agent.name"
31+
"""
32+
Human-readable name of the GenAI agent provided by the application.
33+
"""
34+
1835
GEN_AI_COMPLETION: Final = "gen_ai.completion"
1936
"""
2037
Deprecated: Removed, no replacement at this time.
@@ -24,7 +41,7 @@
2441
"gen_ai.openai.request.response_format"
2542
)
2643
"""
27-
The response format that is requested.
44+
Deprecated: Replaced by `gen_ai.output.type`.
2845
"""
2946

3047
GEN_AI_OPENAI_REQUEST_SEED: Final = "gen_ai.openai.request.seed"
@@ -59,11 +76,24 @@
5976
Note: If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
6077
"""
6178

79+
GEN_AI_OUTPUT_TYPE: Final = "gen_ai.output.type"
80+
"""
81+
Represents the content type requested by the client.
82+
Note: This attribute SHOULD be used when the client requests output of a specific type. The model may return zero or more outputs of this type.
83+
This attribute specifies the output modality and not the actual output format. For example, if an image is requested, the actual output could be a URL pointing to an image file.
84+
Additional output format details may be recorded in the future in the `gen_ai.output.{type}.*` attributes.
85+
"""
86+
6287
GEN_AI_PROMPT: Final = "gen_ai.prompt"
6388
"""
6489
Deprecated: Removed, no replacement at this time.
6590
"""
6691

92+
GEN_AI_REQUEST_CHOICE_COUNT: Final = "gen_ai.request.choice.count"
93+
"""
94+
The target number of candidate completions to return.
95+
"""
96+
6797
GEN_AI_REQUEST_ENCODING_FORMATS: Final = "gen_ai.request.encoding_formats"
6898
"""
6999
The encoding formats requested in an embeddings operation, if specified.
@@ -151,6 +181,26 @@
151181
The type of token being counted.
152182
"""
153183

184+
GEN_AI_TOOL_CALL_ID: Final = "gen_ai.tool.call.id"
185+
"""
186+
The tool call identifier.
187+
"""
188+
189+
GEN_AI_TOOL_NAME: Final = "gen_ai.tool.name"
190+
"""
191+
Name of the tool utilized by the agent.
192+
"""
193+
194+
GEN_AI_TOOL_TYPE: Final = "gen_ai.tool.type"
195+
"""
196+
Type of the tool utilized by the agent.
197+
Note: Extension: A tool executed on the agent-side to directly call external APIs, bridging the gap between the agent and real-world systems.
198+
Agent-side operations involve actions that are performed by the agent on the server or within the agent's controlled environment.
199+
Function: A tool executed on the client-side, where the agent generates parameters for a predefined function, and the client executes the logic.
200+
Client-side operations are actions taken on the user's end or within the client application.
201+
Datastore: A tool used by the agent to access and query structured or unstructured external data for retrieval-augmented tasks or knowledge updates.
202+
"""
203+
154204
GEN_AI_USAGE_COMPLETION_TOKENS: Final = "gen_ai.usage.completion_tokens"
155205
"""
156206
Deprecated: Replaced by `gen_ai.usage.output_tokens` attribute.
@@ -172,6 +222,9 @@
172222
"""
173223

174224

225+
@deprecated(
226+
reason="The attribute gen_ai.openai.request.response_format is deprecated - Replaced by `gen_ai.output.type`"
227+
) # type: ignore
175228
class GenAiOpenaiRequestResponseFormatValues(Enum):
176229
TEXT = "text"
177230
"""Text response format."""
@@ -195,6 +248,21 @@ class GenAiOperationNameValues(Enum):
195248
"""Text completions operation such as [OpenAI Completions API (Legacy)](https://platform.openai.com/docs/api-reference/completions)."""
196249
EMBEDDINGS = "embeddings"
197250
"""Embeddings operation such as [OpenAI Create embeddings API](https://platform.openai.com/docs/api-reference/embeddings/create)."""
251+
CREATE_AGENT = "create_agent"
252+
"""Create GenAI agent."""
253+
EXECUTE_TOOL = "execute_tool"
254+
"""Execute a tool."""
255+
256+
257+
class GenAiOutputTypeValues(Enum):
258+
TEXT = "text"
259+
"""Plain text."""
260+
JSON = "json"
261+
"""JSON object with known or unknown schema."""
262+
IMAGE = "image"
263+
"""Image."""
264+
SPEECH = "speech"
265+
"""Speech."""
198266

199267

200268
class GenAiSystemValues(Enum):
@@ -232,4 +300,6 @@ class GenAiTokenTypeValues(Enum):
232300
INPUT = "input"
233301
"""Input tokens (prompt, input, etc.)."""
234302
COMPLETION = "output"
303+
"""Deprecated: Replaced by `output`."""
304+
OUTPUT = "output"
235305
"""Output tokens (completion, response, etc.)."""

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/k8s_attributes.py

+30
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@
9494
The UID of the Deployment.
9595
"""
9696

97+
K8S_HPA_NAME: Final = "k8s.hpa.name"
98+
"""
99+
The name of the horizontal pod autoscaler.
100+
"""
101+
102+
K8S_HPA_UID: Final = "k8s.hpa.uid"
103+
"""
104+
The UID of the horizontal pod autoscaler.
105+
"""
106+
97107
K8S_JOB_NAME: Final = "k8s.job.name"
98108
"""
99109
The name of the Job.
@@ -161,6 +171,26 @@
161171
The UID of the ReplicaSet.
162172
"""
163173

174+
K8S_REPLICATIONCONTROLLER_NAME: Final = "k8s.replicationcontroller.name"
175+
"""
176+
The name of the replication controller.
177+
"""
178+
179+
K8S_REPLICATIONCONTROLLER_UID: Final = "k8s.replicationcontroller.uid"
180+
"""
181+
The UID of the replication controller.
182+
"""
183+
184+
K8S_RESOURCEQUOTA_NAME: Final = "k8s.resourcequota.name"
185+
"""
186+
The name of the resource quota.
187+
"""
188+
189+
K8S_RESOURCEQUOTA_UID: Final = "k8s.resourcequota.uid"
190+
"""
191+
The UID of the resource quota.
192+
"""
193+
164194
K8S_STATEFULSET_NAME: Final = "k8s.statefulset.name"
165195
"""
166196
The name of the StatefulSet.

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/oci_attributes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
"""
1919
The digest of the OCI image manifest. For container images specifically is the digest by which the container image is known.
2020
Note: Follows [OCI Image Manifest Specification](https://github.com/opencontainers/image-spec/blob/main/manifest.md), and specifically the [Digest property](https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests).
21-
An example can be found in [Example Image Manifest](https://docs.docker.com/registry/spec/manifest-v2-2/#example-image-manifest).
21+
An example can be found in [Example Image Manifest](https://github.com/opencontainers/image-spec/blob/main/manifest.md#example-image-manifest).
2222
"""

0 commit comments

Comments
 (0)