From 9bc34d762181fc4b7075ed60a99f781e0d6bb65c Mon Sep 17 00:00:00 2001 From: jack-berg <34418638+jack-berg@users.noreply.github.com> Date: Fri, 2 Jun 2023 14:35:47 -0500 Subject: [PATCH] Update to semconv 1.20.0 (#5497) --- buildscripts/semantic-convention/generate.sh | 2 +- .../templates/SemanticAttributes.java.j2 | 109 ++++- .../attributes/ResourceAttributes.java | 2 +- .../trace/attributes/SemanticAttributes.java | 440 +++++++++++++++--- 4 files changed, 475 insertions(+), 78 deletions(-) diff --git a/buildscripts/semantic-convention/generate.sh b/buildscripts/semantic-convention/generate.sh index 69f652d5b6..9e8e51ec36 100755 --- a/buildscripts/semantic-convention/generate.sh +++ b/buildscripts/semantic-convention/generate.sh @@ -4,7 +4,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="${SCRIPT_DIR}/../../" # freeze the spec & generator tools versions to make SemanticAttributes generation reproducible -SEMCONV_VERSION=1.19.0 +SEMCONV_VERSION=1.20.0 SPEC_VERSION=v$SEMCONV_VERSION SCHEMA_URL=https://opentelemetry.io/schemas/$SEMCONV_VERSION GENERATOR_VERSION=0.18.0 diff --git a/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 b/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 index af5f4e5599..8c224df92f 100644 --- a/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 +++ b/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 @@ -206,14 +206,14 @@ public final class {{class}} { /** * The name of the transport protocol. - * @deprecated This item has been removed as of 1.17.0 of the semantic conventions. Use {@link SemanticAttributes#NET_APP_PROTOCOL_NAME} instead. + * @deprecated This item has been removed as of 1.17.0 of the semantic conventions. Use {@link SemanticAttributes#NET_PROTOCOL_NAME} instead. */ @Deprecated public static final AttributeKey MESSAGING_PROTOCOL = stringKey("messaging.protocol"); /** * The version of the transport protocol. - * @deprecated This item has been removed as of 1.17.0 of the semantic conventions. Use {@link SemanticAttributes#NET_APP_PROTOCOL_VERSION} instead. + * @deprecated This item has been removed as of 1.17.0 of the semantic conventions. Use {@link SemanticAttributes#NET_PROTOCOL_VERSION} instead. */ @Deprecated public static final AttributeKey MESSAGING_PROTOCOL_VERSION = @@ -288,7 +288,7 @@ public final class {{class}} { * @deprecated This item has been moved, use {@link io.opentelemetry.semconv.resource.attributes.ResourceAttributes#OTEL_SCOPE_VERSION} instead. */ @Deprecated - public static final AttributeKey OTEL_SCOPE_VERSION = stringKey("otel.scope.version");; + public static final AttributeKey OTEL_SCOPE_VERSION = stringKey("otel.scope.version"); /** * The execution ID of the current function execution. @@ -321,7 +321,108 @@ public final class {{class}} { * @deprecated Deprecated, use the {@link io.opentelemetry.semconv.resource.attributes.ResourceAttributes#OTEL_SCOPE_VERSION} attribute. */ @Deprecated - public static final AttributeKey OTEL_LIBRARY_VERSION = stringKey("otel.library.version"); + public static final AttributeKey OTEL_LIBRARY_VERSION = stringKey("otel.library.version"); + + /** + * Kind of HTTP protocol used. + * @deprecated This item has been removed as of 1.20.0 of the semantic conventions. + */ + @Deprecated + public static final AttributeKey HTTP_FLAVOR = stringKey("http.flavor"); + + /** + * Enum definitions for {@link #HTTP_FLAVOR}. + * @deprecated This item has been removed as of 1.20.0 of the semantic conventions. + */ + @Deprecated + public static final class HttpFlavorValues { + /** HTTP/1.0. */ + public static final String HTTP_1_0 = "1.0"; + + /** HTTP/1.1. */ + public static final String HTTP_1_1 = "1.1"; + + /** HTTP/2. */ + public static final String HTTP_2_0 = "2.0"; + + /** HTTP/3. */ + public static final String HTTP_3_0 = "3.0"; + + /** SPDY protocol. */ + public static final String SPDY = "SPDY"; + + /** QUIC protocol. */ + public static final String QUIC = "QUIC"; + + private HttpFlavorValues() {} + } + + /** + * Application layer protocol used. The value SHOULD be normalized to lowercase. + * @deprecated This item has been removed as of 1.20.0 of the semantic conventions. Use {@link SemanticAttributes#NET_PROTOCOL_NAME} instead. + */ + @Deprecated + public static final AttributeKey NET_APP_PROTOCOL_NAME = stringKey("net.app.protocol.name"); + + /** + * Version of the application layer protocol used. See note below. + * + *

Notes: + * + *

    + *
  • {@code net.app.protocol.version} refers to the version of the protocol used and might be + * different from the protocol client's version. If the HTTP client used has a version of + * {@code 0.27.2}, but sends HTTP version {@code 1.1}, this attribute should be set to + * {@code 1.1}. + *
+ * @deprecated This item has been removed as of 1.20.0 of the semantic conventions. Use {@link SemanticAttributes#NET_PROTOCOL_VERSION} instead. + */ + @Deprecated + public static final AttributeKey NET_APP_PROTOCOL_VERSION = stringKey("net.app.protocol.version"); + + /** + * The kind of message destination. + * @deprecated This item has been removed as of 1.20.0 of the semantic conventions. + */ + @Deprecated + public static final AttributeKey MESSAGING_DESTINATION_KIND = stringKey("messaging.destination.kind"); + + /** + * Enum values for {@link #MESSAGING_DESTINATION_KIND}. + * @deprecated This item has been removed as of 1.20.0 of the semantic conventions. + */ + @Deprecated + public static final class MessagingDestinationKindValues { + /** A message sent to a queue. */ + public static final String QUEUE = "queue"; + + /** A message sent to a topic. */ + public static final String TOPIC = "topic"; + + private MessagingDestinationKindValues() {} + } + + /** + * The kind of message source. + * @deprecated This item has been removed as of 1.20.0 of the semantic conventions. + */ + @Deprecated + public static final AttributeKey MESSAGING_SOURCE_KIND = stringKey("messaging.source.kind"); + + /** + * Enum values for {@link #MESSAGING_SOURCE_KIND}. + * @deprecated This item has been removed as of 1.20.0 of the semantic conventions. + */ + @Deprecated + public static final class MessagingSourceKindValues { + /** A message received from a queue. */ + public static final String QUEUE = "queue"; + + /** A message received from a topic. */ + public static final String TOPIC = "topic"; + + private MessagingSourceKindValues() {} + } {% endif %} diff --git a/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/ResourceAttributes.java b/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/ResourceAttributes.java index e2dc4fd0b8..9ce1370c6c 100644 --- a/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/ResourceAttributes.java +++ b/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/ResourceAttributes.java @@ -18,7 +18,7 @@ import java.util.List; @SuppressWarnings("unused") public final class ResourceAttributes { /** The URL of the OpenTelemetry schema for these keys and values. */ - public static final String SCHEMA_URL = "https://opentelemetry.io/schemas/1.19.0"; + public static final String SCHEMA_URL = "https://opentelemetry.io/schemas/1.20.0"; /** * Array of brand name and version separated by a space diff --git a/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java b/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java index 31f1c01d8a..6d71d6edb2 100644 --- a/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java +++ b/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java @@ -19,7 +19,7 @@ import java.util.List; @SuppressWarnings("unused") public final class SemanticAttributes { /** The URL of the OpenTelemetry schema for these keys and values. */ - public static final String SCHEMA_URL = "https://opentelemetry.io/schemas/1.19.0"; + public static final String SCHEMA_URL = "https://opentelemetry.io/schemas/1.20.0"; /** * The type of the exception (its fully-qualified class name, if applicable). The dynamic type of @@ -42,9 +42,6 @@ public final class SemanticAttributes { /** HTTP response status code. */ public static final AttributeKey HTTP_STATUS_CODE = longKey("http.status_code"); - /** Kind of HTTP protocol used. */ - public static final AttributeKey HTTP_FLAVOR = stringKey("http.flavor"); - /** The URI scheme identifying the used protocol. */ public static final AttributeKey HTTP_SCHEME = stringKey("http.scheme"); @@ -79,6 +76,21 @@ public final class SemanticAttributes { */ public static final AttributeKey EVENT_DOMAIN = stringKey("event.domain"); + /** + * A unique identifier for the Log Record. + * + *

Notes: + * + *

    + *
  • If an id is provided, other log records with the same id will be considered duplicates + * and can be removed safely. This means, that two distinguishable log records MUST have + * different values. The id MAY be an Universally + * Unique Lexicographically Sortable Identifier (ULID), but other identifiers (e.g. + * UUID) may be used as needed. + *
+ */ + public static final AttributeKey LOG_RECORD_UID = stringKey("log.record.uid"); + /** * The full invoked ARN as provided on the {@code Context} passed to the function ({@code * Lambda-Runtime-Invoked-Function-Arn} header on the {@code /runtime/invocation/next} @@ -181,15 +193,7 @@ public final class SemanticAttributes { */ public static final AttributeKey DB_NAME = stringKey("db.name"); - /** - * The database statement being executed. - * - *

Notes: - * - *

    - *
  • The value may be sanitized to exclude sensitive information. - *
- */ + /** The database statement being executed. */ public static final AttributeKey DB_STATEMENT = stringKey("db.statement"); /** @@ -295,6 +299,38 @@ public final class SemanticAttributes { */ public static final AttributeKey DB_SQL_TABLE = stringKey("db.sql.table"); + /** Unique Cosmos client instance id. */ + public static final AttributeKey DB_COSMOSDB_CLIENT_ID = + stringKey("db.cosmosdb.client_id"); + + /** CosmosDB Operation Type. */ + public static final AttributeKey DB_COSMOSDB_OPERATION_TYPE = + stringKey("db.cosmosdb.operation_type"); + + /** Cosmos client connection mode. */ + public static final AttributeKey DB_COSMOSDB_CONNECTION_MODE = + stringKey("db.cosmosdb.connection_mode"); + + /** Cosmos DB container name. */ + public static final AttributeKey DB_COSMOSDB_CONTAINER = + stringKey("db.cosmosdb.container"); + + /** Request payload size in bytes */ + public static final AttributeKey DB_COSMOSDB_REQUEST_CONTENT_LENGTH = + longKey("db.cosmosdb.request_content_length"); + + /** Cosmos DB status code. */ + public static final AttributeKey DB_COSMOSDB_STATUS_CODE = + longKey("db.cosmosdb.status_code"); + + /** Cosmos DB sub status code. */ + public static final AttributeKey DB_COSMOSDB_SUB_STATUS_CODE = + longKey("db.cosmosdb.sub_status_code"); + + /** RU consumed for that operation */ + public static final AttributeKey DB_COSMOSDB_REQUEST_CHARGE = + doubleKey("db.cosmosdb.request_charge"); + /** * Name of the code, either "OK" or "ERROR". MUST NOT be set if the status * code is UNSET. @@ -431,8 +467,7 @@ public final class SemanticAttributes { public static final AttributeKey NET_TRANSPORT = stringKey("net.transport"); /** Application layer protocol used. The value SHOULD be normalized to lowercase. */ - public static final AttributeKey NET_APP_PROTOCOL_NAME = - stringKey("net.app.protocol.name"); + public static final AttributeKey NET_PROTOCOL_NAME = stringKey("net.protocol.name"); /** * Version of the application layer protocol used. See note below. @@ -440,14 +475,13 @@ public final class SemanticAttributes { *

Notes: * *

    - *
  • {@code net.app.protocol.version} refers to the version of the protocol used and might be + *
  • {@code net.protocol.version} refers to the version of the protocol used and might be * different from the protocol client's version. If the HTTP client used has a version of * {@code 0.27.2}, but sends HTTP version {@code 1.1}, this attribute should be set to * {@code 1.1}. *
*/ - public static final AttributeKey NET_APP_PROTOCOL_VERSION = - stringKey("net.app.protocol.version"); + public static final AttributeKey NET_PROTOCOL_VERSION = stringKey("net.protocol.version"); /** Remote socket peer name. */ public static final AttributeKey NET_SOCK_PEER_NAME = stringKey("net.sock.peer.name"); @@ -653,6 +687,12 @@ public final class SemanticAttributes { */ public static final AttributeKey HTTP_CLIENT_IP = stringKey("http.client_ip"); + /** + * The AWS request ID as returned in the response headers {@code x-amz-request-id} or {@code + * x-amz-requestid}. + */ + public static final AttributeKey AWS_REQUEST_ID = stringKey("aws.request_id"); + /** The keys in the {@code RequestItems} object field. */ public static final AttributeKey> AWS_DYNAMODB_TABLE_NAMES = stringArrayKey("aws.dynamodb.table_names"); @@ -740,6 +780,138 @@ public final class SemanticAttributes { public static final AttributeKey> AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = stringArrayKey("aws.dynamodb.global_secondary_index_updates"); + /** + * The S3 bucket name the request refers to. Corresponds to the {@code --bucket} parameter of the + * S3 API + * operations. + * + *

Notes: + * + *

    + *
  • The {@code bucket} attribute is applicable to all S3 operations that reference a bucket, + * i.e. that require the bucket name as a mandatory parameter. This applies to almost all S3 + * operations except {@code list-buckets}. + *
+ */ + public static final AttributeKey AWS_S3_BUCKET = stringKey("aws.s3.bucket"); + + /** + * The S3 object key the request refers to. Corresponds to the {@code --key} parameter of the S3 API operations. + * + *

Notes: + * + *

+ */ + public static final AttributeKey AWS_S3_KEY = stringKey("aws.s3.key"); + + /** + * The source object (in the form {@code bucket}/{@code key}) for the copy operation. + * + *

Notes: + * + *

+ */ + public static final AttributeKey AWS_S3_COPY_SOURCE = stringKey("aws.s3.copy_source"); + + /** + * Upload ID that identifies the multipart upload. + * + *

Notes: + * + *

+ */ + public static final AttributeKey AWS_S3_UPLOAD_ID = stringKey("aws.s3.upload_id"); + + /** + * The delete request container that specifies the objects to be deleted. + * + *

Notes: + * + *

+ */ + public static final AttributeKey AWS_S3_DELETE = stringKey("aws.s3.delete"); + + /** + * The part number of the part being uploaded in a multipart-upload operation. This is a positive + * integer between 1 and 10,000. + * + *

Notes: + * + *

+ */ + public static final AttributeKey AWS_S3_PART_NUMBER = longKey("aws.s3.part_number"); + /** The name of the operation being executed. */ public static final AttributeKey GRAPHQL_OPERATION_NAME = stringKey("graphql.operation.name"); @@ -796,10 +968,6 @@ public final class SemanticAttributes { public static final AttributeKey MESSAGING_DESTINATION_NAME = stringKey("messaging.destination.name"); - /** The kind of message destination */ - public static final AttributeKey MESSAGING_DESTINATION_KIND = - stringKey("messaging.destination.kind"); - /** * Low cardinality representation of the messaging destination name * @@ -843,10 +1011,6 @@ public final class SemanticAttributes { public static final AttributeKey MESSAGING_SOURCE_NAME = stringKey("messaging.source.name"); - /** The kind of message source */ - public static final AttributeKey MESSAGING_SOURCE_KIND = - stringKey("messaging.source.kind"); - /** * Low cardinality representation of the messaging source name * @@ -1131,28 +1295,6 @@ public final class SemanticAttributes { public static final AttributeKey USER_AGENT_ORIGINAL = stringKey("user_agent.original"); // Enum definitions - public static final class HttpFlavorValues { - /** HTTP/1.0. */ - public static final String HTTP_1_0 = "1.0"; - - /** HTTP/1.1. */ - public static final String HTTP_1_1 = "1.1"; - - /** HTTP/2. */ - public static final String HTTP_2_0 = "2.0"; - - /** HTTP/3. */ - public static final String HTTP_3_0 = "3.0"; - - /** SPDY protocol. */ - public static final String SPDY = "SPDY"; - - /** QUIC protocol. */ - public static final String QUIC = "QUIC"; - - private HttpFlavorValues() {} - } - public static final class EventDomainValues { /** Events from browser apps. */ public static final String BROWSER = "browser"; @@ -1330,6 +1472,9 @@ public final class SemanticAttributes { /** Cloud Spanner. */ public static final String SPANNER = "spanner"; + /** Trino. */ + public static final String TRINO = "trino"; + private DbSystemValues() {} } @@ -1370,6 +1515,65 @@ public final class SemanticAttributes { private DbCassandraConsistencyLevelValues() {} } + public static final class DbCosmosdbOperationTypeValues { + /** invalid. */ + public static final String INVALID = "Invalid"; + + /** create. */ + public static final String CREATE = "Create"; + + /** patch. */ + public static final String PATCH = "Patch"; + + /** read. */ + public static final String READ = "Read"; + + /** read_feed. */ + public static final String READ_FEED = "ReadFeed"; + + /** delete. */ + public static final String DELETE = "Delete"; + + /** replace. */ + public static final String REPLACE = "Replace"; + + /** execute. */ + public static final String EXECUTE = "Execute"; + + /** query. */ + public static final String QUERY = "Query"; + + /** head. */ + public static final String HEAD = "Head"; + + /** head_feed. */ + public static final String HEAD_FEED = "HeadFeed"; + + /** upsert. */ + public static final String UPSERT = "Upsert"; + + /** batch. */ + public static final String BATCH = "Batch"; + + /** query_plan. */ + public static final String QUERY_PLAN = "QueryPlan"; + + /** execute_javascript. */ + public static final String EXECUTE_JAVASCRIPT = "ExecuteJavaScript"; + + private DbCosmosdbOperationTypeValues() {} + } + + public static final class DbCosmosdbConnectionModeValues { + /** Gateway (HTTP) connections mode. */ + public static final String GATEWAY = "gateway"; + + /** Direct connection. */ + public static final String DIRECT = "direct"; + + private DbCosmosdbConnectionModeValues() {} + } + public static final class OtelStatusCodeValues { /** * The operation has been validated by an Application developer or Operator to have completed @@ -1575,26 +1779,6 @@ public final class SemanticAttributes { private GraphqlOperationTypeValues() {} } - public static final class MessagingDestinationKindValues { - /** A message sent to a queue. */ - public static final String QUEUE = "queue"; - - /** A message sent to a topic. */ - public static final String TOPIC = "topic"; - - private MessagingDestinationKindValues() {} - } - - public static final class MessagingSourceKindValues { - /** A message received from a queue. */ - public static final String QUEUE = "queue"; - - /** A message received from a topic. */ - public static final String TOPIC = "topic"; - - private MessagingSourceKindValues() {} - } - public static final class MessagingOperationValues { /** publish. */ public static final String PUBLISH = "publish"; @@ -1874,7 +2058,7 @@ public final class SemanticAttributes { * The name of the transport protocol. * * @deprecated This item has been removed as of 1.17.0 of the semantic conventions. Use {@link - * SemanticAttributes#NET_APP_PROTOCOL_NAME} instead. + * SemanticAttributes#NET_PROTOCOL_NAME} instead. */ @Deprecated public static final AttributeKey MESSAGING_PROTOCOL = stringKey("messaging.protocol"); @@ -1883,7 +2067,7 @@ public final class SemanticAttributes { * The version of the transport protocol. * * @deprecated This item has been removed as of 1.17.0 of the semantic conventions. Use {@link - * SemanticAttributes#NET_APP_PROTOCOL_VERSION} instead. + * SemanticAttributes#NET_PROTOCOL_VERSION} instead. */ @Deprecated public static final AttributeKey MESSAGING_PROTOCOL_VERSION = @@ -1977,8 +2161,6 @@ public final class SemanticAttributes { @Deprecated public static final AttributeKey OTEL_SCOPE_VERSION = stringKey("otel.scope.version"); - ; - /** * The execution ID of the current function execution. * @@ -2016,5 +2198,119 @@ public final class SemanticAttributes { @Deprecated public static final AttributeKey OTEL_LIBRARY_VERSION = stringKey("otel.library.version"); + /** + * Kind of HTTP protocol used. + * + * @deprecated This item has been removed as of 1.20.0 of the semantic conventions. + */ + @Deprecated public static final AttributeKey HTTP_FLAVOR = stringKey("http.flavor"); + + /** + * Enum definitions for {@link #HTTP_FLAVOR}. + * + * @deprecated This item has been removed as of 1.20.0 of the semantic conventions. + */ + @Deprecated + public static final class HttpFlavorValues { + /** HTTP/1.0. */ + public static final String HTTP_1_0 = "1.0"; + + /** HTTP/1.1. */ + public static final String HTTP_1_1 = "1.1"; + + /** HTTP/2. */ + public static final String HTTP_2_0 = "2.0"; + + /** HTTP/3. */ + public static final String HTTP_3_0 = "3.0"; + + /** SPDY protocol. */ + public static final String SPDY = "SPDY"; + + /** QUIC protocol. */ + public static final String QUIC = "QUIC"; + + private HttpFlavorValues() {} + } + + /** + * Application layer protocol used. The value SHOULD be normalized to lowercase. + * + * @deprecated This item has been removed as of 1.20.0 of the semantic conventions. Use {@link + * SemanticAttributes#NET_PROTOCOL_NAME} instead. + */ + @Deprecated + public static final AttributeKey NET_APP_PROTOCOL_NAME = + stringKey("net.app.protocol.name"); + + /** + * Version of the application layer protocol used. See note below. + * + *

Notes: + * + *

    + *
  • {@code net.app.protocol.version} refers to the version of the protocol used and might be + * different from the protocol client's version. If the HTTP client used has a version of + * {@code 0.27.2}, but sends HTTP version {@code 1.1}, this attribute should be set to + * {@code 1.1}. + *
+ * + * @deprecated This item has been removed as of 1.20.0 of the semantic conventions. Use {@link + * SemanticAttributes#NET_PROTOCOL_VERSION} instead. + */ + @Deprecated + public static final AttributeKey NET_APP_PROTOCOL_VERSION = + stringKey("net.app.protocol.version"); + + /** + * The kind of message destination. + * + * @deprecated This item has been removed as of 1.20.0 of the semantic conventions. + */ + @Deprecated + public static final AttributeKey MESSAGING_DESTINATION_KIND = + stringKey("messaging.destination.kind"); + + /** + * Enum values for {@link #MESSAGING_DESTINATION_KIND}. + * + * @deprecated This item has been removed as of 1.20.0 of the semantic conventions. + */ + @Deprecated + public static final class MessagingDestinationKindValues { + /** A message sent to a queue. */ + public static final String QUEUE = "queue"; + + /** A message sent to a topic. */ + public static final String TOPIC = "topic"; + + private MessagingDestinationKindValues() {} + } + + /** + * The kind of message source. + * + * @deprecated This item has been removed as of 1.20.0 of the semantic conventions. + */ + @Deprecated + public static final AttributeKey MESSAGING_SOURCE_KIND = + stringKey("messaging.source.kind"); + + /** + * Enum values for {@link #MESSAGING_SOURCE_KIND}. + * + * @deprecated This item has been removed as of 1.20.0 of the semantic conventions. + */ + @Deprecated + public static final class MessagingSourceKindValues { + /** A message received from a queue. */ + public static final String QUEUE = "queue"; + + /** A message received from a topic. */ + public static final String TOPIC = "topic"; + + private MessagingSourceKindValues() {} + } + private SemanticAttributes() {} }