From 47ccd6076b2ec2b9c98cead58d6d4406b0b0da4d Mon Sep 17 00:00:00 2001 From: John Watson Date: Thu, 18 Nov 2021 16:25:16 -0800 Subject: [PATCH] update semconv to v1.8.0 (#3890) * update semconv to v1.8.0 * add back 2 items that were removed from the spec * tweak the deprecated items javadoc --- buildscripts/semantic-convention/generate.sh | 2 +- .../templates/SemanticAttributes.java.j2 | 18 +++ .../attributes/ResourceAttributes.java | 50 +++++-- .../trace/attributes/SemanticAttributes.java | 123 ++++++++++++++---- 4 files changed, 159 insertions(+), 34 deletions(-) diff --git a/buildscripts/semantic-convention/generate.sh b/buildscripts/semantic-convention/generate.sh index 45b684fdd0..809f564fbe 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.7.0 +SEMCONV_VERSION=1.8.0 SPEC_VERSION=v$SEMCONV_VERSION SCHEMA_URL=https://opentelemetry.io/schemas/$SEMCONV_VERSION GENERATOR_VERSION=0.7.0 diff --git a/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 b/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 index f290042b0a..afc5356475 100644 --- a/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 +++ b/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 @@ -106,6 +106,24 @@ public final class {{class}} { * io.opentelemetry.api.trace.Span#recordException(Throwable)} should be used. */ public static final String EXCEPTION_EVENT_NAME = "exception"; + + /** + * The name of the keyspace being accessed. + * + * @deprecated this item has been removed as of 1.8.0 of the semantic conventions. Please use {@link SemanticAttributes#DB_NAME} instead. + */ + @Deprecated + public static final AttributeKey DB_CASSANDRA_KEYSPACE = + stringKey("db.cassandra.keyspace"); + + /** + * The HBase namespace being accessed. + * + * @deprecated this item has been removed as of 1.8.0 of the semantic conventions. Please use {@link SemanticAttributes#DB_NAME} instead. + */ + @Deprecated + public static final AttributeKey DB_HBASE_NAMESPACE = stringKey("db.hbase.namespace"); + {% endif %} private {{class}}() {} 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 9f5319ca51..562e18ca95 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 @@ -16,7 +16,7 @@ import java.util.List; // buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 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.7.0"; + public static final String SCHEMA_URL = "https://opentelemetry.io/schemas/1.8.0"; /** Name of the cloud provider. */ public static final AttributeKey CLOUD_PROVIDER = stringKey("cloud.provider"); @@ -25,12 +25,20 @@ public final class ResourceAttributes { public static final AttributeKey CLOUD_ACCOUNT_ID = stringKey("cloud.account.id"); /** - * The geographical region the resource is running. Refer to your provider's docs to see the - * available regions, for example Alibaba Cloud regions, AWS regions, Azure regions, - * or Google Cloud regions. + * The geographical region the resource is running. + * + *

Notes: + * + *

*/ public static final AttributeKey CLOUD_REGION = stringKey("cloud.region"); @@ -143,7 +151,7 @@ public final class ResourceAttributes { public static final AttributeKey> AWS_LOG_STREAM_ARNS = stringArrayKey("aws.log.stream.arns"); - /** Container name. */ + /** Container name used by container runtime. */ public static final AttributeKey CONTAINER_NAME = stringKey("container.name"); /** @@ -347,9 +355,19 @@ public final class ResourceAttributes { /** The name of the Pod. */ public static final AttributeKey K8S_POD_NAME = stringKey("k8s.pod.name"); - /** The name of the Container in a Pod template. */ + /** + * The name of the Container from Pod specification, must be unique within a Pod. Container + * runtime usually uses different globally unique name ({@code container.name}). + */ public static final AttributeKey K8S_CONTAINER_NAME = stringKey("k8s.container.name"); + /** + * Number of times the container was restarted. This attribute can be used to identify a + * particular container (running or stopped) within a container spec. + */ + public static final AttributeKey K8S_CONTAINER_RESTART_COUNT = + longKey("k8s.container.restart_count"); + /** The UID of the ReplicaSet. */ public static final AttributeKey K8S_REPLICASET_UID = stringKey("k8s.replicaset.uid"); @@ -557,6 +575,8 @@ public final class ResourceAttributes { public static final String AZURE = "azure"; /** Google Cloud Platform. */ public static final String GCP = "gcp"; + /** Tencent Cloud. */ + public static final String TENCENT_CLOUD = "tencent_cloud"; private CloudProviderValues() {} } @@ -576,6 +596,8 @@ public final class ResourceAttributes { public static final String AWS_LAMBDA = "aws_lambda"; /** AWS Elastic Beanstalk. */ public static final String AWS_ELASTIC_BEANSTALK = "aws_elastic_beanstalk"; + /** AWS App Runner. */ + public static final String AWS_APP_RUNNER = "aws_app_runner"; /** Azure Virtual Machines. */ public static final String AZURE_VM = "azure_vm"; /** Azure Container Instances. */ @@ -596,6 +618,12 @@ public final class ResourceAttributes { public static final String GCP_CLOUD_FUNCTIONS = "gcp_cloud_functions"; /** Google Cloud App Engine (GAE). */ public static final String GCP_APP_ENGINE = "gcp_app_engine"; + /** Tencent Cloud Cloud Virtual Machine (CVM). */ + public static final String TENCENT_CLOUD_CVM = "tencent_cloud_cvm"; + /** Tencent Cloud Elastic Kubernetes Service (EKS). */ + public static final String TENCENT_CLOUD_EKS = "tencent_cloud_eks"; + /** Tencent Cloud Serverless Cloud Function (SCF). */ + public static final String TENCENT_CLOUD_SCF = "tencent_cloud_scf"; private CloudPlatformValues() {} } @@ -622,6 +650,8 @@ public final class ResourceAttributes { public static final String PPC32 = "ppc32"; /** 64-bit PowerPC. */ public static final String PPC64 = "ppc64"; + /** IBM z/Architecture. */ + public static final String S390X = "s390x"; /** 32-bit x86. */ public static final String X86 = "x86"; @@ -676,6 +706,8 @@ public final class ResourceAttributes { public static final String RUBY = "ruby"; /** webjs. */ public static final String WEBJS = "webjs"; + /** swift. */ + public static final String SWIFT = "swift"; private TelemetrySdkLanguageValues() {} } 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 767adecc1e..13764bf3fe 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 @@ -18,7 +18,7 @@ import java.util.List; // buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 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.7.0"; + public static final String SCHEMA_URL = "https://opentelemetry.io/schemas/1.8.0"; /** * The full invoked ARN as provided on the {@code Context} passed to the function ({@code @@ -58,15 +58,16 @@ public final class SemanticAttributes { stringKey("db.jdbc.driver_classname"); /** - * If no tech-specific attribute is - * defined, 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). + * 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). * *

Notes: * *

    - *
  • In some SQL databases, the database name to be used is called "schema name". + *
  • In some SQL databases, the database name to be used is called "schema name". 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). *
*/ public static final AttributeKey DB_NAME = stringKey("db.name"); @@ -113,13 +114,6 @@ public final class SemanticAttributes { public static final AttributeKey DB_MSSQL_INSTANCE_NAME = stringKey("db.mssql.instance_name"); - /** - * The name of the keyspace being accessed. To be used instead of the generic {@code db.name} - * attribute. - */ - public static final AttributeKey DB_CASSANDRA_KEYSPACE = - stringKey("db.cassandra.keyspace"); - /** The fetch size used for paging, i.e. how many rows will be returned at once. */ public static final AttributeKey DB_CASSANDRA_PAGE_SIZE = longKey("db.cassandra.page_size"); @@ -131,8 +125,8 @@ public final class SemanticAttributes { stringKey("db.cassandra.consistency_level"); /** - * The name of the primary table that the operation is acting upon, including the schema name (if - * applicable). + * The name of the primary table that the operation is acting upon, including the keyspace name + * (if applicable). * *

Notes: * @@ -165,12 +159,6 @@ public final class SemanticAttributes { public static final AttributeKey DB_CASSANDRA_COORDINATOR_DC = stringKey("db.cassandra.coordinator.dc"); - /** - * The HBase namespace being accessed. - * To be used instead of the generic {@code db.name} attribute. - */ - public static final AttributeKey DB_HBASE_NAMESPACE = stringKey("db.hbase.namespace"); - /** * The index of the database being accessed as used in the {@code SELECT} command, provided as an integer. To @@ -184,8 +172,8 @@ public final class SemanticAttributes { stringKey("db.mongodb.collection"); /** - * The name of the primary table that the operation is acting upon, including the schema name (if - * applicable). + * The name of the primary table that the operation is acting upon, including the database name + * (if applicable). * *

Notes: * @@ -236,7 +224,20 @@ public final class SemanticAttributes { */ public static final AttributeKey EXCEPTION_ESCAPED = booleanKey("exception.escaped"); - /** Type of the trigger on which the function is executed. */ + /** + * Type of the trigger which caused this function execution. + * + *

Notes: + * + *

    + *
  • For the server/consumer span on the incoming side, {@code faas.trigger} MUST be set. + *
  • Clients invoking FaaS instances usually cannot set {@code faas.trigger}, since they would + * typically need to look in the payload to determine the event type. If clients set it, it + * should be the same as the trigger that corresponding incoming would have (i.e., this has + * nothing to do with the underlying transport used to make the API call to invoke the + * lambda, which is often HTTP). + *
+ */ public static final AttributeKey FAAS_TRIGGER = stringKey("faas.trigger"); /** The execution ID of the current function execution. */ @@ -751,6 +752,37 @@ public final class SemanticAttributes { public static final AttributeKey MESSAGING_KAFKA_TOMBSTONE = booleanKey("messaging.kafka.tombstone"); + /** Namespace of RocketMQ resources, resources in different namespaces are individual. */ + public static final AttributeKey MESSAGING_ROCKETMQ_NAMESPACE = + stringKey("messaging.rocketmq.namespace"); + + /** + * Name of the RocketMQ producer/consumer group that is handling the message. The client type is + * identified by the SpanKind. + */ + public static final AttributeKey MESSAGING_ROCKETMQ_CLIENT_GROUP = + stringKey("messaging.rocketmq.client_group"); + + /** The unique identifier for each client. */ + public static final AttributeKey MESSAGING_ROCKETMQ_CLIENT_ID = + stringKey("messaging.rocketmq.client_id"); + + /** Type of message. */ + public static final AttributeKey MESSAGING_ROCKETMQ_MESSAGE_TYPE = + stringKey("messaging.rocketmq.message_type"); + + /** The secondary classifier of message besides topic. */ + public static final AttributeKey MESSAGING_ROCKETMQ_MESSAGE_TAG = + stringKey("messaging.rocketmq.message_tag"); + + /** Key(s) of message, another way to mark message besides message id. */ + public static final AttributeKey> MESSAGING_ROCKETMQ_MESSAGE_KEYS = + stringArrayKey("messaging.rocketmq.message_keys"); + + /** Model of message consumption. This only applies to consumer spans. */ + public static final AttributeKey MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = + stringKey("messaging.rocketmq.consumption_model"); + /** A string identifying the remoting system. */ public static final AttributeKey RPC_SYSTEM = stringKey("rpc.system"); @@ -997,6 +1029,8 @@ public final class SemanticAttributes { public static final String AZURE = "azure"; /** Google Cloud Platform. */ public static final String GCP = "gcp"; + /** Tencent Cloud. */ + public static final String TENCENT_CLOUD = "tencent_cloud"; private FaasInvokedProviderValues() {} } @@ -1115,6 +1149,28 @@ public final class SemanticAttributes { private MessagingOperationValues() {} } + public static final class MessagingRocketmqMessageTypeValues { + /** Normal message. */ + public static final String NORMAL = "normal"; + /** FIFO message. */ + public static final String FIFO = "fifo"; + /** Delay message. */ + public static final String DELAY = "delay"; + /** Transaction message. */ + public static final String TRANSACTION = "transaction"; + + private MessagingRocketmqMessageTypeValues() {} + } + + public static final class MessagingRocketmqConsumptionModelValues { + /** Clustering consumption model. */ + public static final String CLUSTERING = "clustering"; + /** Broadcasting consumption model. */ + public static final String BROADCASTING = "broadcasting"; + + private MessagingRocketmqConsumptionModelValues() {} + } + public static final class RpcGrpcStatusCodeValues { /** OK. */ public static final long OK = 0; @@ -1172,5 +1228,24 @@ public final class SemanticAttributes { */ public static final String EXCEPTION_EVENT_NAME = "exception"; + /** + * The name of the keyspace being accessed. + * + * @deprecated this item has been removed as of 1.8.0 of the semantic conventions. Please use + * {@link SemanticAttributes#DB_NAME} instead. + */ + @Deprecated + public static final AttributeKey DB_CASSANDRA_KEYSPACE = + stringKey("db.cassandra.keyspace"); + + /** + * The HBase namespace being accessed. + * + * @deprecated this item has been removed as of 1.8.0 of the semantic conventions. Please use + * {@link SemanticAttributes#DB_NAME} instead. + */ + @Deprecated + public static final AttributeKey DB_HBASE_NAMESPACE = stringKey("db.hbase.namespace"); + private SemanticAttributes() {} }