Skip to content

Commit

Permalink
Update to semantic-conventions 1.26.0 (#73)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
crossoverJie and lmolkova authored Jul 1, 2024
1 parent 756a10d commit 9eaa73a
Show file tree
Hide file tree
Showing 25 changed files with 514 additions and 123 deletions.
8 changes: 5 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ val snapshot = true
// end

// The release version of https://github.com/open-telemetry/semantic-conventions used to generate classes
var semanticConventionsVersion = "1.25.0"
var semanticConventionsVersion = "1.26.0"
val schemaUrlVersions = listOf(
semanticConventionsVersion,
"1.25.0",
"1.24.0",
"1.23.1",
"1.22.0")
Expand Down Expand Up @@ -95,13 +96,14 @@ fun generateTask(taskName: String, incubating: Boolean) {
"-v", "$projectDir/$outputDir:/output",
"otel/semconvgen:$generatorVersion",
"--yaml-root", "/source",
"--continue-on-validation-errors", "compatibility",
"--continue-on-validation-errors",
"code",
"--template", "/templates/SemanticAttributes.java.j2",
"--output", "/output/{{pascal_prefix}}${classPrefix}Attributes.java",
"--file-per-group", "root_namespace",
// Space delimited list of root namespaces to excluded (i.e. "foo bar")
"-Dexcluded_namespaces=\"ios aspnetcore signalr\"",
"-Dexcluded_namespaces=ios aspnetcore signalr",
"-Dexcluded_attributes=messaging.client_id",
"-Dfilter=${filter}",
"-DclassPrefix=${classPrefix}",
"-Dpkg=$packageNameArg",
Expand Down
5 changes: 3 additions & 2 deletions buildscripts/templates/SemanticAttributes.java.j2
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
{%- macro stable_class_ref(const_name, separator) -%}
{{stablePkg}}.{{ root_namespace | to_camelcase(True) }}Attributes{{separator}}{{const_name}}
{%- endmacro %}
{%- set excluded_attributes_list = excluded_attributes.replace("\"", "").split(' ') %}
{%- if filter != 'any' %}
{%- set filtered_attributes = attributes_and_templates | select(filter) | list %}
{%- set filtered_attributes = attributes_and_templates | rejectattr("fqn", "in", excluded_attributes) | select(filter) | list %}
{%- else %}
{%- set filtered_attributes = attributes_and_templates | list %}
{%- set filtered_attributes = attributes_and_templates | rejectattr("fqn", "in", excluded_attributes) | list %}
{%- endif %}
{%- set filtered_enums = filtered_attributes | selectattr('is_enum', 'equalto', true) | list %}
{%- set excluded_namespaces_list = excluded_namespaces.replace("\"", "").split(' ') %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public final class AndroidIncubatingAttributes {
public static final AttributeKey<String> ANDROID_OS_API_LEVEL = stringKey("android.os.api_level");

/**
* This attribute represents the state the application has transitioned into at the occurrence of
* the event.
* Deprecated use the {@code device.app.lifecycle} event definition including {@code
* android.state} as a payload field instead.
*
* <p>Notes:
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public final class ContainerIncubatingAttributes {
* endpoint. K8s defines a link to the container registry repository with digest {@code
* "imageID": "registry.azurecr.io
* /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"}.
* The ID is assinged by the container runtime and can vary in different environments.
* The ID is assigned by the container runtime and can vary in different environments.
* Consider using {@code oci.manifest.digest} if it is important to identify the same image
* in different environments/runtimes.
* </ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,39 @@ public final class DbIncubatingAttributes {
longKey("db.cassandra.speculative_execution_count");

/**
* The name of the primary Cassandra table that the operation is acting upon, including the
* keyspace name (if applicable).
* Deprecated, use {@code db.collection.name} instead.
*
* @deprecated Deprecated, use `db.collection.name` instead.
*/
@Deprecated
public static final AttributeKey<String> DB_CASSANDRA_TABLE = stringKey("db.cassandra.table");

/**
* The name of the connection pool; unique within the instrumented application. In case the
* connection pool implementation doesn't provide a name, instrumentation should use a combination
* of {@code server.address} and {@code server.port} attributes formatted as {@code
* server.address:server.port}.
*/
public static final AttributeKey<String> DB_CLIENT_CONNECTIONS_POOL_NAME =
stringKey("db.client.connections.pool.name");

/** The state of a connection in the pool */
public static final AttributeKey<String> DB_CLIENT_CONNECTIONS_STATE =
stringKey("db.client.connections.state");

/**
* The name of a collection (table, container) within the database.
*
* <p>Notes:
*
* <ul>
* <li>This mirrors the db.sql.table attribute but references cassandra rather than sql. It is
* not recommended to attempt any client-side parsing of {@code db.statement} just to get
* this property, but it should be set if it is provided by the library being instrumented.
* If the operation is acting upon an anonymous table, or more than one table, this value
* MUST NOT be set.
* <li>If the collection name is parsed from the query, it SHOULD match the value provided in
* the query and may be qualified with the schema and database name. It is RECOMMENDED to
* capture the value as provided by the application without attempting to do any case
* normalization.
* </ul>
*/
public static final AttributeKey<String> DB_CASSANDRA_TABLE = stringKey("db.cassandra.table");
public static final AttributeKey<String> DB_COLLECTION_NAME = stringKey("db.collection.name");

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

/** Cosmos DB container name. */
/**
* Deprecated, use {@code db.collection.name} instead.
*
* @deprecated Deprecated, use `db.collection.name` instead.
*/
@Deprecated
public static final AttributeKey<String> DB_COSMOSDB_CONTAINER =
stringKey("db.cosmosdb.container");

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

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

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

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

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

/** The MongoDB collection being accessed within the database stated in {@code db.name}. */
/**
* Deprecated, use {@code db.collection.name} instead.
*
* @deprecated Deprecated, use `db.collection.name` instead.
*/
@Deprecated
public static final AttributeKey<String> DB_MONGODB_COLLECTION =
stringKey("db.mongodb.collection");

/**
* The Microsoft SQL Server <a
* href="https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15">instance
* name</a> connecting to. This name is used to determine the port of a named instance.
* Deprecated, SQL Server instance is now populated as a part of {@code db.namespace} attribute.
*
* @deprecated Deprecated, SQL Server instance is now populated as a part of `db.namespace`
* attribute.
*/
@Deprecated
public static final AttributeKey<String> DB_MSSQL_INSTANCE_NAME =
stringKey("db.mssql.instance_name");

/**
* Deprecated, use {@code db.namespace} instead.
*
* @deprecated Deprecated, use `db.namespace` instead.
*/
@Deprecated public static final AttributeKey<String> DB_NAME = stringKey("db.name");

/**
* The name of the database, fully qualified within the server address and port.
*
* <p>Notes:
*
* <ul>
* <li>If setting a {@code db.mssql.instance_name}, {@code server.port} is no longer required
* (but still recommended if non-standard).
* <li>If a database system has multiple namespace components, they SHOULD be concatenated
* (potentially using database system specific conventions) from most general to most
* specific namespace component, and more specific namespaces SHOULD NOT be captured without
* the more general namespaces, to ensure that &quot;startswith&quot; queries for the more
* general namespaces will be valid. Semantic conventions for individual database systems
* SHOULD document what {@code db.namespace} means in the context of that system. It is
* RECOMMENDED to capture the value as provided by the application without attempting to do
* any case normalization.
* </ul>
*/
public static final AttributeKey<String> DB_MSSQL_INSTANCE_NAME =
stringKey("db.mssql.instance_name");
public static final AttributeKey<String> DB_NAMESPACE = stringKey("db.namespace");

/**
* This attribute is used to report the name of the database being accessed. For commands that
* switch the database, this should be set to the target database (even if the command fails).
* Deprecated, use {@code db.operation.name} instead.
*
* @deprecated Deprecated, use `db.operation.name` instead.
*/
@Deprecated public static final AttributeKey<String> DB_OPERATION = stringKey("db.operation");

/**
* The name of the operation or command being executed.
*
* <p>Notes:
*
* <ul>
* <li>In some SQL databases, the database name to be used is called &quot;schema name&quot;. In
* case there are multiple layers that could be considered for database name (e.g. Oracle
* instance name and schema name), the database name to be used is the more specific layer
* (e.g. Oracle schema name).
* <li>It is RECOMMENDED to capture the value as provided by the application without attempting
* to do any case normalization.
* </ul>
*/
public static final AttributeKey<String> DB_NAME = stringKey("db.name");
public static final AttributeKey<String> DB_OPERATION_NAME = stringKey("db.operation.name");

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

/** The database query being executed. */
public static final AttributeKey<String> DB_QUERY_TEXT = stringKey("db.query.text");

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

/**
* The name of the primary table that the operation is acting upon, including the database name
* (if applicable).
* Deprecated, use {@code db.collection.name} instead.
*
* @deprecated Deprecated, use `db.collection.name` instead.
*/
@Deprecated public static final AttributeKey<String> DB_SQL_TABLE = stringKey("db.sql.table");

/**
* The database statement being executed.
*
* @deprecated The database statement being executed.
*/
@Deprecated public static final AttributeKey<String> DB_STATEMENT = stringKey("db.statement");

/**
* The database management system (DBMS) product as identified by the client instrumentation.
*
* <p>Notes:
*
* <ul>
* <li>It is not recommended to attempt any client-side parsing of {@code db.statement} just to
* get this property, but it should be set if it is provided by the library being
* instrumented. If the operation is acting upon an anonymous table, or more than one table,
* this value MUST NOT be set.
* <li>The actual DBMS may differ from the one identified by the client. For example, when using
* PostgreSQL client libraries to connect to a CockroachDB, the {@code db.system} is set to
* {@code postgresql} based on the instrumentation's best knowledge.
* </ul>
*/
public static final AttributeKey<String> DB_SQL_TABLE = stringKey("db.sql.table");

/** The database statement being executed. */
public static final AttributeKey<String> DB_STATEMENT = stringKey("db.statement");
public static final AttributeKey<String> DB_SYSTEM = stringKey("db.system");

/**
* An identifier for the database management system (DBMS) product being used. See below for a
* list of well-known identifiers.
* Deprecated, no replacement at this time.
*
* @deprecated Deprecated, no replacement at this time.
*/
public static final AttributeKey<String> DB_SYSTEM = stringKey("db.system");

/** Username for accessing the database. */
public static final AttributeKey<String> DB_USER = stringKey("db.user");
@Deprecated public static final AttributeKey<String> DB_USER = stringKey("db.user");

// Enum definitions
/** Values for {@link #DB_CASSANDRA_CONSISTENCY_LEVEL}. */
Expand Down Expand Up @@ -275,6 +335,17 @@ public static final class DbCassandraConsistencyLevelValues {
private DbCassandraConsistencyLevelValues() {}
}

/** Values for {@link #DB_CLIENT_CONNECTIONS_STATE}. */
public static final class DbClientConnectionsStateValues {
/** idle. */
public static final String IDLE = "idle";

/** used. */
public static final String USED = "used";

private DbClientConnectionsStateValues() {}
}

/** Values for {@link #DB_COSMOSDB_CONNECTION_MODE}. */
public static final class DbCosmosdbConnectionModeValues {
/** Gateway (HTTP) connections mode. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ public final class ErrorIncubatingAttributes {
* <p>Notes:
*
* <ul>
* <li>The {@code error.type} SHOULD be predictable and SHOULD have low cardinality.
* Instrumentations SHOULD document the list of errors they report.
* <li>The {@code error.type} SHOULD be predictable, and SHOULD have low cardinality.
* <li>When {@code error.type} is set to a type (e.g., an exception type), its canonical class
* name identifying the type within the artifact SHOULD be used.
* <li>Instrumentations SHOULD document the list of errors they report.
* <li>The cardinality of {@code error.type} within one instrumentation library SHOULD be low.
* Telemetry consumers that aggregate data from multiple instrumentation libraries and
* applications should be prepared for {@code error.type} to have high cardinality at query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public final class EventIncubatingAttributes {
*
* <ul>
* <li>Event names are subject to the same rules as <a
* href="https://github.com/open-telemetry/opentelemetry-specification/tree/v1.31.0/specification/common/attribute-naming.md">attribute
* href="https://github.com/open-telemetry/opentelemetry-specification/tree/v1.33.0/specification/common/attribute-naming.md">attribute
* names</a>. Notably, event names are namespaced to avoid collisions and provide a clean
* separation of semantics for events in separate domains like browser, mobile, and
* kubernetes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public final class ExceptionIncubatingAttributes {
* <li>It is usually not possible to determine at the point where an exception is thrown whether
* it will escape the scope of a span. However, it is trivial to know that an exception will
* escape, if one checks for an active exception just before ending the span, as done in the
* <a href="#recording-an-exception">example for recording span exceptions</a>.
* <a
* href="https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception">example
* for recording span exceptions</a>.
* <li>It follows that an exception may still escape the scope of the span even if the {@code
* exception.escaped} attribute was not set or set to false, since the event might have been
* recorded at a time where it was not clear whether the exception will escape.
Expand Down
Loading

0 comments on commit 9eaa73a

Please sign in to comment.