From 8f15440b45dd7e8cfc4e7b113df9ebc810553626 Mon Sep 17 00:00:00 2001 From: Ehsan Saei <71217171+esigo@users.noreply.github.com> Date: Tue, 16 Apr 2024 23:29:10 +0200 Subject: [PATCH] [SEMANTIC CONVENTIONS] Upgrade to semantic convention 1.25.0 (#2633) --- .../trace/semantic_conventions.h | 2634 ++++++++++++----- buildscripts/semantic-convention/generate.sh | 4 +- examples/grpc/client.cc | 16 +- examples/grpc/server.cc | 15 +- examples/http/client.cc | 16 +- examples/http/server.cc | 22 +- exporters/zipkin/src/recordable.cc | 5 +- .../sdk/resource/semantic_conventions.h | 945 +----- sdk/src/resource/resource.cc | 14 +- sdk/src/resource/resource_detector.cc | 3 +- sdk/test/resource/resource_test.cc | 25 +- 11 files changed, 2018 insertions(+), 1681 deletions(-) diff --git a/api/include/opentelemetry/trace/semantic_conventions.h b/api/include/opentelemetry/trace/semantic_conventions.h index baad4e674f..ba783e2333 100644 --- a/api/include/opentelemetry/trace/semantic_conventions.h +++ b/api/include/opentelemetry/trace/semantic_conventions.h @@ -22,76 +22,14 @@ namespace SemanticConventions /** * The URL of the OpenTelemetry schema for these keys and values. */ -static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.24.0"; - -/** - * The name of the invoked function. - * - *

Notes: -

- */ -static constexpr const char *kFaasInvokedName = "faas.invoked_name"; - -/** - * The cloud provider of the invoked function. - * - *

Notes: -

- */ -static constexpr const char *kFaasInvokedProvider = "faas.invoked_provider"; - -/** - * The cloud region of the invoked function. - * - *

Notes: -

- */ -static constexpr const char *kFaasInvokedRegion = "faas.invoked_region"; - -/** - * Type of the trigger which caused this function invocation. - */ -static constexpr const char *kFaasTrigger = "faas.trigger"; - -/** - * The {@code service.name} of the remote service. - * SHOULD be equal to the actual {@code service.name} resource attribute of the remote service if - * any. - */ -static constexpr const char *kPeerService = "peer.service"; - -/** - * Username or client_id extracted from the access token or Authorization header in the inbound - * request from outside the system. - */ -static constexpr const char *kEnduserId = "enduser.id"; - -/** - * Actual/assumed role the client is making the request under extracted from token or application - * security context. - */ -static constexpr const char *kEnduserRole = "enduser.role"; - -/** - * Scopes or granted authorities the client currently possesses extracted from token or application - * security context. The value would come from the scope associated with an OAuth 2.0 Access Token or an attribute - * value in a SAML 2.0 - * Assertion. - */ -static constexpr const char *kEnduserScope = "enduser.scope"; +static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.25.0"; /** * Identifies the class / type of event. * *

Notes:

*/ @@ -157,9 +95,9 @@ static constexpr const char *kAndroidState = "android.state"; /** * The name of the connection pool; unique within the instrumented application. In case the - * connection pool implementation doesn't provide a name, then the db.connection_string - * should be used + * 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}. */ static constexpr const char *kPoolName = "pool.name"; @@ -168,6 +106,11 @@ static constexpr const char *kPoolName = "pool.name"; */ static constexpr const char *kState = "state"; +/** + * Rate-limiting result, shows whether the lease was acquired or contains a rejection reason + */ +static constexpr const char *kAspnetcoreRateLimitingResult = "aspnetcore.rate_limiting.result"; + /** * Full type name of the {@code @@ -181,11 +124,6 @@ static constexpr const char *kAspnetcoreDiagnosticsHandlerType = */ static constexpr const char *kAspnetcoreRateLimitingPolicy = "aspnetcore.rate_limiting.policy"; -/** - * Rate-limiting result, shows whether the lease was acquired or contains a rejection reason - */ -static constexpr const char *kAspnetcoreRateLimitingResult = "aspnetcore.rate_limiting.result"; - /** * Flag indicating if request was handled by the application pipeline. */ @@ -233,6 +171,12 @@ static constexpr const char *kJvmMemoryPoolName = "jvm.memory.pool.name"; */ static constexpr const char *kJvmMemoryType = "jvm.memory.type"; +/** + * The CPU state for this data point. A process SHOULD be characterized either by data + * points with no {@code state} labels, or only data points with {@code state} labels. + */ +static constexpr const char *kProcessCpuState = "process.cpu.state"; + /** * The device identifier */ @@ -244,7 +188,8 @@ static constexpr const char *kSystemDevice = "system.device"; static constexpr const char *kSystemCpuLogicalNumber = "system.cpu.logical_number"; /** - * The state of the CPU + * The CPU state for this data point. A system's CPU SHOULD be characterized either by data + * points with no {@code state} labels, or only data points with {@code state} labels. */ static constexpr const char *kSystemCpuState = "system.cpu.state"; @@ -298,512 +243,1313 @@ static constexpr const char *kSystemNetworkState = "system.network.state"; * href="https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES">Linux Process State * Codes */ -static constexpr const char *kSystemProcessesStatus = "system.processes.status"; +static constexpr const char *kSystemProcessStatus = "system.process.status"; /** - * Client address - domain name if available without reverse DNS lookup; otherwise, IP address or - Unix domain socket name. - * - *

Notes: -

+ * Uniquely identifies the framework API revision offered by a version ({@code os.version}) of the + * android operating system. More information can be found here. */ -static constexpr const char *kClientAddress = "client.address"; +static constexpr const char *kAndroidOsApiLevel = "android.os.api_level"; /** - * Client port number. - * - *

Notes: -

+ * The JSON-serialized value of each item in the {@code AttributeDefinitions} request field. */ -static constexpr const char *kClientPort = "client.port"; +static constexpr const char *kAwsDynamodbAttributeDefinitions = + "aws.dynamodb.attribute_definitions"; /** - * The column number in {@code code.filepath} best representing the operation. It SHOULD point - * within the code unit named in {@code code.function}. + * The value of the {@code AttributesToGet} request parameter. */ -static constexpr const char *kCodeColumn = "code.column"; +static constexpr const char *kAwsDynamodbAttributesToGet = "aws.dynamodb.attributes_to_get"; /** - * The source code file name that identifies the code unit as uniquely as possible (preferably an - * absolute file path). + * The value of the {@code ConsistentRead} request parameter. */ -static constexpr const char *kCodeFilepath = "code.filepath"; +static constexpr const char *kAwsDynamodbConsistentRead = "aws.dynamodb.consistent_read"; /** - * The method or function name, or equivalent (usually rightmost part of the code unit's name). + * The JSON-serialized value of each item in the {@code ConsumedCapacity} response field. */ -static constexpr const char *kCodeFunction = "code.function"; +static constexpr const char *kAwsDynamodbConsumedCapacity = "aws.dynamodb.consumed_capacity"; /** - * The line number in {@code code.filepath} best representing the operation. It SHOULD point within - * the code unit named in {@code code.function}. + * The value of the {@code Count} response parameter. */ -static constexpr const char *kCodeLineno = "code.lineno"; +static constexpr const char *kAwsDynamodbCount = "aws.dynamodb.count"; /** - * The "namespace" within which {@code code.function} is defined. Usually the qualified - * class or module name, such that {@code code.namespace} + some separator + {@code code.function} - * form a unique identifier for the code unit. + * The value of the {@code ExclusiveStartTableName} request parameter. */ -static constexpr const char *kCodeNamespace = "code.namespace"; +static constexpr const char *kAwsDynamodbExclusiveStartTable = "aws.dynamodb.exclusive_start_table"; /** - * 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. + * The JSON-serialized value of each item in the {@code GlobalSecondaryIndexUpdates} request field. */ -static constexpr const char *kCodeStacktrace = "code.stacktrace"; +static constexpr const char *kAwsDynamodbGlobalSecondaryIndexUpdates = + "aws.dynamodb.global_secondary_index_updates"; /** - * The consistency level of the query. Based on consistency values from CQL. + * The JSON-serialized value of each item of the {@code GlobalSecondaryIndexes} request field */ -static constexpr const char *kDbCassandraConsistencyLevel = "db.cassandra.consistency_level"; +static constexpr const char *kAwsDynamodbGlobalSecondaryIndexes = + "aws.dynamodb.global_secondary_indexes"; /** - * The data center of the coordinating node for a query. + * The value of the {@code IndexName} request parameter. */ -static constexpr const char *kDbCassandraCoordinatorDc = "db.cassandra.coordinator.dc"; +static constexpr const char *kAwsDynamodbIndexName = "aws.dynamodb.index_name"; /** - * The ID of the coordinating node for a query. + * The JSON-serialized value of the {@code ItemCollectionMetrics} response field. */ -static constexpr const char *kDbCassandraCoordinatorId = "db.cassandra.coordinator.id"; +static constexpr const char *kAwsDynamodbItemCollectionMetrics = + "aws.dynamodb.item_collection_metrics"; /** - * Whether or not the query is idempotent. + * The value of the {@code Limit} request parameter. */ -static constexpr const char *kDbCassandraIdempotence = "db.cassandra.idempotence"; +static constexpr const char *kAwsDynamodbLimit = "aws.dynamodb.limit"; /** - * The fetch size used for paging, i.e. how many rows will be returned at once. + * The JSON-serialized value of each item of the {@code LocalSecondaryIndexes} request field. */ -static constexpr const char *kDbCassandraPageSize = "db.cassandra.page_size"; +static constexpr const char *kAwsDynamodbLocalSecondaryIndexes = + "aws.dynamodb.local_secondary_indexes"; /** - * The number of times a query was speculatively executed. Not set or {@code 0} if the query was not - * executed speculatively. + * The value of the {@code ProjectionExpression} request parameter. */ -static constexpr const char *kDbCassandraSpeculativeExecutionCount = - "db.cassandra.speculative_execution_count"; +static constexpr const char *kAwsDynamodbProjection = "aws.dynamodb.projection"; /** - * The name of the primary Cassandra table that the operation is acting upon, including the keyspace - name (if applicable). - * - *

Notes: -

+ * The value of the {@code ProvisionedThroughput.ReadCapacityUnits} request parameter. */ -static constexpr const char *kDbCassandraTable = "db.cassandra.table"; +static constexpr const char *kAwsDynamodbProvisionedReadCapacity = + "aws.dynamodb.provisioned_read_capacity"; /** - * The connection string used to connect to the database. It is recommended to remove embedded - * credentials. + * The value of the {@code ProvisionedThroughput.WriteCapacityUnits} request parameter. */ -static constexpr const char *kDbConnectionString = "db.connection_string"; +static constexpr const char *kAwsDynamodbProvisionedWriteCapacity = + "aws.dynamodb.provisioned_write_capacity"; /** - * Unique Cosmos client instance id. + * The value of the {@code ScanIndexForward} request parameter. */ -static constexpr const char *kDbCosmosdbClientId = "db.cosmosdb.client_id"; +static constexpr const char *kAwsDynamodbScanForward = "aws.dynamodb.scan_forward"; /** - * Cosmos client connection mode. + * The value of the {@code ScannedCount} response parameter. */ -static constexpr const char *kDbCosmosdbConnectionMode = "db.cosmosdb.connection_mode"; +static constexpr const char *kAwsDynamodbScannedCount = "aws.dynamodb.scanned_count"; /** - * Cosmos DB container name. + * The value of the {@code Segment} request parameter. */ -static constexpr const char *kDbCosmosdbContainer = "db.cosmosdb.container"; +static constexpr const char *kAwsDynamodbSegment = "aws.dynamodb.segment"; /** - * CosmosDB Operation Type. + * The value of the {@code Select} request parameter. */ -static constexpr const char *kDbCosmosdbOperationType = "db.cosmosdb.operation_type"; +static constexpr const char *kAwsDynamodbSelect = "aws.dynamodb.select"; /** - * RU consumed for that operation + * The number of items in the {@code TableNames} response parameter. */ -static constexpr const char *kDbCosmosdbRequestCharge = "db.cosmosdb.request_charge"; +static constexpr const char *kAwsDynamodbTableCount = "aws.dynamodb.table_count"; /** - * Request payload size in bytes + * The keys in the {@code RequestItems} object field. */ -static constexpr const char *kDbCosmosdbRequestContentLength = "db.cosmosdb.request_content_length"; +static constexpr const char *kAwsDynamodbTableNames = "aws.dynamodb.table_names"; /** - * Cosmos DB status code. + * The value of the {@code TotalSegments} request parameter. */ -static constexpr const char *kDbCosmosdbStatusCode = "db.cosmosdb.status_code"; +static constexpr const char *kAwsDynamodbTotalSegments = "aws.dynamodb.total_segments"; /** - * Cosmos DB sub status code. + * Array of brand name and version separated by a space + * + *

Notes: +

*/ -static constexpr const char *kDbCosmosdbSubStatusCode = "db.cosmosdb.sub_status_code"; +static constexpr const char *kBrowserBrands = "browser.brands"; /** - * Represents the identifier of an Elasticsearch cluster. + * Preferred language of the user using the browser + * + *

Notes: +

*/ -static constexpr const char *kDbElasticsearchClusterName = "db.elasticsearch.cluster.name"; +static constexpr const char *kBrowserLanguage = "browser.language"; /** - * Represents the human-readable identifier of the node/instance to which a request was routed. + * A boolean that is true if the browser is running on a mobile device + * + *

Notes: +

*/ -static constexpr const char *kDbElasticsearchNodeName = "db.elasticsearch.node.name"; +static constexpr const char *kBrowserMobile = "browser.mobile"; /** - * 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}. + * The platform on which the browser is running + * + *

Notes: +

*/ -static constexpr const char *kDbInstanceId = "db.instance.id"; +static constexpr const char *kBrowserPlatform = "browser.platform"; /** - * The fully-qualified class name of the Java Database Connectivity - * (JDBC) driver used to connect. + * Client address - domain name if available without reverse DNS lookup; otherwise, IP address or + Unix domain socket name. + * + *

Notes: +

*/ -static constexpr const char *kDbJdbcDriverClassname = "db.jdbc.driver_classname"; +static constexpr const char *kClientAddress = "client.address"; /** - * The MongoDB collection being accessed within the database stated in {@code db.name}. + * Client port number. + * + *

Notes: +

*/ -static constexpr const char *kDbMongodbCollection = "db.mongodb.collection"; +static constexpr const char *kClientPort = "client.port"; /** - * The Microsoft SQL Server instance - name connecting to. This name is used to determine the port of a named instance. - * - *

Notes: -

+ * The cloud account ID the resource is assigned to. */ -static constexpr const char *kDbMssqlInstanceName = "db.mssql.instance_name"; +static constexpr const char *kCloudAccountId = "cloud.account.id"; /** - * 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). + * Cloud regions often have multiple, isolated locations known as zones to increase availability. + Availability zone represents the zone where the resource is running. * *

Notes: -

+ */ -static constexpr const char *kDbName = "db.name"; +static constexpr const char *kCloudAvailabilityZone = "cloud.availability_zone"; /** - * The name of the operation being executed, e.g. the MongoDB command - name such as {@code findAndModify}, or the SQL keyword. + * The cloud platform in use. * *

Notes: -

*/ static constexpr const char *kMessagingDestinationName = "messaging.destination.name"; +/** + * The identifier of the partition messages are sent to or received from, unique within the {@code + * messaging.destination.name}. + */ +static constexpr const char *kMessagingDestinationPartitionId = + "messaging.destination.partition.id"; + /** * Low cardinality representation of the messaging destination name * @@ -943,6 +1836,18 @@ identify the broker. static constexpr const char *kMessagingDestinationPublishName = "messaging.destination_publish.name"; +/** + * The name of the consumer group the event consumer is associated with. + */ +static constexpr const char *kMessagingEventhubsConsumerGroup = + "messaging.eventhubs.consumer.group"; + +/** + * The UTC epoch seconds at which the message has been accepted and stored in the entity. + */ +static constexpr const char *kMessagingEventhubsMessageEnqueuedTime = + "messaging.eventhubs.message.enqueued_time"; + /** * The ordering key for a given message. If the attribute is not present, the message does not have * an ordering key. @@ -956,12 +1861,6 @@ static constexpr const char *kMessagingGcpPubsubMessageOrderingKey = */ static constexpr const char *kMessagingKafkaConsumerGroup = "messaging.kafka.consumer.group"; -/** - * Partition the message is sent to. - */ -static constexpr const char *kMessagingKafkaDestinationPartition = - "messaging.kafka.destination.partition"; - /** * Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from {@code messaging.message.id} in that they're not unique. If the @@ -1027,6 +1926,12 @@ static constexpr const char *kMessagingOperation = "messaging.operation"; static constexpr const char *kMessagingRabbitmqDestinationRoutingKey = "messaging.rabbitmq.destination.routing_key"; +/** + * RabbitMQ message delivery tag + */ +static constexpr const char *kMessagingRabbitmqMessageDeliveryTag = + "messaging.rabbitmq.message.delivery_tag"; + /** * Name of the RocketMQ producer/consumer group that is handling the message. The client type is * identified by the SpanKind. @@ -1077,6 +1982,32 @@ static constexpr const char *kMessagingRocketmqMessageType = "messaging.rocketmq */ static constexpr const char *kMessagingRocketmqNamespace = "messaging.rocketmq.namespace"; +/** + * The name of the subscription in the topic messages are received from. + */ +static constexpr const char *kMessagingServicebusDestinationSubscriptionName = + "messaging.servicebus.destination.subscription_name"; + +/** + * Describes the settlement + * type. + */ +static constexpr const char *kMessagingServicebusDispositionStatus = + "messaging.servicebus.disposition_status"; + +/** + * Number of deliveries that have been attempted for this message. + */ +static constexpr const char *kMessagingServicebusMessageDeliveryCount = + "messaging.servicebus.message.delivery_count"; + +/** + * The UTC epoch seconds at which the message has been accepted and stored in the entity. + */ +static constexpr const char *kMessagingServicebusMessageEnqueuedTime = + "messaging.servicebus.message.enqueued_time"; + /** * An identifier for the messaging system being used. See below for a list of well-known * identifiers. @@ -1149,12 +2080,13 @@ static constexpr const char *kNetworkPeerPort = "network.peer.port"; static constexpr const char *kNetworkProtocolName = "network.protocol.name"; /** - * Version of the protocol specified in {@code network.protocol.name}. + * The actual version of the protocol used for network communication. * *

Notes: -

+ */ static constexpr const char *kNetworkProtocolVersion = "network.protocol.version"; @@ -1179,6 +2111,121 @@ static constexpr const char *kNetworkTransport = "network.transport"; */ static constexpr const char *kNetworkType = "network.type"; +/** + * The digest of the OCI image manifest. For container images specifically is the digest by which +the container image is known. + * + *

Notes: +

+ */ +static constexpr const char *kOciManifestDigest = "oci.manifest.digest"; + +/** + * Unique identifier for a particular build or compilation of the operating system. + */ +static constexpr const char *kOsBuildId = "os.build_id"; + +/** + * Human readable (not intended to be parsed) OS version information, like e.g. reported by {@code + * ver} or {@code lsb_release -a} commands. + */ +static constexpr const char *kOsDescription = "os.description"; + +/** + * Human readable operating system name. + */ +static constexpr const char *kOsName = "os.name"; + +/** + * The operating system type. + */ +static constexpr const char *kOsType = "os.type"; + +/** + * The version string of the operating system as defined in Version Attributes. + */ +static constexpr const char *kOsVersion = "os.version"; + +/** + * The {@code service.name} of the remote service. + * SHOULD be equal to the actual {@code service.name} resource attribute of the remote service if + * any. + */ +static constexpr const char *kPeerService = "peer.service"; + +/** + * The command used to launch the process (i.e. the command name). On Linux based systems, can be + * set to the zeroth string in {@code proc/[pid]/cmdline}. On Windows, can be set to the first + * parameter extracted from {@code GetCommandLineW}. + */ +static constexpr const char *kProcessCommand = "process.command"; + +/** + * All the command arguments (including the command/executable itself) as received by the process. + * On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according + * to the list of null-delimited strings extracted from {@code proc/[pid]/cmdline}. For libc-based + * executables, this would be the full argv vector passed to {@code main}. + */ +static constexpr const char *kProcessCommandArgs = "process.command_args"; + +/** + * The full command used to launch the process as a single string representing the full command. On + * Windows, can be set to the result of {@code GetCommandLineW}. Do not set this if you have to + * assemble it just for monitoring; use {@code process.command_args} instead. + */ +static constexpr const char *kProcessCommandLine = "process.command_line"; + +/** + * The name of the process executable. On Linux based systems, can be set to the {@code Name} in + * {@code proc/[pid]/status}. On Windows, can be set to the base name of {@code + * GetProcessImageFileNameW}. + */ +static constexpr const char *kProcessExecutableName = "process.executable.name"; + +/** + * The full path to the process executable. On Linux based systems, can be set to the target of + * {@code proc/[pid]/exe}. On Windows, can be set to the result of {@code GetProcessImageFileNameW}. + */ +static constexpr const char *kProcessExecutablePath = "process.executable.path"; + +/** + * The username of the user that owns the process. + */ +static constexpr const char *kProcessOwner = "process.owner"; + +/** + * Parent Process identifier (PPID). + */ +static constexpr const char *kProcessParentPid = "process.parent_pid"; + +/** + * Process identifier (PID). + */ +static constexpr const char *kProcessPid = "process.pid"; + +/** + * An additional description about the runtime of the process, for example a specific vendor + * customization of the runtime environment. + */ +static constexpr const char *kProcessRuntimeDescription = "process.runtime.description"; + +/** + * The name of the runtime of this process. For compiled native binaries, this SHOULD be the name of + * the compiler. + */ +static constexpr const char *kProcessRuntimeName = "process.runtime.name"; + +/** + * The version of the runtime of this process, as returned by the runtime without modification. + */ +static constexpr const char *kProcessRuntimeVersion = "process.runtime.version"; + /** * The error codes of the Connect * request. Error codes are always string values. @@ -1236,33 +2283,104 @@ static constexpr const char *kRpcMethod = "rpc.method"; method actually executing the call on the server side, RPC client stub class on the client side). */ -static constexpr const char *kRpcService = "rpc.service"; +static constexpr const char *kRpcService = "rpc.service"; + +/** + * A string identifying the remoting system. See below for a list of well-known identifiers. + */ +static constexpr const char *kRpcSystem = "rpc.system"; + +/** + * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain + socket name. + * + *

Notes: +

+ */ +static constexpr const char *kServerAddress = "server.address"; + +/** + * Server port number. + * + *

Notes: +

+ */ +static constexpr const char *kServerPort = "server.port"; + +/** + * The string ID of the service instance. + * + *

Notes: +

+ */ +static constexpr const char *kServiceInstanceId = "service.instance.id"; + +/** + * Logical name of the service. + * + *

Notes: +

+ */ +static constexpr const char *kServiceName = "service.name"; + +/** + * A namespace for {@code service.name}. + * + *

Notes: +

+ */ +static constexpr const char *kServiceNamespace = "service.namespace"; /** - * A string identifying the remoting system. See below for a list of well-known identifiers. + * The version string of the service API or implementation. The format is not defined by these + * conventions. */ -static constexpr const char *kRpcSystem = "rpc.system"; +static constexpr const char *kServiceVersion = "service.version"; /** - * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain - socket name. - * - *

Notes: -

+ * A unique id to identify a session. */ -static constexpr const char *kServerAddress = "server.address"; +static constexpr const char *kSessionId = "session.id"; /** - * Server port number. - * - *

Notes: -

+ * The previous {@code session.id} for this user, when known. */ -static constexpr const char *kServerPort = "server.port"; +static constexpr const char *kSessionPreviousId = "session.previous_id"; /** * Source address - domain name if available without reverse DNS lookup; otherwise, IP address or @@ -1280,6 +2398,45 @@ static constexpr const char *kSourceAddress = "source.address"; */ static constexpr const char *kSourcePort = "source.port"; +/** + * The language of the telemetry SDK. + */ +static constexpr const char *kTelemetrySdkLanguage = "telemetry.sdk.language"; + +/** + * The name of the telemetry SDK as defined above. + * + *

Notes: +

+ */ +static constexpr const char *kTelemetrySdkName = "telemetry.sdk.name"; + +/** + * The version string of the telemetry SDK. + */ +static constexpr const char *kTelemetrySdkVersion = "telemetry.sdk.version"; + +/** + * The name of the auto instrumentation agent or distribution, if used. + * + *

Notes: +

+ */ +static constexpr const char *kTelemetryDistroName = "telemetry.distro.name"; + +/** + * The version string of the auto instrumentation agent or distribution, if used. + */ +static constexpr const char *kTelemetryDistroVersion = "telemetry.distro.version"; + /** * Current "managed" thread ID (as opposed to OS thread ID). */ @@ -1445,349 +2602,215 @@ static constexpr const char *kTlsServerHashSha1 = "tls.server.hash.sha1"; * uppercase hash. */ static constexpr const char *kTlsServerHashSha256 = "tls.server.hash.sha256"; - -/** - * Distinguished name of subject of the issuer of - * the x.509 certificate presented by the client. - */ -static constexpr const char *kTlsServerIssuer = "tls.server.issuer"; - -/** - * A hash that identifies servers based on how they perform an SSL/TLS handshake. - */ -static constexpr const char *kTlsServerJa3s = "tls.server.ja3s"; - -/** - * Date/Time indicating when server certificate is no longer considered valid. - */ -static constexpr const char *kTlsServerNotAfter = "tls.server.not_after"; - -/** - * Date/Time indicating when server certificate is first considered valid. - */ -static constexpr const char *kTlsServerNotBefore = "tls.server.not_before"; - -/** - * Distinguished name of subject of the x.509 certificate presented by the server. - */ -static constexpr const char *kTlsServerSubject = "tls.server.subject"; - -/** - * The URI fragment component - */ -static constexpr const char *kUrlFragment = "url.fragment"; - -/** - * Absolute URL describing a network resource according to RFC3986 - * - *

Notes: -

- */ -static constexpr const char *kUrlFull = "url.full"; - -/** - * The URI path component - */ -static constexpr const char *kUrlPath = "url.path"; - -/** - * The URI query component - * - *

Notes: -

- */ -static constexpr const char *kUrlQuery = "url.query"; - -/** - * The URI scheme component - * identifying the used protocol. - */ -static constexpr const char *kUrlScheme = "url.scheme"; - -/** - * Value of the HTTP - * User-Agent header sent by the client. - */ -static constexpr const char *kUserAgentOriginal = "user_agent.original"; - -/** - * A unique id to identify a session. - */ -static constexpr const char *kSessionId = "session.id"; - -/** - * The previous {@code session.id} for this user, when known. - */ -static constexpr const char *kSessionPreviousId = "session.previous_id"; - -/** - * 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} applicable). - * - *

Notes: -

- */ -static constexpr const char *kAwsLambdaInvokedArn = "aws.lambda.invoked_arn"; - -/** - * The event_id - * uniquely identifies the event. - */ -static constexpr const char *kCloudeventsEventId = "cloudevents.event_id"; - -/** - * The source - * identifies the context in which an event happened. - */ -static constexpr const char *kCloudeventsEventSource = "cloudevents.event_source"; - -/** - * The version of - * the CloudEvents specification which the event uses. - */ -static constexpr const char *kCloudeventsEventSpecVersion = "cloudevents.event_spec_version"; - -/** - * The subject of - * the event in the context of the event producer (identified by source). - */ -static constexpr const char *kCloudeventsEventSubject = "cloudevents.event_subject"; - -/** - * The event_type - * contains a value describing the type of event related to the originating occurrence. - */ -static constexpr const char *kCloudeventsEventType = "cloudevents.event_type"; - -/** - * Parent-child Reference type - * - *

Notes: -

- */ -static constexpr const char *kOpentracingRefType = "opentracing.ref_type"; - -/** - * Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code - * is UNSET. - */ -static constexpr const char *kOtelStatusCode = "otel.status_code"; - -/** - * Description of the Status if it has a value, otherwise not set. - */ -static constexpr const char *kOtelStatusDescription = "otel.status_description"; - -/** - * The invocation ID of the current function invocation. - */ -static constexpr const char *kFaasInvocationId = "faas.invocation_id"; - -/** - * The name of the source on which the triggering operation was performed. For example, in Cloud - * Storage or S3 corresponds to the bucket name, and in Cosmos DB to the database name. - */ -static constexpr const char *kFaasDocumentCollection = "faas.document.collection"; - -/** - * The document name/table subjected to the operation. For example, in Cloud Storage or S3 is the - * name of the file, and in Cosmos DB the table name. - */ -static constexpr const char *kFaasDocumentName = "faas.document.name"; - -/** - * Describes the type of the operation that was performed on the data. - */ -static constexpr const char *kFaasDocumentOperation = "faas.document.operation"; - -/** - * A string containing the time when the data was accessed in the ISO 8601 format expressed in UTC. - */ -static constexpr const char *kFaasDocumentTime = "faas.document.time"; - -/** - * A string containing the schedule period as Cron - * Expression. - */ -static constexpr const char *kFaasCron = "faas.cron"; - -/** - * A string containing the function invocation time in the ISO 8601 format expressed in UTC. - */ -static constexpr const char *kFaasTime = "faas.time"; - -/** - * A boolean that is true if the serverless function is executed for the first time (aka - * cold-start). - */ -static constexpr const char *kFaasColdstart = "faas.coldstart"; - -/** - * The unique identifier of the feature flag. - */ -static constexpr const char *kFeatureFlagKey = "feature_flag.key"; - -/** - * The name of the service provider that performs the flag evaluation. - */ -static constexpr const char *kFeatureFlagProviderName = "feature_flag.provider_name"; - -/** - * SHOULD be a semantic identifier for a value. If one is unavailable, a stringified version of the -value can be used. - * - *

Notes: -

+ +/** + * Distinguished name of subject of the issuer of + * the x.509 certificate presented by the client. */ -static constexpr const char *kFeatureFlagVariant = "feature_flag.variant"; +static constexpr const char *kTlsServerIssuer = "tls.server.issuer"; /** - * The AWS request ID as returned in the response headers {@code x-amz-request-id} or {@code - * x-amz-requestid}. + * A hash that identifies servers based on how they perform an SSL/TLS handshake. */ -static constexpr const char *kAwsRequestId = "aws.request_id"; +static constexpr const char *kTlsServerJa3s = "tls.server.ja3s"; /** - * The value of the {@code AttributesToGet} request parameter. + * Date/Time indicating when server certificate is no longer considered valid. */ -static constexpr const char *kAwsDynamodbAttributesToGet = "aws.dynamodb.attributes_to_get"; +static constexpr const char *kTlsServerNotAfter = "tls.server.not_after"; /** - * The value of the {@code ConsistentRead} request parameter. + * Date/Time indicating when server certificate is first considered valid. */ -static constexpr const char *kAwsDynamodbConsistentRead = "aws.dynamodb.consistent_read"; +static constexpr const char *kTlsServerNotBefore = "tls.server.not_before"; /** - * The JSON-serialized value of each item in the {@code ConsumedCapacity} response field. + * Distinguished name of subject of the x.509 certificate presented by the server. */ -static constexpr const char *kAwsDynamodbConsumedCapacity = "aws.dynamodb.consumed_capacity"; +static constexpr const char *kTlsServerSubject = "tls.server.subject"; /** - * The value of the {@code IndexName} request parameter. + * Domain extracted from the {@code url.full}, such as "opentelemetry.io". + * + *

Notes: +

*/ -static constexpr const char *kAwsDynamodbIndexName = "aws.dynamodb.index_name"; +static constexpr const char *kUrlDomain = "url.domain"; /** - * The JSON-serialized value of the {@code ItemCollectionMetrics} response field. + * The file extension extracted from the {@code url.full}, excluding the leading dot. + * + *

Notes: +

*/ -static constexpr const char *kAwsDynamodbItemCollectionMetrics = - "aws.dynamodb.item_collection_metrics"; +static constexpr const char *kUrlExtension = "url.extension"; /** - * The value of the {@code Limit} request parameter. + * The URI fragment component */ -static constexpr const char *kAwsDynamodbLimit = "aws.dynamodb.limit"; +static constexpr const char *kUrlFragment = "url.fragment"; /** - * The value of the {@code ProjectionExpression} request parameter. + * Absolute URL describing a network resource according to RFC3986 + * + *

Notes: +

*/ -static constexpr const char *kAwsDynamodbProjection = "aws.dynamodb.projection"; +static constexpr const char *kUrlFull = "url.full"; /** - * The value of the {@code ProvisionedThroughput.ReadCapacityUnits} request parameter. + * Unmodified original URL as seen in the event source. + * + *

Notes: +

*/ -static constexpr const char *kAwsDynamodbProvisionedReadCapacity = - "aws.dynamodb.provisioned_read_capacity"; +static constexpr const char *kUrlOriginal = "url.original"; /** - * The value of the {@code ProvisionedThroughput.WriteCapacityUnits} request parameter. + * The URI path component + * + *

Notes: +

*/ -static constexpr const char *kAwsDynamodbProvisionedWriteCapacity = - "aws.dynamodb.provisioned_write_capacity"; +static constexpr const char *kUrlPath = "url.path"; /** - * The value of the {@code Select} request parameter. + * Port extracted from the {@code url.full} */ -static constexpr const char *kAwsDynamodbSelect = "aws.dynamodb.select"; +static constexpr const char *kUrlPort = "url.port"; /** - * The keys in the {@code RequestItems} object field. + * The URI query component + * + *

Notes: +

*/ -static constexpr const char *kAwsDynamodbTableNames = "aws.dynamodb.table_names"; +static constexpr const char *kUrlQuery = "url.query"; /** - * The JSON-serialized value of each item of the {@code GlobalSecondaryIndexes} request field + * The highest registered url domain, stripped of the subdomain. + * + *

Notes: +

*/ -static constexpr const char *kAwsDynamodbGlobalSecondaryIndexes = - "aws.dynamodb.global_secondary_indexes"; +static constexpr const char *kUrlRegisteredDomain = "url.registered_domain"; /** - * The JSON-serialized value of each item of the {@code LocalSecondaryIndexes} request field. + * The URI scheme component + * identifying the used protocol. */ -static constexpr const char *kAwsDynamodbLocalSecondaryIndexes = - "aws.dynamodb.local_secondary_indexes"; +static constexpr const char *kUrlScheme = "url.scheme"; /** - * The value of the {@code ExclusiveStartTableName} request parameter. + * The subdomain portion of a fully qualified domain name includes all of the names except the host + name under the registered_domain. In a partially qualified domain, or if the qualification level of + the full name cannot be determined, subdomain contains all of the names below the registered + domain. + * + *

Notes: +

*/ -static constexpr const char *kAwsDynamodbExclusiveStartTable = "aws.dynamodb.exclusive_start_table"; +static constexpr const char *kUrlSubdomain = "url.subdomain"; /** - * The the number of items in the {@code TableNames} response parameter. + * The effective top level domain (eTLD), also known as the domain suffix, is the last part of the + domain name. For example, the top level domain for example.com is {@code com}. + * + *

Notes: +

*/ -static constexpr const char *kAwsDynamodbTableCount = "aws.dynamodb.table_count"; +static constexpr const char *kUrlTopLevelDomain = "url.top_level_domain"; /** - * The value of the {@code ScanIndexForward} request parameter. + * Name of the user-agent extracted from original. Usually refers to the browser's name. + * + *

Notes: +

*/ -static constexpr const char *kAwsDynamodbScanForward = "aws.dynamodb.scan_forward"; +static constexpr const char *kUserAgentName = "user_agent.name"; /** - * The value of the {@code Count} response parameter. + * Value of the HTTP + * User-Agent header sent by the client. */ -static constexpr const char *kAwsDynamodbCount = "aws.dynamodb.count"; +static constexpr const char *kUserAgentOriginal = "user_agent.original"; /** - * The value of the {@code ScannedCount} response parameter. + * Version of the user-agent extracted from original. Usually refers to the browser's version + * + *

Notes: +

*/ -static constexpr const char *kAwsDynamodbScannedCount = "aws.dynamodb.scanned_count"; +static constexpr const char *kUserAgentVersion = "user_agent.version"; /** - * The value of the {@code Segment} request parameter. + * 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} applicable). + * + *

Notes: +

*/ -static constexpr const char *kAwsDynamodbSegment = "aws.dynamodb.segment"; +static constexpr const char *kAwsLambdaInvokedArn = "aws.lambda.invoked_arn"; /** - * The value of the {@code TotalSegments} request parameter. + * Parent-child Reference type + * + *

Notes: +

*/ -static constexpr const char *kAwsDynamodbTotalSegments = "aws.dynamodb.total_segments"; +static constexpr const char *kOpentracingRefType = "opentracing.ref_type"; /** - * The JSON-serialized value of each item in the {@code AttributeDefinitions} request field. + * Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code + * is UNSET. */ -static constexpr const char *kAwsDynamodbAttributeDefinitions = - "aws.dynamodb.attribute_definitions"; +static constexpr const char *kOtelStatusCode = "otel.status_code"; /** - * The JSON-serialized value of each item in the the {@code GlobalSecondaryIndexUpdates} request - * field. + * Description of the Status if it has a value, otherwise not set. */ -static constexpr const char *kAwsDynamodbGlobalSecondaryIndexUpdates = - "aws.dynamodb.global_secondary_index_updates"; +static constexpr const char *kOtelStatusDescription = "otel.status_description"; + +/** + * The AWS request ID as returned in the response headers {@code x-amz-request-id} or {@code + * x-amz-requestid}. + */ +static constexpr const char *kAwsRequestId = "aws.request_id"; /** * The S3 bucket name the request refers to. Corresponds to the {@code --bucket} parameter of the StartSpan( span_name, - {{SemanticConventions::kRpcSystem, "grpc"}, - {SemanticConventions::kRpcService, "grpc-example.GreetService"}, - {SemanticConventions::kRpcMethod, "Greet"}, - {SemanticConventions::kNetworkPeerAddress, ip}, - {SemanticConventions::kNetworkPeerPort, port}}, + {{opentelemetry::trace::SemanticConventions::kRpcSystem, "grpc"}, + {opentelemetry::trace::SemanticConventions::kRpcService, "grpc-example.GreetService"}, + {opentelemetry::trace::SemanticConventions::kRpcMethod, "Greet"}, + {opentelemetry::trace::SemanticConventions::kNetworkPeerAddress, ip}, + {opentelemetry::trace::SemanticConventions::kNetworkPeerPort, port}}, options); auto scope = get_tracer("grpc-client")->WithActiveSpan(span); @@ -70,7 +70,8 @@ class GreeterClient if (status.ok()) { span->SetStatus(StatusCode::kOk); - span->SetAttribute(SemanticConventions::kRpcGrpcStatusCode, status.error_code()); + span->SetAttribute(opentelemetry::trace::SemanticConventions::kRpcGrpcStatusCode, + status.error_code()); // Make sure to end your spans! span->End(); return response.response(); @@ -79,7 +80,8 @@ class GreeterClient { std::cout << status.error_code() << ": " << status.error_message() << std::endl; span->SetStatus(StatusCode::kError); - span->SetAttribute(SemanticConventions::kRpcGrpcStatusCode, status.error_code()); + span->SetAttribute(opentelemetry::trace::SemanticConventions::kRpcGrpcStatusCode, + status.error_code()); // Make sure to end your spans! span->End(); return "RPC failed"; diff --git a/examples/grpc/server.cc b/examples/grpc/server.cc index 6ba96a009e..5aeb506499 100644 --- a/examples/grpc/server.cc +++ b/examples/grpc/server.cc @@ -67,13 +67,14 @@ class GreeterServer final : public Greeter::Service options.parent = GetSpan(new_context)->GetContext(); std::string span_name = "GreeterService/Greet"; - auto span = get_tracer("grpc")->StartSpan(span_name, - {{SemanticConventions::kRpcSystem, "grpc"}, - {SemanticConventions::kRpcService, "GreeterService"}, - {SemanticConventions::kRpcMethod, "Greet"}, - {SemanticConventions::kRpcGrpcStatusCode, 0}}, - options); - auto scope = get_tracer("grpc")->WithActiveSpan(span); + auto span = get_tracer("grpc")->StartSpan( + span_name, + {{opentelemetry::trace::SemanticConventions::kRpcSystem, "grpc"}, + {opentelemetry::trace::SemanticConventions::kRpcService, "GreeterService"}, + {opentelemetry::trace::SemanticConventions::kRpcMethod, "Greet"}, + {opentelemetry::trace::SemanticConventions::kRpcGrpcStatusCode, 0}}, + options); + auto scope = get_tracer("grpc")->WithActiveSpan(span); // Fetch and parse whatever HTTP headers we can from the gRPC request. span->AddEvent("Processing client attributes"); diff --git a/examples/http/client.cc b/examples/http/client.cc index 3a8486f55f..cd1835ea55 100644 --- a/examples/http/client.cc +++ b/examples/http/client.cc @@ -24,12 +24,13 @@ void sendRequest(const std::string &url) opentelemetry::ext::http::common::UrlParser url_parser(url); std::string span_name = url_parser.path_; - auto span = get_tracer("http-client") - ->StartSpan(span_name, - {{SemanticConventions::kUrlFull, url_parser.url_}, - {SemanticConventions::kUrlScheme, url_parser.scheme_}, - {SemanticConventions::kHttpRequestMethod, "GET"}}, - options); + auto span = + get_tracer("http-client") + ->StartSpan(span_name, + {{opentelemetry::trace::SemanticConventions::kUrlFull, url_parser.url_}, + {opentelemetry::trace::SemanticConventions::kUrlScheme, url_parser.scheme_}, + {opentelemetry::trace::SemanticConventions::kHttpRequestMethod, "GET"}}, + options); auto scope = get_tracer("http-client")->WithActiveSpan(span); // inject current context into http header @@ -44,7 +45,8 @@ void sendRequest(const std::string &url) { // set span attributes auto status_code = result.GetResponse().GetStatusCode(); - span->SetAttribute(SemanticConventions::kHttpResponseStatusCode, status_code); + span->SetAttribute(opentelemetry::trace::SemanticConventions::kHttpResponseStatusCode, + status_code); result.GetResponse().ForEachHeader( [&span](nostd::string_view header_name, nostd::string_view header_value) { span->SetAttribute("http.header." + std::string(header_name.data()), header_value); diff --git a/examples/http/server.cc b/examples/http/server.cc index 3dbdae8512..d4ae1b4485 100644 --- a/examples/http/server.cc +++ b/examples/http/server.cc @@ -38,16 +38,18 @@ class RequestHandler : public HTTP_SERVER_NS::HttpRequestCallback options.parent = GetSpan(new_context)->GetContext(); // start span with parent context extracted from http header - auto span = get_tracer("http-server") - ->StartSpan(span_name, - {{SemanticConventions::kServerAddress, server_name}, - {SemanticConventions::kServerPort, server_port}, - {SemanticConventions::kHttpRequestMethod, request.method}, - {SemanticConventions::kUrlScheme, "http"}, - {SemanticConventions::kHttpRequestBodySize, - static_cast(request.content.length())}, - {SemanticConventions::kClientAddress, request.client}}, - options); + auto span = + get_tracer("http-server") + ->StartSpan( + span_name, + {{opentelemetry::trace::SemanticConventions::kServerAddress, server_name}, + {opentelemetry::trace::SemanticConventions::kServerPort, server_port}, + {opentelemetry::trace::SemanticConventions::kHttpRequestMethod, request.method}, + {opentelemetry::trace::SemanticConventions::kUrlScheme, "http"}, + {opentelemetry::trace::SemanticConventions::kHttpRequestBodySize, + static_cast(request.content.length())}, + {opentelemetry::trace::SemanticConventions::kClientAddress, request.client}}, + options); auto scope = get_tracer("http_server")->WithActiveSpan(span); diff --git a/exporters/zipkin/src/recordable.cc b/exporters/zipkin/src/recordable.cc index ed43cb8a2d..265163fccb 100644 --- a/exporters/zipkin/src/recordable.cc +++ b/exporters/zipkin/src/recordable.cc @@ -4,6 +4,7 @@ #include "opentelemetry/exporters/zipkin/recordable.h" #include "opentelemetry/sdk/resource/resource.h" #include "opentelemetry/sdk/resource/semantic_conventions.h" +#include "opentelemetry/trace/semantic_conventions.h" #include #include @@ -223,9 +224,9 @@ void Recordable::SetResource(const sdk::resource::Resource &resource) noexcept { // only service.name attribute is supported by specs as of now. auto attributes = resource.GetAttributes(); - if (attributes.find(SemanticConventions::kServiceName) != attributes.end()) + if (attributes.find(trace::SemanticConventions::kServiceName) != attributes.end()) { - service_name_ = nostd::get(attributes[SemanticConventions::kServiceName]); + service_name_ = nostd::get(attributes[trace::SemanticConventions::kServiceName]); } } diff --git a/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h b/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h index add4b9bed7..878def15d1 100644 --- a/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h +++ b/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h @@ -24,585 +24,12 @@ namespace SemanticConventions /** * The URL of the OpenTelemetry schema for these keys and values. */ -static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.24.0"; +static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.25.0"; /** - * The cloud account ID the resource is assigned to. + * The ID of a running ECS task. The ID MUST be extracted from {@code task.arn}. */ -static constexpr const char *kCloudAccountId = "cloud.account.id"; - -/** - * Cloud regions often have multiple, isolated locations known as zones to increase availability. - Availability zone represents the zone where the resource is running. - * - *

Notes: -

  • Availability zones are called "zones" on Alibaba Cloud and Google Cloud.
  • -
- */ -static constexpr const char *kCloudAvailabilityZone = "cloud.availability_zone"; - -/** - * The cloud platform in use. - * - *

Notes: -

  • The prefix of the service SHOULD match the one specified in {@code cloud.provider}.
  • -
- */ -static constexpr const char *kCloudPlatform = "cloud.platform"; - -/** - * Name of the cloud provider. - */ -static constexpr const char *kCloudProvider = "cloud.provider"; - -/** - * The geographical region the resource is running. - * - *

Notes: -

- */ -static constexpr const char *kCloudRegion = "cloud.region"; - -/** - * Cloud provider-specific native identifier of the monitored cloud resource (e.g. an ARN on AWS, a -fully qualified -resource ID on Azure, a full resource name -on GCP) - * - *

Notes: -

- */ -static constexpr const char *kCloudResourceId = "cloud.resource_id"; - -/** - * The command used to run the container (i.e. the command name). - * - *

Notes: -

- */ -static constexpr const char *kContainerCommand = "container.command"; - -/** - * All the command arguments (including the command/executable itself) run by the container. [2] - */ -static constexpr const char *kContainerCommandArgs = "container.command_args"; - -/** - * The full command run by the container as a single string representing the full command. [2] - */ -static constexpr const char *kContainerCommandLine = "container.command_line"; - -/** - * Container ID. Usually a UUID, as for example used to identify Docker - * containers. The UUID might be abbreviated. - */ -static constexpr const char *kContainerId = "container.id"; - -/** - * Runtime specific image identifier. Usually a hash algorithm followed by a UUID. - * - *

Notes: -

- */ -static constexpr const char *kContainerImageId = "container.image.id"; - -/** - * Name of the image the container was built on. - */ -static constexpr const char *kContainerImageName = "container.image.name"; - -/** - * Repo digests of the container image as provided by the container runtime. - * - *

Notes: -

- */ -static constexpr const char *kContainerImageRepoDigests = "container.image.repo_digests"; - -/** - * Container image tags. An example can be found in Docker Image - * Inspect. Should be only the {@code } section of the full name for example from {@code - * registry.example.com/my-org/my-image:}. - */ -static constexpr const char *kContainerImageTags = "container.image.tags"; - -/** - * Container name used by container runtime. - */ -static constexpr const char *kContainerName = "container.name"; - -/** - * The container runtime managing this container. - */ -static constexpr const char *kContainerRuntime = "container.runtime"; - -/** - * A unique identifier representing the device - * - *

Notes: -

- */ -static constexpr const char *kDeviceId = "device.id"; - -/** - * The name of the device manufacturer - * - *

Notes: -

- */ -static constexpr const char *kDeviceManufacturer = "device.manufacturer"; - -/** - * The model identifier for the device - * - *

Notes: -

- */ -static constexpr const char *kDeviceModelIdentifier = "device.model.identifier"; - -/** - * The marketing name for the device model - * - *

Notes: -

- */ -static constexpr const char *kDeviceModelName = "device.model.name"; - -/** - * The CPU architecture the host system is running on. - */ -static constexpr const char *kHostArch = "host.arch"; - -/** - * The amount of level 2 memory cache available to the processor (in Bytes). - */ -static constexpr const char *kHostCpuCacheL2Size = "host.cpu.cache.l2.size"; - -/** - * Family or generation of the CPU. - */ -static constexpr const char *kHostCpuFamily = "host.cpu.family"; - -/** - * Model identifier. It provides more granular information about the CPU, distinguishing it from - * other CPUs within the same family. - */ -static constexpr const char *kHostCpuModelId = "host.cpu.model.id"; - -/** - * Model designation of the processor. - */ -static constexpr const char *kHostCpuModelName = "host.cpu.model.name"; - -/** - * Stepping or core revisions. - */ -static constexpr const char *kHostCpuStepping = "host.cpu.stepping"; - -/** - * Processor manufacturer identifier. A maximum 12-character string. - * - *

Notes: -

- */ -static constexpr const char *kHostCpuVendorId = "host.cpu.vendor.id"; - -/** - * Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For - * non-containerized systems, this should be the {@code machine-id}. See the table below for the - * sources to use to determine the {@code machine-id} based on operating system. - */ -static constexpr const char *kHostId = "host.id"; - -/** - * VM image ID or host OS image ID. For Cloud, this value is from the provider. - */ -static constexpr const char *kHostImageId = "host.image.id"; - -/** - * Name of the VM image or OS install the host was instantiated from. - */ -static constexpr const char *kHostImageName = "host.image.name"; - -/** - * The version string of the VM image or host OS as defined in Version Attributes. - */ -static constexpr const char *kHostImageVersion = "host.image.version"; - -/** - * Available IP addresses of the host, excluding loopback interfaces. - * - *

Notes: -

- */ -static constexpr const char *kHostIp = "host.ip"; - -/** - * Available MAC addresses of the host, excluding loopback interfaces. - * - *

Notes: -

- */ -static constexpr const char *kHostMac = "host.mac"; - -/** - * Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully - * qualified hostname, or another name specified by the user. - */ -static constexpr const char *kHostName = "host.name"; - -/** - * Type of host. For Cloud, this must be the machine type. - */ -static constexpr const char *kHostType = "host.type"; - -/** - * The name of the cluster. - */ -static constexpr const char *kK8sClusterName = "k8s.cluster.name"; - -/** - * A pseudo-ID for the cluster, set to the UID of the {@code kube-system} namespace. - * - *

Notes: -

- */ -static constexpr const char *kK8sClusterUid = "k8s.cluster.uid"; - -/** - * 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}). - */ -static constexpr const char *kK8sContainerName = "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. - */ -static constexpr const char *kK8sContainerRestartCount = "k8s.container.restart_count"; - -/** - * The name of the CronJob. - */ -static constexpr const char *kK8sCronjobName = "k8s.cronjob.name"; - -/** - * The UID of the CronJob. - */ -static constexpr const char *kK8sCronjobUid = "k8s.cronjob.uid"; - -/** - * The name of the DaemonSet. - */ -static constexpr const char *kK8sDaemonsetName = "k8s.daemonset.name"; - -/** - * The UID of the DaemonSet. - */ -static constexpr const char *kK8sDaemonsetUid = "k8s.daemonset.uid"; - -/** - * The name of the Deployment. - */ -static constexpr const char *kK8sDeploymentName = "k8s.deployment.name"; - -/** - * The UID of the Deployment. - */ -static constexpr const char *kK8sDeploymentUid = "k8s.deployment.uid"; - -/** - * The name of the Job. - */ -static constexpr const char *kK8sJobName = "k8s.job.name"; - -/** - * The UID of the Job. - */ -static constexpr const char *kK8sJobUid = "k8s.job.uid"; - -/** - * The name of the namespace that the pod is running in. - */ -static constexpr const char *kK8sNamespaceName = "k8s.namespace.name"; - -/** - * The name of the Node. - */ -static constexpr const char *kK8sNodeName = "k8s.node.name"; - -/** - * The UID of the Node. - */ -static constexpr const char *kK8sNodeUid = "k8s.node.uid"; - -/** - * The name of the Pod. - */ -static constexpr const char *kK8sPodName = "k8s.pod.name"; - -/** - * The UID of the Pod. - */ -static constexpr const char *kK8sPodUid = "k8s.pod.uid"; - -/** - * The name of the ReplicaSet. - */ -static constexpr const char *kK8sReplicasetName = "k8s.replicaset.name"; - -/** - * The UID of the ReplicaSet. - */ -static constexpr const char *kK8sReplicasetUid = "k8s.replicaset.uid"; - -/** - * The name of the StatefulSet. - */ -static constexpr const char *kK8sStatefulsetName = "k8s.statefulset.name"; - -/** - * The UID of the StatefulSet. - */ -static constexpr const char *kK8sStatefulsetUid = "k8s.statefulset.uid"; - -/** - * The digest of the OCI image manifest. For container images specifically is the digest by which -the container image is known. - * - *

Notes: -

- */ -static constexpr const char *kOciManifestDigest = "oci.manifest.digest"; - -/** - * Unique identifier for a particular build or compilation of the operating system. - */ -static constexpr const char *kOsBuildId = "os.build_id"; - -/** - * Human readable (not intended to be parsed) OS version information, like e.g. reported by {@code - * ver} or {@code lsb_release -a} commands. - */ -static constexpr const char *kOsDescription = "os.description"; - -/** - * Human readable operating system name. - */ -static constexpr const char *kOsName = "os.name"; - -/** - * The operating system type. - */ -static constexpr const char *kOsType = "os.type"; - -/** - * The version string of the operating system as defined in Version Attributes. - */ -static constexpr const char *kOsVersion = "os.version"; - -/** - * The command used to launch the process (i.e. the command name). On Linux based systems, can be - * set to the zeroth string in {@code proc/[pid]/cmdline}. On Windows, can be set to the first - * parameter extracted from {@code GetCommandLineW}. - */ -static constexpr const char *kProcessCommand = "process.command"; - -/** - * All the command arguments (including the command/executable itself) as received by the process. - * On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according - * to the list of null-delimited strings extracted from {@code proc/[pid]/cmdline}. For libc-based - * executables, this would be the full argv vector passed to {@code main}. - */ -static constexpr const char *kProcessCommandArgs = "process.command_args"; - -/** - * The full command used to launch the process as a single string representing the full command. On - * Windows, can be set to the result of {@code GetCommandLineW}. Do not set this if you have to - * assemble it just for monitoring; use {@code process.command_args} instead. - */ -static constexpr const char *kProcessCommandLine = "process.command_line"; - -/** - * The name of the process executable. On Linux based systems, can be set to the {@code Name} in - * {@code proc/[pid]/status}. On Windows, can be set to the base name of {@code - * GetProcessImageFileNameW}. - */ -static constexpr const char *kProcessExecutableName = "process.executable.name"; - -/** - * The full path to the process executable. On Linux based systems, can be set to the target of - * {@code proc/[pid]/exe}. On Windows, can be set to the result of {@code GetProcessImageFileNameW}. - */ -static constexpr const char *kProcessExecutablePath = "process.executable.path"; - -/** - * The username of the user that owns the process. - */ -static constexpr const char *kProcessOwner = "process.owner"; - -/** - * Parent Process identifier (PPID). - */ -static constexpr const char *kProcessParentPid = "process.parent_pid"; - -/** - * Process identifier (PID). - */ -static constexpr const char *kProcessPid = "process.pid"; - -/** - * An additional description about the runtime of the process, for example a specific vendor - * customization of the runtime environment. - */ -static constexpr const char *kProcessRuntimeDescription = "process.runtime.description"; - -/** - * The name of the runtime of this process. For compiled native binaries, this SHOULD be the name of - * the compiler. - */ -static constexpr const char *kProcessRuntimeName = "process.runtime.name"; - -/** - * The version of the runtime of this process, as returned by the runtime without modification. - */ -static constexpr const char *kProcessRuntimeVersion = "process.runtime.version"; - -/** - * Uniquely identifies the framework API revision offered by a version ({@code os.version}) of the - * android operating system. More information can be found here. - */ -static constexpr const char *kAndroidOsApiLevel = "android.os.api_level"; - -/** - * Array of brand name and version separated by a space - * - *

Notes: -

- */ -static constexpr const char *kBrowserBrands = "browser.brands"; - -/** - * Preferred language of the user using the browser - * - *

Notes: -

- */ -static constexpr const char *kBrowserLanguage = "browser.language"; - -/** - * A boolean that is true if the browser is running on a mobile device - * - *

Notes: -

- */ -static constexpr const char *kBrowserMobile = "browser.mobile"; - -/** - * The platform on which the browser is running - * - *

Notes: -

- */ -static constexpr const char *kBrowserPlatform = "browser.platform"; +static constexpr const char *kAwsEcsTaskId = "aws.ecs.task.id"; /** * The ARN of an ECS task - * definition. + * The ARN of a running ECS + * task. */ static constexpr const char *kAwsEcsTaskArn = "aws.ecs.task.arn"; /** - * The task definition family this task definition is a member of. + * The family name of the ECS task + * definition used to create the ECS task. */ static constexpr const char *kAwsEcsTaskFamily = "aws.ecs.task.family"; /** - * The revision for this task definition. + * The revision for the task definition used to create the ECS task. */ static constexpr const char *kAwsEcsTaskRevision = "aws.ecs.task.revision"; @@ -681,37 +110,6 @@ static constexpr const char *kAwsLogStreamArns = "aws.log.stream.arns"; */ static constexpr const char *kAwsLogStreamNames = "aws.log.stream.names"; -/** - * The name of the Cloud Run execution being run for the - * Job, as set by the {@code - * CLOUD_RUN_EXECUTION} environment variable. - */ -static constexpr const char *kGcpCloudRunJobExecution = "gcp.cloud_run.job.execution"; - -/** - * The index for a task within an execution as provided by the {@code - * CLOUD_RUN_TASK_INDEX} environment variable. - */ -static constexpr const char *kGcpCloudRunJobTaskIndex = "gcp.cloud_run.job.task_index"; - -/** - * The hostname of a GCE instance. This is the full value of the default or custom hostname. - */ -static constexpr const char *kGcpGceInstanceHostname = "gcp.gce.instance.hostname"; - -/** - * The instance name of a GCE instance. This is the value provided by {@code host.name}, the visible - * name of the instance in the Cloud Console UI, and the prefix for the default hostname of the - * instance as defined by the default - * internal DNS name. - */ -static constexpr const char *kGcpGceInstanceName = "gcp.gce.instance.name"; - /** * Unique identifier for the application */ @@ -728,174 +126,15 @@ static constexpr const char *kHerokuReleaseCommit = "heroku.release.commit"; static constexpr const char *kHerokuReleaseCreationTimestamp = "heroku.release.creation_timestamp"; /** - * Name of the deployment -environment (aka deployment tier). - * - *

Notes: -

- */ -static constexpr const char *kDeploymentEnvironment = "deployment.environment"; - -/** - * The execution environment ID as a string, that will be potentially reused for other invocations - to the same function/function version. - * - *

Notes: -

- */ -static constexpr const char *kFaasInstance = "faas.instance"; - -/** - * The amount of memory available to the serverless function converted to Bytes. - * - *

Notes: -

- */ -static constexpr const char *kFaasMaxMemory = "faas.max_memory"; - -/** - * The name of the single function that this runtime instance executes. - * - *

Notes: -

- */ -static constexpr const char *kFaasName = "faas.name"; - -/** - * The immutable version of the function being executed. - * - *

Notes: -

- */ -static constexpr const char *kFaasVersion = "faas.version"; - -/** - * Logical name of the service. - * - *

Notes: -

- */ -static constexpr const char *kServiceName = "service.name"; - -/** - * The version string of the service API or implementation. The format is not defined by these - * conventions. - */ -static constexpr const char *kServiceVersion = "service.version"; - -/** - * The string ID of the service instance. - * - *

Notes: -

- */ -static constexpr const char *kServiceInstanceId = "service.instance.id"; - -/** - * A namespace for {@code service.name}. - * - *

Notes: -

- */ -static constexpr const char *kServiceNamespace = "service.namespace"; - -/** - * The language of the telemetry SDK. - */ -static constexpr const char *kTelemetrySdkLanguage = "telemetry.sdk.language"; - -/** - * The name of the telemetry SDK as defined above. - * - *

Notes: -

- */ -static constexpr const char *kTelemetrySdkName = "telemetry.sdk.name"; - -/** - * The version string of the telemetry SDK. - */ -static constexpr const char *kTelemetrySdkVersion = "telemetry.sdk.version"; - -/** - * The name of the auto instrumentation agent or distribution, if used. - * - *

Notes: -

- */ -static constexpr const char *kTelemetryDistroName = "telemetry.distro.name"; - -/** - * The version string of the auto instrumentation agent or distribution, if used. + * The name of the web engine. */ -static constexpr const char *kTelemetryDistroVersion = "telemetry.distro.version"; +static constexpr const char *kWebengineName = "webengine.name"; /** * Additional description of the web engine (e.g. detailed version and edition information). */ static constexpr const char *kWebengineDescription = "webengine.description"; -/** - * The name of the web engine. - */ -static constexpr const char *kWebengineName = "webengine.name"; - /** * The version of the web engine. */ @@ -912,138 +151,22 @@ static constexpr const char *kOtelScopeName = "otel.scope.name"; static constexpr const char *kOtelScopeVersion = "otel.scope.version"; /** - * Deprecated, use the {@code otel.scope.name} attribute. + * None + * + * @deprecated None. */ +OPENTELEMETRY_DEPRECATED static constexpr const char *kOtelLibraryName = "otel.library.name"; /** - * Deprecated, use the {@code otel.scope.version} attribute. + * None + * + * @deprecated None. */ +OPENTELEMETRY_DEPRECATED static constexpr const char *kOtelLibraryVersion = "otel.library.version"; // Enum definitions -namespace CloudPlatformValues -{ -/** Alibaba Cloud Elastic Compute Service. */ -static constexpr const char *kAlibabaCloudEcs = "alibaba_cloud_ecs"; -/** Alibaba Cloud Function Compute. */ -static constexpr const char *kAlibabaCloudFc = "alibaba_cloud_fc"; -/** Red Hat OpenShift on Alibaba Cloud. */ -static constexpr const char *kAlibabaCloudOpenshift = "alibaba_cloud_openshift"; -/** AWS Elastic Compute Cloud. */ -static constexpr const char *kAwsEc2 = "aws_ec2"; -/** AWS Elastic Container Service. */ -static constexpr const char *kAwsEcs = "aws_ecs"; -/** AWS Elastic Kubernetes Service. */ -static constexpr const char *kAwsEks = "aws_eks"; -/** AWS Lambda. */ -static constexpr const char *kAwsLambda = "aws_lambda"; -/** AWS Elastic Beanstalk. */ -static constexpr const char *kAwsElasticBeanstalk = "aws_elastic_beanstalk"; -/** AWS App Runner. */ -static constexpr const char *kAwsAppRunner = "aws_app_runner"; -/** Red Hat OpenShift on AWS (ROSA). */ -static constexpr const char *kAwsOpenshift = "aws_openshift"; -/** Azure Virtual Machines. */ -static constexpr const char *kAzureVm = "azure_vm"; -/** Azure Container Instances. */ -static constexpr const char *kAzureContainerInstances = "azure_container_instances"; -/** Azure Kubernetes Service. */ -static constexpr const char *kAzureAks = "azure_aks"; -/** Azure Functions. */ -static constexpr const char *kAzureFunctions = "azure_functions"; -/** Azure App Service. */ -static constexpr const char *kAzureAppService = "azure_app_service"; -/** Azure Red Hat OpenShift. */ -static constexpr const char *kAzureOpenshift = "azure_openshift"; -/** Google Bare Metal Solution (BMS). */ -static constexpr const char *kGcpBareMetalSolution = "gcp_bare_metal_solution"; -/** Google Cloud Compute Engine (GCE). */ -static constexpr const char *kGcpComputeEngine = "gcp_compute_engine"; -/** Google Cloud Run. */ -static constexpr const char *kGcpCloudRun = "gcp_cloud_run"; -/** Google Cloud Kubernetes Engine (GKE). */ -static constexpr const char *kGcpKubernetesEngine = "gcp_kubernetes_engine"; -/** Google Cloud Functions (GCF). */ -static constexpr const char *kGcpCloudFunctions = "gcp_cloud_functions"; -/** Google Cloud App Engine (GAE). */ -static constexpr const char *kGcpAppEngine = "gcp_app_engine"; -/** Red Hat OpenShift on Google Cloud. */ -static constexpr const char *kGcpOpenshift = "gcp_openshift"; -/** Red Hat OpenShift on IBM Cloud. */ -static constexpr const char *kIbmCloudOpenshift = "ibm_cloud_openshift"; -/** Tencent Cloud Cloud Virtual Machine (CVM). */ -static constexpr const char *kTencentCloudCvm = "tencent_cloud_cvm"; -/** Tencent Cloud Elastic Kubernetes Service (EKS). */ -static constexpr const char *kTencentCloudEks = "tencent_cloud_eks"; -/** Tencent Cloud Serverless Cloud Function (SCF). */ -static constexpr const char *kTencentCloudScf = "tencent_cloud_scf"; -} // namespace CloudPlatformValues - -namespace CloudProviderValues -{ -/** Alibaba Cloud. */ -static constexpr const char *kAlibabaCloud = "alibaba_cloud"; -/** Amazon Web Services. */ -static constexpr const char *kAws = "aws"; -/** Microsoft Azure. */ -static constexpr const char *kAzure = "azure"; -/** Google Cloud Platform. */ -static constexpr const char *kGcp = "gcp"; -/** Heroku Platform as a Service. */ -static constexpr const char *kHeroku = "heroku"; -/** IBM Cloud. */ -static constexpr const char *kIbmCloud = "ibm_cloud"; -/** Tencent Cloud. */ -static constexpr const char *kTencentCloud = "tencent_cloud"; -} // namespace CloudProviderValues - -namespace HostArchValues -{ -/** AMD64. */ -static constexpr const char *kAmd64 = "amd64"; -/** ARM32. */ -static constexpr const char *kArm32 = "arm32"; -/** ARM64. */ -static constexpr const char *kArm64 = "arm64"; -/** Itanium. */ -static constexpr const char *kIa64 = "ia64"; -/** 32-bit PowerPC. */ -static constexpr const char *kPpc32 = "ppc32"; -/** 64-bit PowerPC. */ -static constexpr const char *kPpc64 = "ppc64"; -/** IBM z/Architecture. */ -static constexpr const char *kS390x = "s390x"; -/** 32-bit x86. */ -static constexpr const char *kX86 = "x86"; -} // namespace HostArchValues - -namespace OsTypeValues -{ -/** Microsoft Windows. */ -static constexpr const char *kWindows = "windows"; -/** Linux. */ -static constexpr const char *kLinux = "linux"; -/** Apple Darwin. */ -static constexpr const char *kDarwin = "darwin"; -/** FreeBSD. */ -static constexpr const char *kFreebsd = "freebsd"; -/** NetBSD. */ -static constexpr const char *kNetbsd = "netbsd"; -/** OpenBSD. */ -static constexpr const char *kOpenbsd = "openbsd"; -/** DragonFly BSD. */ -static constexpr const char *kDragonflybsd = "dragonflybsd"; -/** HP-UX (Hewlett Packard Unix). */ -static constexpr const char *kHpux = "hpux"; -/** AIX (Advanced Interactive eXecutive). */ -static constexpr const char *kAix = "aix"; -/** SunOS, Oracle Solaris. */ -static constexpr const char *kSolaris = "solaris"; -/** IBM z/OS. */ -static constexpr const char *kZOs = "z_os"; -} // namespace OsTypeValues - namespace AwsEcsLaunchtypeValues { /** ec2. */ @@ -1052,34 +175,6 @@ static constexpr const char *kEc2 = "ec2"; static constexpr const char *kFargate = "fargate"; } // namespace AwsEcsLaunchtypeValues -namespace TelemetrySdkLanguageValues -{ -/** cpp. */ -static constexpr const char *kCpp = "cpp"; -/** dotnet. */ -static constexpr const char *kDotnet = "dotnet"; -/** erlang. */ -static constexpr const char *kErlang = "erlang"; -/** go. */ -static constexpr const char *kGo = "go"; -/** java. */ -static constexpr const char *kJava = "java"; -/** nodejs. */ -static constexpr const char *kNodejs = "nodejs"; -/** php. */ -static constexpr const char *kPhp = "php"; -/** python. */ -static constexpr const char *kPython = "python"; -/** ruby. */ -static constexpr const char *kRuby = "ruby"; -/** rust. */ -static constexpr const char *kRust = "rust"; -/** swift. */ -static constexpr const char *kSwift = "swift"; -/** webjs. */ -static constexpr const char *kWebjs = "webjs"; -} // namespace TelemetrySdkLanguageValues - } // namespace SemanticConventions } // namespace resource } // namespace sdk diff --git a/sdk/src/resource/resource.cc b/sdk/src/resource/resource.cc index 12f8e16d43..c91edf53ad 100644 --- a/sdk/src/resource/resource.cc +++ b/sdk/src/resource/resource.cc @@ -6,6 +6,7 @@ #include "opentelemetry/sdk/resource/resource_detector.h" #include "opentelemetry/sdk/resource/semantic_conventions.h" #include "opentelemetry/sdk/version/version.h" +#include "opentelemetry/trace/semantic_conventions.h" #include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -32,16 +33,17 @@ Resource Resource::Create(const ResourceAttributes &attributes, const std::strin auto resource = Resource::GetDefault().Merge(otel_resource).Merge(Resource{attributes, schema_url}); - if (resource.attributes_.find(SemanticConventions::kServiceName) == resource.attributes_.end()) + if (resource.attributes_.find(trace::SemanticConventions::kServiceName) == + resource.attributes_.end()) { std::string default_service_name = "unknown_service"; auto it_process_executable_name = - resource.attributes_.find(SemanticConventions::kProcessExecutableName); + resource.attributes_.find(trace::SemanticConventions::kProcessExecutableName); if (it_process_executable_name != resource.attributes_.end()) { default_service_name += ":" + nostd::get(it_process_executable_name->second); } - resource.attributes_[SemanticConventions::kServiceName] = default_service_name; + resource.attributes_[trace::SemanticConventions::kServiceName] = default_service_name; } return resource; } @@ -55,9 +57,9 @@ Resource &Resource::GetEmpty() Resource &Resource::GetDefault() { static Resource default_resource( - {{SemanticConventions::kTelemetrySdkLanguage, "cpp"}, - {SemanticConventions::kTelemetrySdkName, "opentelemetry"}, - {SemanticConventions::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}}, + {{trace::SemanticConventions::kTelemetrySdkLanguage, "cpp"}, + {trace::SemanticConventions::kTelemetrySdkName, "opentelemetry"}, + {trace::SemanticConventions::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}}, std::string{}); return default_resource; } diff --git a/sdk/src/resource/resource_detector.cc b/sdk/src/resource/resource_detector.cc index 2f560e1150..85df4e916f 100644 --- a/sdk/src/resource/resource_detector.cc +++ b/sdk/src/resource/resource_detector.cc @@ -5,6 +5,7 @@ #include "opentelemetry/sdk/common/env_variables.h" #include "opentelemetry/sdk/resource/resource.h" #include "opentelemetry/sdk/resource/semantic_conventions.h" +#include "opentelemetry/trace/semantic_conventions.h" #include #include @@ -52,7 +53,7 @@ Resource OTELResourceDetector::Detect() noexcept if (service_name_exists) { - attributes[SemanticConventions::kServiceName] = service_name; + attributes[trace::SemanticConventions::kServiceName] = service_name; } return Resource(attributes); diff --git a/sdk/test/resource/resource_test.cc b/sdk/test/resource/resource_test.cc index e6b56cae43..02b536e2e0 100644 --- a/sdk/test/resource/resource_test.cc +++ b/sdk/test/resource/resource_test.cc @@ -6,6 +6,7 @@ #include "opentelemetry/sdk/resource/resource_detector.h" #include "opentelemetry/sdk/resource/semantic_conventions.h" #include "opentelemetry/sdk/version/version.h" +#include "opentelemetry/trace/semantic_conventions.h" #include #include @@ -36,10 +37,10 @@ TEST(ResourceTest, create_without_servicename) {"service", "backend"}, {"version", static_cast(1)}, {"cost", 234.23}, - {SemanticConventions::kTelemetrySdkLanguage, "cpp"}, - {SemanticConventions::kTelemetrySdkName, "opentelemetry"}, - {SemanticConventions::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}, - {SemanticConventions::kServiceName, "unknown_service"}}; + {opentelemetry::trace::SemanticConventions::kTelemetrySdkLanguage, "cpp"}, + {opentelemetry::trace::SemanticConventions::kTelemetrySdkName, "opentelemetry"}, + {opentelemetry::trace::SemanticConventions::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}, + {opentelemetry::trace::SemanticConventions::kServiceName, "unknown_service"}}; ResourceAttributes attributes = { {"service", "backend"}, {"version", static_cast(1)}, {"cost", 234.23}}; @@ -69,10 +70,10 @@ TEST(ResourceTest, create_with_servicename) ResourceAttributes expected_attributes = { {"version", static_cast(1)}, {"cost", 234.23}, - {SemanticConventions::kTelemetrySdkLanguage, "cpp"}, - {SemanticConventions::kTelemetrySdkName, "opentelemetry"}, - {SemanticConventions::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}, - {SemanticConventions::kServiceName, "backend"}, + {opentelemetry::trace::SemanticConventions::kTelemetrySdkLanguage, "cpp"}, + {opentelemetry::trace::SemanticConventions::kTelemetrySdkName, "opentelemetry"}, + {opentelemetry::trace::SemanticConventions::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}, + {opentelemetry::trace::SemanticConventions::kServiceName, "backend"}, }; ResourceAttributes attributes = { {"service.name", "backend"}, {"version", static_cast(1)}, {"cost", 234.23}}; @@ -100,10 +101,10 @@ TEST(ResourceTest, create_with_servicename) TEST(ResourceTest, create_with_emptyatrributes) { ResourceAttributes expected_attributes = { - {SemanticConventions::kTelemetrySdkLanguage, "cpp"}, - {SemanticConventions::kTelemetrySdkName, "opentelemetry"}, - {SemanticConventions::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}, - {SemanticConventions::kServiceName, "unknown_service"}, + {opentelemetry::trace::SemanticConventions::kTelemetrySdkLanguage, "cpp"}, + {opentelemetry::trace::SemanticConventions::kTelemetrySdkName, "opentelemetry"}, + {opentelemetry::trace::SemanticConventions::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}, + {opentelemetry::trace::SemanticConventions::kServiceName, "unknown_service"}, }; ResourceAttributes attributes = {}; auto resource = Resource::Create(attributes);