Skip to content

Commit 9eaa73a

Browse files
crossoverJieLiudmila Molkova
andauthored
Update to semantic-conventions 1.26.0 (#73)
* Update to semantic-conventions 1.26.0 * Manually remove conflicting fields * Manually remove conflicting fields * Update to semantic-conventions 1.26.0 * Update to semantic-conventions 1.26.0 * ./gradlew generateSemanticConventions spotlessApply * drop messaging.client_id --------- Co-authored-by: Liudmila Molkova <[email protected]>
1 parent 756a10d commit 9eaa73a

25 files changed

+514
-123
lines changed

build.gradle.kts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ val snapshot = true
1111
// end
1212

1313
// The release version of https://github.com/open-telemetry/semantic-conventions used to generate classes
14-
var semanticConventionsVersion = "1.25.0"
14+
var semanticConventionsVersion = "1.26.0"
1515
val schemaUrlVersions = listOf(
1616
semanticConventionsVersion,
17+
"1.25.0",
1718
"1.24.0",
1819
"1.23.1",
1920
"1.22.0")
@@ -95,13 +96,14 @@ fun generateTask(taskName: String, incubating: Boolean) {
9596
"-v", "$projectDir/$outputDir:/output",
9697
"otel/semconvgen:$generatorVersion",
9798
"--yaml-root", "/source",
98-
"--continue-on-validation-errors", "compatibility",
99+
"--continue-on-validation-errors",
99100
"code",
100101
"--template", "/templates/SemanticAttributes.java.j2",
101102
"--output", "/output/{{pascal_prefix}}${classPrefix}Attributes.java",
102103
"--file-per-group", "root_namespace",
103104
// Space delimited list of root namespaces to excluded (i.e. "foo bar")
104-
"-Dexcluded_namespaces=\"ios aspnetcore signalr\"",
105+
"-Dexcluded_namespaces=ios aspnetcore signalr",
106+
"-Dexcluded_attributes=messaging.client_id",
105107
"-Dfilter=${filter}",
106108
"-DclassPrefix=${classPrefix}",
107109
"-Dpkg=$packageNameArg",

buildscripts/templates/SemanticAttributes.java.j2

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@
3131
{%- macro stable_class_ref(const_name, separator) -%}
3232
{{stablePkg}}.{{ root_namespace | to_camelcase(True) }}Attributes{{separator}}{{const_name}}
3333
{%- endmacro %}
34+
{%- set excluded_attributes_list = excluded_attributes.replace("\"", "").split(' ') %}
3435
{%- if filter != 'any' %}
35-
{%- set filtered_attributes = attributes_and_templates | select(filter) | list %}
36+
{%- set filtered_attributes = attributes_and_templates | rejectattr("fqn", "in", excluded_attributes) | select(filter) | list %}
3637
{%- else %}
37-
{%- set filtered_attributes = attributes_and_templates | list %}
38+
{%- set filtered_attributes = attributes_and_templates | rejectattr("fqn", "in", excluded_attributes) | list %}
3839
{%- endif %}
3940
{%- set filtered_enums = filtered_attributes | selectattr('is_enum', 'equalto', true) | list %}
4041
{%- set excluded_namespaces_list = excluded_namespaces.replace("\"", "").split(' ') %}

semconv-incubating/src/main/java/io/opentelemetry/semconv/incubating/AndroidIncubatingAttributes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public final class AndroidIncubatingAttributes {
2222
public static final AttributeKey<String> ANDROID_OS_API_LEVEL = stringKey("android.os.api_level");
2323

2424
/**
25-
* This attribute represents the state the application has transitioned into at the occurrence of
26-
* the event.
25+
* Deprecated use the {@code device.app.lifecycle} event definition including {@code
26+
* android.state} as a payload field instead.
2727
*
2828
* <p>Notes:
2929
*

semconv-incubating/src/main/java/io/opentelemetry/semconv/incubating/ContainerIncubatingAttributes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public final class ContainerIncubatingAttributes {
6262
* endpoint. K8s defines a link to the container registry repository with digest {@code
6363
* "imageID": "registry.azurecr.io
6464
* /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"}.
65-
* The ID is assinged by the container runtime and can vary in different environments.
65+
* The ID is assigned by the container runtime and can vary in different environments.
6666
* Consider using {@code oci.manifest.digest} if it is important to identify the same image
6767
* in different environments/runtimes.
6868
* </ul>

semconv-incubating/src/main/java/io/opentelemetry/semconv/incubating/DbIncubatingAttributes.java

Lines changed: 132 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,39 @@ public final class DbIncubatingAttributes {
4949
longKey("db.cassandra.speculative_execution_count");
5050

5151
/**
52-
* The name of the primary Cassandra table that the operation is acting upon, including the
53-
* keyspace name (if applicable).
52+
* Deprecated, use {@code db.collection.name} instead.
53+
*
54+
* @deprecated Deprecated, use `db.collection.name` instead.
55+
*/
56+
@Deprecated
57+
public static final AttributeKey<String> DB_CASSANDRA_TABLE = stringKey("db.cassandra.table");
58+
59+
/**
60+
* The name of the connection pool; unique within the instrumented application. In case the
61+
* connection pool implementation doesn't provide a name, instrumentation should use a combination
62+
* of {@code server.address} and {@code server.port} attributes formatted as {@code
63+
* server.address:server.port}.
64+
*/
65+
public static final AttributeKey<String> DB_CLIENT_CONNECTIONS_POOL_NAME =
66+
stringKey("db.client.connections.pool.name");
67+
68+
/** The state of a connection in the pool */
69+
public static final AttributeKey<String> DB_CLIENT_CONNECTIONS_STATE =
70+
stringKey("db.client.connections.state");
71+
72+
/**
73+
* The name of a collection (table, container) within the database.
5474
*
5575
* <p>Notes:
5676
*
5777
* <ul>
58-
* <li>This mirrors the db.sql.table attribute but references cassandra rather than sql. It is
59-
* not recommended to attempt any client-side parsing of {@code db.statement} just to get
60-
* this property, but it should be set if it is provided by the library being instrumented.
61-
* If the operation is acting upon an anonymous table, or more than one table, this value
62-
* MUST NOT be set.
78+
* <li>If the collection name is parsed from the query, it SHOULD match the value provided in
79+
* the query and may be qualified with the schema and database name. It is RECOMMENDED to
80+
* capture the value as provided by the application without attempting to do any case
81+
* normalization.
6382
* </ul>
6483
*/
65-
public static final AttributeKey<String> DB_CASSANDRA_TABLE = stringKey("db.cassandra.table");
84+
public static final AttributeKey<String> DB_COLLECTION_NAME = stringKey("db.collection.name");
6685

6786
/**
6887
* Deprecated, use {@code server.address}, {@code server.port} attributes instead.
@@ -80,7 +99,12 @@ public final class DbIncubatingAttributes {
8099
public static final AttributeKey<String> DB_COSMOSDB_CONNECTION_MODE =
81100
stringKey("db.cosmosdb.connection_mode");
82101

83-
/** Cosmos DB container name. */
102+
/**
103+
* Deprecated, use {@code db.collection.name} instead.
104+
*
105+
* @deprecated Deprecated, use `db.collection.name` instead.
106+
*/
107+
@Deprecated
84108
public static final AttributeKey<String> DB_COSMOSDB_CONTAINER =
85109
stringKey("db.cosmosdb.container");
86110

@@ -109,11 +133,8 @@ public final class DbIncubatingAttributes {
109133
stringKey("db.elasticsearch.cluster.name");
110134

111135
/**
112-
* Deprecated, use {@code db.instance.id} instead.
113-
*
114-
* @deprecated Deprecated, use `db.instance.id` instead.
136+
* Represents the human-readable identifier of the node/instance to which a request was routed.
115137
*/
116-
@Deprecated
117138
public static final AttributeKey<String> DB_ELASTICSEARCH_NODE_NAME =
118139
stringKey("db.elasticsearch.node.name");
119140

@@ -134,13 +155,13 @@ public final class DbIncubatingAttributes {
134155
stringKeyTemplate("db.elasticsearch.path_parts");
135156

136157
/**
137-
* An identifier (address, unique name, or any other identifier) of the database instance that is
138-
* executing queries or mutations on the current connection. This is useful in cases where the
139-
* database is running in a clustered environment and the instrumentation is able to record the
140-
* node executing the query. The client may obtain this value in databases like MySQL using
141-
* queries like {@code select @@hostname}.
158+
* Deprecated, no general replacement at this time. For Elasticsearch, use {@code
159+
* db.elasticsearch.node.name} instead.
160+
*
161+
* @deprecated Deprecated, no general replacement at this time. For Elasticsearch, use
162+
* `db.elasticsearch.node.name` instead.
142163
*/
143-
public static final AttributeKey<String> DB_INSTANCE_ID = stringKey("db.instance.id");
164+
@Deprecated public static final AttributeKey<String> DB_INSTANCE_ID = stringKey("db.instance.id");
144165

145166
/**
146167
* Removed, no replacement at this time.
@@ -151,90 +172,129 @@ public final class DbIncubatingAttributes {
151172
public static final AttributeKey<String> DB_JDBC_DRIVER_CLASSNAME =
152173
stringKey("db.jdbc.driver_classname");
153174

154-
/** The MongoDB collection being accessed within the database stated in {@code db.name}. */
175+
/**
176+
* Deprecated, use {@code db.collection.name} instead.
177+
*
178+
* @deprecated Deprecated, use `db.collection.name` instead.
179+
*/
180+
@Deprecated
155181
public static final AttributeKey<String> DB_MONGODB_COLLECTION =
156182
stringKey("db.mongodb.collection");
157183

158184
/**
159-
* The Microsoft SQL Server <a
160-
* href="https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15">instance
161-
* name</a> connecting to. This name is used to determine the port of a named instance.
185+
* Deprecated, SQL Server instance is now populated as a part of {@code db.namespace} attribute.
186+
*
187+
* @deprecated Deprecated, SQL Server instance is now populated as a part of `db.namespace`
188+
* attribute.
189+
*/
190+
@Deprecated
191+
public static final AttributeKey<String> DB_MSSQL_INSTANCE_NAME =
192+
stringKey("db.mssql.instance_name");
193+
194+
/**
195+
* Deprecated, use {@code db.namespace} instead.
196+
*
197+
* @deprecated Deprecated, use `db.namespace` instead.
198+
*/
199+
@Deprecated public static final AttributeKey<String> DB_NAME = stringKey("db.name");
200+
201+
/**
202+
* The name of the database, fully qualified within the server address and port.
162203
*
163204
* <p>Notes:
164205
*
165206
* <ul>
166-
* <li>If setting a {@code db.mssql.instance_name}, {@code server.port} is no longer required
167-
* (but still recommended if non-standard).
207+
* <li>If a database system has multiple namespace components, they SHOULD be concatenated
208+
* (potentially using database system specific conventions) from most general to most
209+
* specific namespace component, and more specific namespaces SHOULD NOT be captured without
210+
* the more general namespaces, to ensure that &quot;startswith&quot; queries for the more
211+
* general namespaces will be valid. Semantic conventions for individual database systems
212+
* SHOULD document what {@code db.namespace} means in the context of that system. It is
213+
* RECOMMENDED to capture the value as provided by the application without attempting to do
214+
* any case normalization.
168215
* </ul>
169216
*/
170-
public static final AttributeKey<String> DB_MSSQL_INSTANCE_NAME =
171-
stringKey("db.mssql.instance_name");
217+
public static final AttributeKey<String> DB_NAMESPACE = stringKey("db.namespace");
172218

173219
/**
174-
* This attribute is used to report the name of the database being accessed. For commands that
175-
* switch the database, this should be set to the target database (even if the command fails).
220+
* Deprecated, use {@code db.operation.name} instead.
221+
*
222+
* @deprecated Deprecated, use `db.operation.name` instead.
223+
*/
224+
@Deprecated public static final AttributeKey<String> DB_OPERATION = stringKey("db.operation");
225+
226+
/**
227+
* The name of the operation or command being executed.
176228
*
177229
* <p>Notes:
178230
*
179231
* <ul>
180-
* <li>In some SQL databases, the database name to be used is called &quot;schema name&quot;. In
181-
* case there are multiple layers that could be considered for database name (e.g. Oracle
182-
* instance name and schema name), the database name to be used is the more specific layer
183-
* (e.g. Oracle schema name).
232+
* <li>It is RECOMMENDED to capture the value as provided by the application without attempting
233+
* to do any case normalization.
184234
* </ul>
185235
*/
186-
public static final AttributeKey<String> DB_NAME = stringKey("db.name");
236+
public static final AttributeKey<String> DB_OPERATION_NAME = stringKey("db.operation.name");
187237

188238
/**
189-
* The name of the operation being executed, e.g. the <a
190-
* href="https://docs.mongodb.com/manual/reference/command/#database-operations">MongoDB command
191-
* name</a> such as {@code findAndModify}, or the SQL keyword.
239+
* The query parameters used in {@code db.query.text}, with {@code <key>} being the parameter
240+
* name, and the attribute value being the parameter value.
192241
*
193242
* <p>Notes:
194243
*
195244
* <ul>
196-
* <li>When setting this to an SQL keyword, it is not recommended to attempt any client-side
197-
* parsing of {@code db.statement} just to get this property, but it should be set if the
198-
* operation name is provided by the library being instrumented. If the SQL statement has an
199-
* ambiguous operation, or performs more than one operation, this value may be omitted.
245+
* <li>Query parameters should only be captured when {@code db.query.text} is parameterized with
246+
* placeholders. If a parameter has no name and instead is referenced only by index, then
247+
* {@code <key>} SHOULD be the 0-based index.
200248
* </ul>
201249
*/
202-
public static final AttributeKey<String> DB_OPERATION = stringKey("db.operation");
250+
public static final AttributeKeyTemplate<String> DB_QUERY_PARAMETER =
251+
stringKeyTemplate("db.query.parameter");
252+
253+
/** The database query being executed. */
254+
public static final AttributeKey<String> DB_QUERY_TEXT = stringKey("db.query.text");
203255

204256
/**
205-
* The index of the database being accessed as used in the <a
206-
* href="https://redis.io/commands/select">{@code SELECT} command</a>, provided as an integer. To
207-
* be used instead of the generic {@code db.name} attribute.
257+
* Deprecated, use {@code db.namespace} instead.
258+
*
259+
* @deprecated Deprecated, use `db.namespace` instead.
208260
*/
261+
@Deprecated
209262
public static final AttributeKey<Long> DB_REDIS_DATABASE_INDEX =
210263
longKey("db.redis.database_index");
211264

212265
/**
213-
* The name of the primary table that the operation is acting upon, including the database name
214-
* (if applicable).
266+
* Deprecated, use {@code db.collection.name} instead.
267+
*
268+
* @deprecated Deprecated, use `db.collection.name` instead.
269+
*/
270+
@Deprecated public static final AttributeKey<String> DB_SQL_TABLE = stringKey("db.sql.table");
271+
272+
/**
273+
* The database statement being executed.
274+
*
275+
* @deprecated The database statement being executed.
276+
*/
277+
@Deprecated public static final AttributeKey<String> DB_STATEMENT = stringKey("db.statement");
278+
279+
/**
280+
* The database management system (DBMS) product as identified by the client instrumentation.
215281
*
216282
* <p>Notes:
217283
*
218284
* <ul>
219-
* <li>It is not recommended to attempt any client-side parsing of {@code db.statement} just to
220-
* get this property, but it should be set if it is provided by the library being
221-
* instrumented. If the operation is acting upon an anonymous table, or more than one table,
222-
* this value MUST NOT be set.
285+
* <li>The actual DBMS may differ from the one identified by the client. For example, when using
286+
* PostgreSQL client libraries to connect to a CockroachDB, the {@code db.system} is set to
287+
* {@code postgresql} based on the instrumentation's best knowledge.
223288
* </ul>
224289
*/
225-
public static final AttributeKey<String> DB_SQL_TABLE = stringKey("db.sql.table");
226-
227-
/** The database statement being executed. */
228-
public static final AttributeKey<String> DB_STATEMENT = stringKey("db.statement");
290+
public static final AttributeKey<String> DB_SYSTEM = stringKey("db.system");
229291

230292
/**
231-
* An identifier for the database management system (DBMS) product being used. See below for a
232-
* list of well-known identifiers.
293+
* Deprecated, no replacement at this time.
294+
*
295+
* @deprecated Deprecated, no replacement at this time.
233296
*/
234-
public static final AttributeKey<String> DB_SYSTEM = stringKey("db.system");
235-
236-
/** Username for accessing the database. */
237-
public static final AttributeKey<String> DB_USER = stringKey("db.user");
297+
@Deprecated public static final AttributeKey<String> DB_USER = stringKey("db.user");
238298

239299
// Enum definitions
240300
/** Values for {@link #DB_CASSANDRA_CONSISTENCY_LEVEL}. */
@@ -275,6 +335,17 @@ public static final class DbCassandraConsistencyLevelValues {
275335
private DbCassandraConsistencyLevelValues() {}
276336
}
277337

338+
/** Values for {@link #DB_CLIENT_CONNECTIONS_STATE}. */
339+
public static final class DbClientConnectionsStateValues {
340+
/** idle. */
341+
public static final String IDLE = "idle";
342+
343+
/** used. */
344+
public static final String USED = "used";
345+
346+
private DbClientConnectionsStateValues() {}
347+
}
348+
278349
/** Values for {@link #DB_COSMOSDB_CONNECTION_MODE}. */
279350
public static final class DbCosmosdbConnectionModeValues {
280351
/** Gateway (HTTP) connections mode. */

semconv-incubating/src/main/java/io/opentelemetry/semconv/incubating/ErrorIncubatingAttributes.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ public final class ErrorIncubatingAttributes {
2020
* <p>Notes:
2121
*
2222
* <ul>
23-
* <li>The {@code error.type} SHOULD be predictable and SHOULD have low cardinality.
24-
* Instrumentations SHOULD document the list of errors they report.
23+
* <li>The {@code error.type} SHOULD be predictable, and SHOULD have low cardinality.
24+
* <li>When {@code error.type} is set to a type (e.g., an exception type), its canonical class
25+
* name identifying the type within the artifact SHOULD be used.
26+
* <li>Instrumentations SHOULD document the list of errors they report.
2527
* <li>The cardinality of {@code error.type} within one instrumentation library SHOULD be low.
2628
* Telemetry consumers that aggregate data from multiple instrumentation libraries and
2729
* applications should be prepared for {@code error.type} to have high cardinality at query

semconv-incubating/src/main/java/io/opentelemetry/semconv/incubating/EventIncubatingAttributes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public final class EventIncubatingAttributes {
2121
*
2222
* <ul>
2323
* <li>Event names are subject to the same rules as <a
24-
* href="https://github.com/open-telemetry/opentelemetry-specification/tree/v1.31.0/specification/common/attribute-naming.md">attribute
24+
* href="https://github.com/open-telemetry/opentelemetry-specification/tree/v1.33.0/specification/common/attribute-naming.md">attribute
2525
* names</a>. Notably, event names are namespaced to avoid collisions and provide a clean
2626
* separation of semantics for events in separate domains like browser, mobile, and
2727
* kubernetes.

semconv-incubating/src/main/java/io/opentelemetry/semconv/incubating/ExceptionIncubatingAttributes.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ public final class ExceptionIncubatingAttributes {
3030
* <li>It is usually not possible to determine at the point where an exception is thrown whether
3131
* it will escape the scope of a span. However, it is trivial to know that an exception will
3232
* escape, if one checks for an active exception just before ending the span, as done in the
33-
* <a href="#recording-an-exception">example for recording span exceptions</a>.
33+
* <a
34+
* href="https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception">example
35+
* for recording span exceptions</a>.
3436
* <li>It follows that an exception may still escape the scope of the span even if the {@code
3537
* exception.escaped} attribute was not set or set to false, since the event might have been
3638
* recorded at a time where it was not clear whether the exception will escape.

0 commit comments

Comments
 (0)