diff --git a/.github/workflows/project_management_comment.yml b/.github/workflows/project_management_comment.yml index feba7112af..bddf31549a 100644 --- a/.github/workflows/project_management_comment.yml +++ b/.github/workflows/project_management_comment.yml @@ -12,7 +12,7 @@ jobs: issues: write steps: - name: Add comment - uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 + uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 with: issue-number: ${{ github.event.issue.number }} body: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 478e24edb9..23b80ce5b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,11 @@ Increment the: ## [Unreleased] +* [API] Fix b3, w3c and jaeger propagators: they will not overwrite + the active span with a default invalid span, which is especially useful + when used with CompositePropagator + [TEST] fix string "current-span" to trace:kSpan which is "active_span" + [#2511](https://github.com/open-telemetry/opentelemetry-cpp/pull/2511) * [REMOVAL] Remove option WITH_OTLP_HTTP_SSL_PREVIEW [#2435](https://github.com/open-telemetry/opentelemetry-cpp/pull/2435) * [BUILD] Fix removing of NOMINMAX on Windows diff --git a/api/include/opentelemetry/trace/propagation/b3_propagator.h b/api/include/opentelemetry/trace/propagation/b3_propagator.h index e52e42b747..a13d2f0767 100644 --- a/api/include/opentelemetry/trace/propagation/b3_propagator.h +++ b/api/include/opentelemetry/trace/propagation/b3_propagator.h @@ -51,7 +51,14 @@ class B3PropagatorExtractor : public context::propagation::TextMapPropagator { SpanContext span_context = ExtractImpl(carrier); nostd::shared_ptr sp{new DefaultSpan(span_context)}; - return trace::SetSpan(context, sp); + if (span_context.IsValid()) + { + return trace::SetSpan(context, sp); + } + else + { + return context; + } } static TraceId TraceIdFromHex(nostd::string_view trace_id) diff --git a/api/include/opentelemetry/trace/propagation/http_trace_context.h b/api/include/opentelemetry/trace/propagation/http_trace_context.h index bba7592ea6..a6b7e3b219 100644 --- a/api/include/opentelemetry/trace/propagation/http_trace_context.h +++ b/api/include/opentelemetry/trace/propagation/http_trace_context.h @@ -54,7 +54,14 @@ class HttpTraceContext : public context::propagation::TextMapPropagator { SpanContext span_context = ExtractImpl(carrier); nostd::shared_ptr sp{new DefaultSpan(span_context)}; - return trace::SetSpan(context, sp); + if (span_context.IsValid()) + { + return trace::SetSpan(context, sp); + } + else + { + return context; + } } static TraceId TraceIdFromHex(nostd::string_view trace_id) diff --git a/api/include/opentelemetry/trace/propagation/jaeger.h b/api/include/opentelemetry/trace/propagation/jaeger.h index 11cd820472..1f0195a248 100644 --- a/api/include/opentelemetry/trace/propagation/jaeger.h +++ b/api/include/opentelemetry/trace/propagation/jaeger.h @@ -57,7 +57,14 @@ class OPENTELEMETRY_DEPRECATED JaegerPropagator : public context::propagation::T { SpanContext span_context = ExtractImpl(carrier); nostd::shared_ptr sp{new DefaultSpan(span_context)}; - return trace::SetSpan(context, sp); + if (span_context.IsValid()) + { + return trace::SetSpan(context, sp); + } + else + { + return context; + } } bool Fields(nostd::function_ref callback) const noexcept override diff --git a/api/include/opentelemetry/trace/semantic_conventions.h b/api/include/opentelemetry/trace/semantic_conventions.h index 49f507c90b..baad4e674f 100644 --- a/api/include/opentelemetry/trace/semantic_conventions.h +++ b/api/include/opentelemetry/trace/semantic_conventions.h @@ -22,79 +22,7 @@ namespace SemanticConventions /** * The URL of the OpenTelemetry schema for these keys and values. */ -static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.23.1"; - -/** - * Client address - domain name if available without reverse DNS lookup; otherwise, IP address or - Unix domain socket name. - * - *

Notes: -

  • When observed from the server side, and when communicating through an intermediary, - {@code client.address} SHOULD represent the client address behind any intermediaries, for example - proxies, if it's available.
- */ -static constexpr const char *kClientAddress = "client.address"; - -/** - * Client port number. - * - *

Notes: -

  • When observed from the server side, and when communicating through an intermediary, - {@code client.port} SHOULD represent the client port behind any intermediaries, for example - proxies, if it's available.
- */ -static constexpr const char *kClientPort = "client.port"; - -/** - * Destination address - domain name if available without reverse DNS lookup; otherwise, IP address - or Unix domain socket name. - * - *

Notes: -

  • When observed from the source side, and when communicating through an intermediary, - {@code destination.address} SHOULD represent the destination address behind any intermediaries, for - example proxies, if it's available.
- */ -static constexpr const char *kDestinationAddress = "destination.address"; - -/** - * Destination port number - */ -static constexpr const char *kDestinationPort = "destination.port"; - -/** - * Describes a class of error the operation ended with. - * - *

Notes: -

  • The {@code error.type} SHOULD be predictable and SHOULD have low cardinality. -Instrumentations SHOULD document the list of errors they report.
  • The cardinality of {@code -error.type} within one instrumentation library SHOULD be low. Telemetry consumers that aggregate -data from multiple instrumentation libraries and applications should be prepared for {@code -error.type} to have high cardinality at query time when no additional filters are -applied.
  • If the operation has completed successfully, instrumentations SHOULD NOT set {@code -error.type}.
  • If a specific domain defines its own set of error identifiers (such as HTTP or -gRPC status codes), it's RECOMMENDED to:
  • Use a domain-specific attribute
  • Set {@code -error.type} to capture all errors, regardless of whether they are defined within the domain-specific -set or not.
  • -
- */ -static constexpr const char *kErrorType = "error.type"; - -/** - * The exception message. - */ -static constexpr const char *kExceptionMessage = "exception.message"; - -/** - * 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. - */ -static constexpr const char *kExceptionStacktrace = "exception.stacktrace"; - -/** - * The type of the exception (its fully-qualified class name, if applicable). The dynamic type of - * the exception should be preferred over the static type in languages that support it. - */ -static constexpr const char *kExceptionType = "exception.type"; +static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.24.0"; /** * The name of the invoked function. @@ -159,16 +87,13 @@ static constexpr const char *kEnduserRole = "enduser.role"; static constexpr const char *kEnduserScope = "enduser.scope"; /** - * The domain identifies the business context for the events. + * Identifies the class / type of event. * *

Notes: -

  • Events across different domains may have same {@code event.name}, yet be unrelated - events.
- */ -static constexpr const char *kEventDomain = "event.domain"; - -/** - * The name identifies the event. +
  • Event names are subject to the same rules as attribute + names. Notably, event names are namespaced to avoid collisions and provide a clean separation + of semantics for events in separate domains like browser, mobile, and kubernetes.
*/ static constexpr const char *kEventName = "event.name"; @@ -243,6 +168,46 @@ static constexpr const char *kPoolName = "pool.name"; */ static constexpr const char *kState = "state"; +/** + * Full type name of the {@code + * IExceptionHandler} implementation that handled the exception. + */ +static constexpr const char *kAspnetcoreDiagnosticsHandlerType = + "aspnetcore.diagnostics.handler.type"; + +/** + * Rate limiting policy name. + */ +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. + */ +static constexpr const char *kAspnetcoreRequestIsUnhandled = "aspnetcore.request.is_unhandled"; + +/** + * A value that indicates whether the matched route is a fallback route. + */ +static constexpr const char *kAspnetcoreRoutingIsFallback = "aspnetcore.routing.is_fallback"; + +/** + * SignalR HTTP connection closure status. + */ +static constexpr const char *kSignalrConnectionStatus = "signalr.connection.status"; + +/** + * SignalR + * transport type + */ +static constexpr const char *kSignalrTransport = "signalr.transport"; + /** * Name of the buffer pool. * @@ -303,11 +268,6 @@ static constexpr const char *kSystemPagingState = "system.paging.state"; */ static constexpr const char *kSystemPagingType = "system.paging.type"; -/** - * The disk operation direction - */ -static constexpr const char *kSystemDiskDirection = "system.disk.direction"; - /** * The filesystem mode */ @@ -328,11 +288,6 @@ static constexpr const char *kSystemFilesystemState = "system.filesystem.state"; */ static constexpr const char *kSystemFilesystemType = "system.filesystem.type"; -/** - * - */ -static constexpr const char *kSystemNetworkDirection = "system.network.direction"; - /** * A stateless protocol MUST NOT set this attribute */ @@ -345,6 +300,27 @@ static constexpr const char *kSystemNetworkState = "system.network.state"; */ static constexpr const char *kSystemProcessesStatus = "system.processes.status"; +/** + * Client address - domain name if available without reverse DNS lookup; otherwise, IP address or + Unix domain socket name. + * + *

Notes: +

  • When observed from the server side, and when communicating through an intermediary, + {@code client.address} SHOULD represent the client address behind any intermediaries, for example + proxies, if it's available.
+ */ +static constexpr const char *kClientAddress = "client.address"; + +/** + * Client port number. + * + *

Notes: +

  • When observed from the server side, and when communicating through an intermediary, + {@code client.port} SHOULD represent the client port behind any intermediaries, for example + proxies, if it's available.
+ */ +static constexpr const char *kClientPort = "client.port"; + /** * The column number in {@code code.filepath} best representing the operation. It SHOULD point * within the code unit named in {@code code.function}. @@ -376,166 +352,458 @@ static constexpr const char *kCodeLineno = "code.lineno"; static constexpr const char *kCodeNamespace = "code.namespace"; /** - * Deprecated, use {@code http.request.method} instead. - * - * @deprecated Deprecated, use `http.request.method` instead. + * 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. */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kHttpMethod = "http.method"; +static constexpr const char *kCodeStacktrace = "code.stacktrace"; /** - * Deprecated, use {@code http.request.header.content-length} instead. - * - * @deprecated Deprecated, use `http.request.header.content-length` instead. + * The consistency level of the query. Based on consistency values from CQL. */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kHttpRequestContentLength = "http.request_content_length"; +static constexpr const char *kDbCassandraConsistencyLevel = "db.cassandra.consistency_level"; /** - * Deprecated, use {@code http.response.header.content-length} instead. - * - * @deprecated Deprecated, use `http.response.header.content-length` instead. + * The data center of the coordinating node for a query. */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kHttpResponseContentLength = "http.response_content_length"; +static constexpr const char *kDbCassandraCoordinatorDc = "db.cassandra.coordinator.dc"; /** - * Deprecated, use {@code url.scheme} instead. - * - * @deprecated Deprecated, use `url.scheme` instead. + * The ID of the coordinating node for a query. */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kHttpScheme = "http.scheme"; +static constexpr const char *kDbCassandraCoordinatorId = "db.cassandra.coordinator.id"; /** - * Deprecated, use {@code http.response.status_code} instead. - * - * @deprecated Deprecated, use `http.response.status_code` instead. + * Whether or not the query is idempotent. */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kHttpStatusCode = "http.status_code"; +static constexpr const char *kDbCassandraIdempotence = "db.cassandra.idempotence"; /** - * Deprecated, use {@code url.path} and {@code url.query} instead. - * - * @deprecated Deprecated, use `url.path` and `url.query` instead. + * The fetch size used for paging, i.e. how many rows will be returned at once. */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kHttpTarget = "http.target"; +static constexpr const char *kDbCassandraPageSize = "db.cassandra.page_size"; /** - * Deprecated, use {@code url.full} instead. - * - * @deprecated Deprecated, use `url.full` instead. + * The number of times a query was speculatively executed. Not set or {@code 0} if the query was not + * executed speculatively. */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kHttpUrl = "http.url"; +static constexpr const char *kDbCassandraSpeculativeExecutionCount = + "db.cassandra.speculative_execution_count"; /** - * Deprecated, use {@code server.address}. + * The name of the primary Cassandra table that the operation is acting upon, including the keyspace + name (if applicable). * - * @deprecated Deprecated, use `server.address`. + *

Notes: +

  • This mirrors the db.sql.table attribute but references cassandra rather than sql. It is + not recommended to attempt any client-side parsing of {@code db.statement} just to get this + property, but it should be set if it is provided by the library being instrumented. If the + operation is acting upon an anonymous table, or more than one table, this value MUST NOT be + set.
*/ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kNetHostName = "net.host.name"; +static constexpr const char *kDbCassandraTable = "db.cassandra.table"; /** - * Deprecated, use {@code server.port}. - * - * @deprecated Deprecated, use `server.port`. + * The connection string used to connect to the database. It is recommended to remove embedded + * credentials. */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kNetHostPort = "net.host.port"; +static constexpr const char *kDbConnectionString = "db.connection_string"; /** - * Deprecated, use {@code server.address} on client spans and {@code client.address} on server - * spans. - * - * @deprecated Deprecated, use `server.address` on client spans and `client.address` on server - * spans. + * Unique Cosmos client instance id. */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kNetPeerName = "net.peer.name"; +static constexpr const char *kDbCosmosdbClientId = "db.cosmosdb.client_id"; /** - * Deprecated, use {@code server.port} on client spans and {@code client.port} on server spans. - * - * @deprecated Deprecated, use `server.port` on client spans and `client.port` on server spans. + * Cosmos client connection mode. */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kNetPeerPort = "net.peer.port"; +static constexpr const char *kDbCosmosdbConnectionMode = "db.cosmosdb.connection_mode"; /** - * Deprecated, use {@code network.protocol.name}. - * - * @deprecated Deprecated, use `network.protocol.name`. + * Cosmos DB container name. */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kNetProtocolName = "net.protocol.name"; +static constexpr const char *kDbCosmosdbContainer = "db.cosmosdb.container"; /** - * Deprecated, use {@code network.protocol.version}. - * - * @deprecated Deprecated, use `network.protocol.version`. + * CosmosDB Operation Type. */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kNetProtocolVersion = "net.protocol.version"; +static constexpr const char *kDbCosmosdbOperationType = "db.cosmosdb.operation_type"; /** - * Deprecated, use {@code network.transport} and {@code network.type}. - * - * @deprecated Deprecated, use `network.transport` and `network.type`. + * RU consumed for that operation */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kNetSockFamily = "net.sock.family"; +static constexpr const char *kDbCosmosdbRequestCharge = "db.cosmosdb.request_charge"; /** - * Deprecated, use {@code network.local.address}. - * - * @deprecated Deprecated, use `network.local.address`. + * Request payload size in bytes */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kNetSockHostAddr = "net.sock.host.addr"; +static constexpr const char *kDbCosmosdbRequestContentLength = "db.cosmosdb.request_content_length"; /** - * Deprecated, use {@code network.local.port}. - * - * @deprecated Deprecated, use `network.local.port`. + * Cosmos DB status code. */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kNetSockHostPort = "net.sock.host.port"; +static constexpr const char *kDbCosmosdbStatusCode = "db.cosmosdb.status_code"; /** - * Deprecated, use {@code network.peer.address}. - * - * @deprecated Deprecated, use `network.peer.address`. + * Cosmos DB sub status code. */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kNetSockPeerAddr = "net.sock.peer.addr"; +static constexpr const char *kDbCosmosdbSubStatusCode = "db.cosmosdb.sub_status_code"; /** - * Deprecated, no replacement at this time. - * - * @deprecated Deprecated, no replacement at this time. + * Represents the identifier of an Elasticsearch cluster. + */ +static constexpr const char *kDbElasticsearchClusterName = "db.elasticsearch.cluster.name"; + +/** + * Represents the human-readable identifier of the node/instance to which a request was routed. + */ +static constexpr const char *kDbElasticsearchNodeName = "db.elasticsearch.node.name"; + +/** + * 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}. + */ +static constexpr const char *kDbInstanceId = "db.instance.id"; + +/** + * The fully-qualified class name of the Java Database Connectivity + * (JDBC) driver used to connect. + */ +static constexpr const char *kDbJdbcDriverClassname = "db.jdbc.driver_classname"; + +/** + * The MongoDB collection being accessed within the database stated in {@code db.name}. + */ +static constexpr const char *kDbMongodbCollection = "db.mongodb.collection"; + +/** + * The Microsoft SQL Server instance + name connecting to. This name is used to determine the port of a named instance. + * + *

Notes: +

  • If setting a {@code db.mssql.instance_name}, {@code server.port} is no longer required + (but still recommended if non-standard).
+ */ +static constexpr const char *kDbMssqlInstanceName = "db.mssql.instance_name"; + +/** + * 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 + 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).
+ */ +static constexpr const char *kDbName = "db.name"; + +/** + * The name of the operation being executed, e.g. the MongoDB command + name such as {@code findAndModify}, or the SQL keyword. + * + *

Notes: +

  • When setting this to an SQL keyword, it is not recommended to attempt any client-side + parsing of {@code db.statement} just to get this property, but it should be set if the operation + name is provided by the library being instrumented. If the SQL statement has an ambiguous + operation, or performs more than one operation, this value may be omitted.
+ */ +static constexpr const char *kDbOperation = "db.operation"; + +/** + * The index of the database being accessed as used in the {@code SELECT} command, provided as an integer. To be + * used instead of the generic {@code db.name} attribute. + */ +static constexpr const char *kDbRedisDatabaseIndex = "db.redis.database_index"; + +/** + * The name of the primary table that the operation is acting upon, including the database name (if + applicable). + * + *

Notes: +

  • It is not recommended to attempt any client-side parsing of {@code db.statement} just to + get this property, but it should be set if it is provided by the library being instrumented. If the + operation is acting upon an anonymous table, or more than one table, this value MUST NOT be + set.
+ */ +static constexpr const char *kDbSqlTable = "db.sql.table"; + +/** + * The database statement being executed. + */ +static constexpr const char *kDbStatement = "db.statement"; + +/** + * An identifier for the database management system (DBMS) product being used. See below for a list + * of well-known identifiers. + */ +static constexpr const char *kDbSystem = "db.system"; + +/** + * Username for accessing the database. + */ +static constexpr const char *kDbUser = "db.user"; + +/** + * Deprecated, use {@code network.protocol.name} instead. + * + * @deprecated Deprecated, use `network.protocol.name` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpFlavor = "http.flavor"; + +/** + * Deprecated, use {@code http.request.method} instead. + * + * @deprecated Deprecated, use `http.request.method` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpMethod = "http.method"; + +/** + * Deprecated, use {@code http.request.header.content-length} instead. + * + * @deprecated Deprecated, use `http.request.header.content-length` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpRequestContentLength = "http.request_content_length"; + +/** + * Deprecated, use {@code http.response.header.content-length} instead. + * + * @deprecated Deprecated, use `http.response.header.content-length` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpResponseContentLength = "http.response_content_length"; + +/** + * Deprecated, use {@code url.scheme} instead. + * + * @deprecated Deprecated, use `url.scheme` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpScheme = "http.scheme"; + +/** + * Deprecated, use {@code http.response.status_code} instead. + * + * @deprecated Deprecated, use `http.response.status_code` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpStatusCode = "http.status_code"; + +/** + * Deprecated, use {@code url.path} and {@code url.query} instead. + * + * @deprecated Deprecated, use `url.path` and `url.query` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpTarget = "http.target"; + +/** + * Deprecated, use {@code url.full} instead. + * + * @deprecated Deprecated, use `url.full` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpUrl = "http.url"; + +/** + * Deprecated, use {@code user_agent.original} instead. + * + * @deprecated Deprecated, use `user_agent.original` instead. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kHttpUserAgent = "http.user_agent"; + +/** + * Deprecated, use {@code server.address}. + * + * @deprecated Deprecated, use `server.address`. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetHostName = "net.host.name"; + +/** + * Deprecated, use {@code server.port}. + * + * @deprecated Deprecated, use `server.port`. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetHostPort = "net.host.port"; + +/** + * Deprecated, use {@code server.address} on client spans and {@code client.address} on server + * spans. + * + * @deprecated Deprecated, use `server.address` on client spans and `client.address` on server + * spans. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetPeerName = "net.peer.name"; + +/** + * Deprecated, use {@code server.port} on client spans and {@code client.port} on server spans. + * + * @deprecated Deprecated, use `server.port` on client spans and `client.port` on server spans. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetPeerPort = "net.peer.port"; + +/** + * Deprecated, use {@code network.protocol.name}. + * + * @deprecated Deprecated, use `network.protocol.name`. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetProtocolName = "net.protocol.name"; + +/** + * Deprecated, use {@code network.protocol.version}. + * + * @deprecated Deprecated, use `network.protocol.version`. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetProtocolVersion = "net.protocol.version"; + +/** + * Deprecated, use {@code network.transport} and {@code network.type}. + * + * @deprecated Deprecated, use `network.transport` and `network.type`. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetSockFamily = "net.sock.family"; + +/** + * Deprecated, use {@code network.local.address}. + * + * @deprecated Deprecated, use `network.local.address`. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetSockHostAddr = "net.sock.host.addr"; + +/** + * Deprecated, use {@code network.local.port}. + * + * @deprecated Deprecated, use `network.local.port`. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetSockHostPort = "net.sock.host.port"; + +/** + * Deprecated, use {@code network.peer.address}. + * + * @deprecated Deprecated, use `network.peer.address`. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetSockPeerAddr = "net.sock.peer.addr"; + +/** + * Deprecated, no replacement at this time. + * + * @deprecated Deprecated, no replacement at this time. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetSockPeerName = "net.sock.peer.name"; + +/** + * Deprecated, use {@code network.peer.port}. + * + * @deprecated Deprecated, use `network.peer.port`. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetSockPeerPort = "net.sock.peer.port"; + +/** + * Deprecated, use {@code network.transport}. + * + * @deprecated Deprecated, use `network.transport`. + */ +OPENTELEMETRY_DEPRECATED +static constexpr const char *kNetTransport = "net.transport"; + +/** + * Destination address - domain name if available without reverse DNS lookup; otherwise, IP address + or Unix domain socket name. + * + *

Notes: +

  • When observed from the source side, and when communicating through an intermediary, + {@code destination.address} SHOULD represent the destination address behind any intermediaries, for + example proxies, if it's available.
+ */ +static constexpr const char *kDestinationAddress = "destination.address"; + +/** + * Destination port number + */ +static constexpr const char *kDestinationPort = "destination.port"; + +/** + * The disk IO operation direction. + */ +static constexpr const char *kDiskIoDirection = "disk.io.direction"; + +/** + * Describes a class of error the operation ended with. + * + *

Notes: +

  • The {@code error.type} SHOULD be predictable and SHOULD have low cardinality. +Instrumentations SHOULD document the list of errors they report.
  • The cardinality of {@code +error.type} within one instrumentation library SHOULD be low. Telemetry consumers that aggregate +data from multiple instrumentation libraries and applications should be prepared for {@code +error.type} to have high cardinality at query time when no additional filters are +applied.
  • If the operation has completed successfully, instrumentations SHOULD NOT set {@code +error.type}.
  • If a specific domain defines its own set of error identifiers (such as HTTP or +gRPC status codes), it's RECOMMENDED to:
  • Use a domain-specific attribute
  • Set {@code +error.type} to capture all errors, regardless of whether they are defined within the domain-specific +set or not.
  • +
*/ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kNetSockPeerName = "net.sock.peer.name"; +static constexpr const char *kErrorType = "error.type"; /** - * Deprecated, use {@code network.peer.port}. + * SHOULD be set to true if the exception event is recorded at a point where it is known that the +exception is escaping the scope of the span. * - * @deprecated Deprecated, use `network.peer.port`. + *

Notes: +

  • An exception is considered to have escaped (or left) the scope of a span, +if that span is ended while the exception is still logically "in flight". +This may be actually "in flight" in some languages (e.g. if the exception +is passed to a Context manager's {@code __exit__} method in Python) but will +usually be caught at the point of recording the exception in most languages.
  • It is usually +not possible to determine at the point where an exception is thrown whether it will escape the scope +of a span. However, it is trivial to know that an exception will escape, if one checks for an active +exception just before ending the span, as done in the example for +recording span exceptions.
  • It follows that an exception may still escape the scope of +the span even if the {@code exception.escaped} attribute was not set or set to false, since the +event might have been recorded at a time where it was not clear whether the exception will +escape.
*/ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kNetSockPeerPort = "net.sock.peer.port"; +static constexpr const char *kExceptionEscaped = "exception.escaped"; /** - * Deprecated, use {@code network.transport}. - * - * @deprecated Deprecated, use `network.transport`. + * The exception message. */ -OPENTELEMETRY_DEPRECATED -static constexpr const char *kNetTransport = "net.transport"; +static constexpr const char *kExceptionMessage = "exception.message"; + +/** + * 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. + */ +static constexpr const char *kExceptionStacktrace = "exception.stacktrace"; + +/** + * The type of the exception (its fully-qualified class name, if applicable). The dynamic type of + * the exception should be preferred over the static type in languages that support it. + */ +static constexpr const char *kExceptionType = "exception.type"; /** * The size of the request payload body in bytes. This is the number of bytes transferred excluding @@ -675,6 +943,13 @@ identify the broker. static constexpr const char *kMessagingDestinationPublishName = "messaging.destination_publish.name"; +/** + * The ordering key for a given message. If the attribute is not present, the message does not have + * an ordering key. + */ +static constexpr const char *kMessagingGcpPubsubMessageOrderingKey = + "messaging.gcp_pubsub.message.ordering_key"; + /** * Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not * producers. @@ -803,7 +1078,8 @@ static constexpr const char *kMessagingRocketmqMessageType = "messaging.rocketmq static constexpr const char *kMessagingRocketmqNamespace = "messaging.rocketmq.namespace"; /** - * A string identifying the messaging system. + * An identifier for the messaging system being used. See below for a list of well-known + * identifiers. */ static constexpr const char *kMessagingSystem = "messaging.system"; @@ -838,6 +1114,11 @@ static constexpr const char *kNetworkConnectionSubtype = "network.connection.sub */ static constexpr const char *kNetworkConnectionType = "network.connection.type"; +/** + * The network IO operation direction. + */ +static constexpr const char *kNetworkIoDirection = "network.io.direction"; + /** * Local address of the network connection - IP address or Unix domain socket name. */ @@ -963,344 +1244,342 @@ static constexpr const char *kRpcService = "rpc.service"; static constexpr const char *kRpcSystem = "rpc.system"; /** - * Current "managed" thread ID (as opposed to OS thread ID). + * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain + socket name. + * + *

Notes: +

  • When observed from the client side, and when communicating through an intermediary, + {@code server.address} SHOULD represent the server address behind any intermediaries, for example + proxies, if it's available.
*/ -static constexpr const char *kThreadId = "thread.id"; +static constexpr const char *kServerAddress = "server.address"; /** - * Current thread name. + * Server port number. + * + *

Notes: +

  • When observed from the client side, and when communicating through an intermediary, + {@code server.port} SHOULD represent the server port behind any intermediaries, for example + proxies, if it's available.
*/ -static constexpr const char *kThreadName = "thread.name"; +static constexpr const char *kServerPort = "server.port"; /** - * The URI fragment component + * Source address - domain name if available without reverse DNS lookup; otherwise, IP address or + Unix domain socket name. + * + *

Notes: +

  • When observed from the destination side, and when communicating through an intermediary, + {@code source.address} SHOULD represent the source address behind any intermediaries, for example + proxies, if it's available.
*/ -static constexpr const char *kUrlFragment = "url.fragment"; +static constexpr const char *kSourceAddress = "source.address"; /** - * Absolute URL describing a network resource according to RFC3986 - * - *

Notes: -

  • For network calls, URL usually has {@code scheme://host[:port][path][?query][#fragment]} -format, where the fragment is not transmitted over HTTP, but if it is known, it SHOULD be included -nevertheless. -{@code url.full} MUST NOT contain credentials passed via URL in form of {@code -https://username:password@www.example.com/}. In such case username and password SHOULD be redacted -and attribute's value SHOULD be {@code https://REDACTED:REDACTED@www.example.com/}. -{@code url.full} SHOULD capture the absolute URL when it is available (or can be reconstructed) and -SHOULD NOT be validated or modified except for sanitizing purposes.
+ * Source port number */ -static constexpr const char *kUrlFull = "url.full"; +static constexpr const char *kSourcePort = "source.port"; /** - * The URI path component + * Current "managed" thread ID (as opposed to OS thread ID). */ -static constexpr const char *kUrlPath = "url.path"; +static constexpr const char *kThreadId = "thread.id"; /** - * The URI query component + * Current thread name. + */ +static constexpr const char *kThreadName = "thread.name"; + +/** + * String indicating the cipher used during the + current connection. * *

Notes: -

  • Sensitive content provided in query string SHOULD be scrubbed when instrumentations can - identify it.
+ */ -static constexpr const char *kUrlQuery = "url.query"; +static constexpr const char *kTlsCipher = "tls.cipher"; /** - * The URI scheme component - * identifying the used protocol. + * PEM-encoded stand-alone certificate offered by the client. This is usually mutually-exclusive of + * {@code client.certificate_chain} since this value also exists in that list. */ -static constexpr const char *kUrlScheme = "url.scheme"; +static constexpr const char *kTlsClientCertificate = "tls.client.certificate"; /** - * Value of the HTTP - * User-Agent header sent by the client. + * Array of PEM-encoded certificates that make up the certificate chain offered by the client. This + * is usually mutually-exclusive of {@code client.certificate} since that value should be the first + * certificate in the chain. */ -static constexpr const char *kUserAgentOriginal = "user_agent.original"; +static constexpr const char *kTlsClientCertificateChain = "tls.client.certificate_chain"; /** - * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain - socket name. - * - *

Notes: -

  • When observed from the client side, and when communicating through an intermediary, - {@code server.address} SHOULD represent the server address behind any intermediaries, for example - proxies, if it's available.
+ * Certificate fingerprint using the MD5 digest of DER-encoded version of certificate offered by the + * client. For consistency with other hash values, this value should be formatted as an uppercase + * hash. */ -static constexpr const char *kServerAddress = "server.address"; +static constexpr const char *kTlsClientHashMd5 = "tls.client.hash.md5"; /** - * Server port number. - * - *

Notes: -

  • When observed from the client side, and when communicating through an intermediary, - {@code server.port} SHOULD represent the server port behind any intermediaries, for example - proxies, if it's available.
+ * Certificate fingerprint using the SHA1 digest of DER-encoded version of certificate offered by + * the client. For consistency with other hash values, this value should be formatted as an + * uppercase hash. */ -static constexpr const char *kServerPort = "server.port"; +static constexpr const char *kTlsClientHashSha1 = "tls.client.hash.sha1"; /** - * A unique id to identify a session. + * Certificate fingerprint using the SHA256 digest of DER-encoded version of certificate offered by + * the client. For consistency with other hash values, this value should be formatted as an + * uppercase hash. */ -static constexpr const char *kSessionId = "session.id"; +static constexpr const char *kTlsClientHashSha256 = "tls.client.hash.sha256"; /** - * The previous {@code session.id} for this user, when known. + * Distinguished name of subject of the issuer of + * the x.509 certificate presented by the client. */ -static constexpr const char *kSessionPreviousId = "session.previous_id"; +static constexpr const char *kTlsClientIssuer = "tls.client.issuer"; /** - * Source address - domain name if available without reverse DNS lookup; otherwise, IP address or - Unix domain socket name. - * - *

Notes: -

  • When observed from the destination side, and when communicating through an intermediary, - {@code source.address} SHOULD represent the source address behind any intermediaries, for example - proxies, if it's available.
+ * A hash that identifies clients based on how they perform an SSL/TLS handshake. */ -static constexpr const char *kSourceAddress = "source.address"; +static constexpr const char *kTlsClientJa3 = "tls.client.ja3"; /** - * Source port number + * Date/Time indicating when client certificate is no longer considered valid. */ -static constexpr const char *kSourcePort = "source.port"; +static constexpr const char *kTlsClientNotAfter = "tls.client.not_after"; /** - * 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: -

  • This may be different from {@code cloud.resource_id} if an alias is involved.
+ * Date/Time indicating when client certificate is first considered valid. */ -static constexpr const char *kAwsLambdaInvokedArn = "aws.lambda.invoked_arn"; +static constexpr const char *kTlsClientNotBefore = "tls.client.not_before"; /** - * The event_id - * uniquely identifies the event. + * Also called an SNI, this tells the server which hostname to which the client is attempting to + * connect to. */ -static constexpr const char *kCloudeventsEventId = "cloudevents.event_id"; +static constexpr const char *kTlsClientServerName = "tls.client.server_name"; /** - * The source - * identifies the context in which an event happened. + * Distinguished name of subject of the x.509 certificate presented by the client. */ -static constexpr const char *kCloudeventsEventSource = "cloudevents.event_source"; +static constexpr const char *kTlsClientSubject = "tls.client.subject"; /** - * The version of - * the CloudEvents specification which the event uses. + * Array of ciphers offered by the client during the client hello. */ -static constexpr const char *kCloudeventsEventSpecVersion = "cloudevents.event_spec_version"; +static constexpr const char *kTlsClientSupportedCiphers = "tls.client.supported_ciphers"; /** - * The subject of - * the event in the context of the event producer (identified by source). + * String indicating the curve used for the given cipher, when applicable */ -static constexpr const char *kCloudeventsEventSubject = "cloudevents.event_subject"; +static constexpr const char *kTlsCurve = "tls.curve"; /** - * The event_type - * contains a value describing the type of event related to the originating occurrence. + * Boolean flag indicating if the TLS negotiation was successful and transitioned to an encrypted + * tunnel. */ -static constexpr const char *kCloudeventsEventType = "cloudevents.event_type"; +static constexpr const char *kTlsEstablished = "tls.established"; /** - * Parent-child Reference type - * - *

Notes: -

  • The causal relationship between a child Span and a parent Span.
+ * String indicating the protocol being tunneled. Per the values in the IANA + * registry, this string should be lower case. */ -static constexpr const char *kOpentracingRefType = "opentracing.ref_type"; +static constexpr const char *kTlsNextProtocol = "tls.next_protocol"; /** - * The connection string used to connect to the database. It is recommended to remove embedded - * credentials. + * Normalized lowercase protocol name parsed from original string of the negotiated SSL/TLS + * protocol version */ -static constexpr const char *kDbConnectionString = "db.connection_string"; +static constexpr const char *kTlsProtocolName = "tls.protocol.name"; /** - * The fully-qualified class name of the Java Database Connectivity - * (JDBC) driver used to connect. + * Numeric part of the version parsed from the original string of the negotiated SSL/TLS + * protocol version */ -static constexpr const char *kDbJdbcDriverClassname = "db.jdbc.driver_classname"; +static constexpr const char *kTlsProtocolVersion = "tls.protocol.version"; /** - * 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 - 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).
+ * Boolean flag indicating if this TLS connection was resumed from an existing TLS negotiation. */ -static constexpr const char *kDbName = "db.name"; +static constexpr const char *kTlsResumed = "tls.resumed"; /** - * The name of the operation being executed, e.g. the MongoDB command - name such as {@code findAndModify}, or the SQL keyword. - * - *

Notes: -

  • When setting this to an SQL keyword, it is not recommended to attempt any client-side - parsing of {@code db.statement} just to get this property, but it should be set if the operation - name is provided by the library being instrumented. If the SQL statement has an ambiguous - operation, or performs more than one operation, this value may be omitted.
+ * PEM-encoded stand-alone certificate offered by the server. This is usually mutually-exclusive of + * {@code server.certificate_chain} since this value also exists in that list. */ -static constexpr const char *kDbOperation = "db.operation"; +static constexpr const char *kTlsServerCertificate = "tls.server.certificate"; /** - * The database statement being executed. + * Array of PEM-encoded certificates that make up the certificate chain offered by the server. This + * is usually mutually-exclusive of {@code server.certificate} since that value should be the first + * certificate in the chain. */ -static constexpr const char *kDbStatement = "db.statement"; +static constexpr const char *kTlsServerCertificateChain = "tls.server.certificate_chain"; /** - * An identifier for the database management system (DBMS) product being used. See below for a list - * of well-known identifiers. + * Certificate fingerprint using the MD5 digest of DER-encoded version of certificate offered by the + * server. For consistency with other hash values, this value should be formatted as an uppercase + * hash. */ -static constexpr const char *kDbSystem = "db.system"; +static constexpr const char *kTlsServerHashMd5 = "tls.server.hash.md5"; /** - * Username for accessing the database. + * Certificate fingerprint using the SHA1 digest of DER-encoded version of certificate offered by + * the server. For consistency with other hash values, this value should be formatted as an + * uppercase hash. */ -static constexpr const char *kDbUser = "db.user"; +static constexpr const char *kTlsServerHashSha1 = "tls.server.hash.sha1"; /** - * The Microsoft SQL Server instance - name connecting to. This name is used to determine the port of a named instance. - * - *

Notes: -

  • If setting a {@code db.mssql.instance_name}, {@code server.port} is no longer required - (but still recommended if non-standard).
+ * Certificate fingerprint using the SHA256 digest of DER-encoded version of certificate offered by + * the server. For consistency with other hash values, this value should be formatted as an + * uppercase hash. */ -static constexpr const char *kDbMssqlInstanceName = "db.mssql.instance_name"; +static constexpr const char *kTlsServerHashSha256 = "tls.server.hash.sha256"; /** - * The consistency level of the query. Based on consistency values from CQL. + * Distinguished name of subject of the issuer of + * the x.509 certificate presented by the client. */ -static constexpr const char *kDbCassandraConsistencyLevel = "db.cassandra.consistency_level"; +static constexpr const char *kTlsServerIssuer = "tls.server.issuer"; /** - * The data center of the coordinating node for a query. + * A hash that identifies servers based on how they perform an SSL/TLS handshake. */ -static constexpr const char *kDbCassandraCoordinatorDc = "db.cassandra.coordinator.dc"; +static constexpr const char *kTlsServerJa3s = "tls.server.ja3s"; /** - * The ID of the coordinating node for a query. + * Date/Time indicating when server certificate is no longer considered valid. */ -static constexpr const char *kDbCassandraCoordinatorId = "db.cassandra.coordinator.id"; +static constexpr const char *kTlsServerNotAfter = "tls.server.not_after"; /** - * Whether or not the query is idempotent. + * Date/Time indicating when server certificate is first considered valid. */ -static constexpr const char *kDbCassandraIdempotence = "db.cassandra.idempotence"; +static constexpr const char *kTlsServerNotBefore = "tls.server.not_before"; /** - * The fetch size used for paging, i.e. how many rows will be returned at once. + * Distinguished name of subject of the x.509 certificate presented by the server. */ -static constexpr const char *kDbCassandraPageSize = "db.cassandra.page_size"; +static constexpr const char *kTlsServerSubject = "tls.server.subject"; /** - * The number of times a query was speculatively executed. Not set or {@code 0} if the query was not - * executed speculatively. + * The URI fragment component */ -static constexpr const char *kDbCassandraSpeculativeExecutionCount = - "db.cassandra.speculative_execution_count"; +static constexpr const char *kUrlFragment = "url.fragment"; /** - * The name of the primary table that the operation is acting upon, including the keyspace name (if - applicable). + * Absolute URL describing a network resource according to RFC3986 * *

Notes: -

  • This mirrors the db.sql.table attribute but references cassandra rather than sql. It is - not recommended to attempt any client-side parsing of {@code db.statement} just to get this - property, but it should be set if it is provided by the library being instrumented. If the - operation is acting upon an anonymous table, or more than one table, this value MUST NOT be - set.
+
  • For network calls, URL usually has {@code scheme://host[:port][path][?query][#fragment]} +format, where the fragment is not transmitted over HTTP, but if it is known, it SHOULD be included +nevertheless. +{@code url.full} MUST NOT contain credentials passed via URL in form of {@code +https://username:password@www.example.com/}. In such case username and password SHOULD be redacted +and attribute's value SHOULD be {@code https://REDACTED:REDACTED@www.example.com/}. +{@code url.full} SHOULD capture the absolute URL when it is available (or can be reconstructed) and +SHOULD NOT be validated or modified except for sanitizing purposes.
*/ -static constexpr const char *kDbCassandraTable = "db.cassandra.table"; +static constexpr const char *kUrlFull = "url.full"; /** - * The index of the database being accessed as used in the {@code SELECT} command, provided as an integer. To be - * used instead of the generic {@code db.name} attribute. + * The URI path component */ -static constexpr const char *kDbRedisDatabaseIndex = "db.redis.database_index"; +static constexpr const char *kUrlPath = "url.path"; /** - * The collection being accessed within the database stated in {@code db.name}. + * The URI query component + * + *

Notes: +

  • Sensitive content provided in query string SHOULD be scrubbed when instrumentations can + identify it.
*/ -static constexpr const char *kDbMongodbCollection = "db.mongodb.collection"; +static constexpr const char *kUrlQuery = "url.query"; /** - * Represents the identifier of an Elasticsearch cluster. + * The URI scheme component + * identifying the used protocol. */ -static constexpr const char *kDbElasticsearchClusterName = "db.elasticsearch.cluster.name"; +static constexpr const char *kUrlScheme = "url.scheme"; /** - * Represents the human-readable identifier of the node/instance to which a request was routed. + * Value of the HTTP + * User-Agent header sent by the client. */ -static constexpr const char *kDbElasticsearchNodeName = "db.elasticsearch.node.name"; +static constexpr const char *kUserAgentOriginal = "user_agent.original"; /** - * The name of the primary table that the operation is acting upon, including the database name (if - applicable). - * - *

Notes: -

  • It is not recommended to attempt any client-side parsing of {@code db.statement} just to - get this property, but it should be set if it is provided by the library being instrumented. If the - operation is acting upon an anonymous table, or more than one table, this value MUST NOT be - set.
+ * A unique id to identify a session. */ -static constexpr const char *kDbSqlTable = "db.sql.table"; +static constexpr const char *kSessionId = "session.id"; /** - * Unique Cosmos client instance id. + * The previous {@code session.id} for this user, when known. */ -static constexpr const char *kDbCosmosdbClientId = "db.cosmosdb.client_id"; +static constexpr const char *kSessionPreviousId = "session.previous_id"; /** - * Cosmos client connection mode. + * 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: +

  • This may be different from {@code cloud.resource_id} if an alias is involved.
*/ -static constexpr const char *kDbCosmosdbConnectionMode = "db.cosmosdb.connection_mode"; +static constexpr const char *kAwsLambdaInvokedArn = "aws.lambda.invoked_arn"; /** - * Cosmos DB container name. + * The event_id + * uniquely identifies the event. */ -static constexpr const char *kDbCosmosdbContainer = "db.cosmosdb.container"; +static constexpr const char *kCloudeventsEventId = "cloudevents.event_id"; /** - * CosmosDB Operation Type. + * The source + * identifies the context in which an event happened. */ -static constexpr const char *kDbCosmosdbOperationType = "db.cosmosdb.operation_type"; +static constexpr const char *kCloudeventsEventSource = "cloudevents.event_source"; /** - * RU consumed for that operation + * The version of + * the CloudEvents specification which the event uses. */ -static constexpr const char *kDbCosmosdbRequestCharge = "db.cosmosdb.request_charge"; +static constexpr const char *kCloudeventsEventSpecVersion = "cloudevents.event_spec_version"; /** - * Request payload size in bytes + * The subject of + * the event in the context of the event producer (identified by source). */ -static constexpr const char *kDbCosmosdbRequestContentLength = "db.cosmosdb.request_content_length"; +static constexpr const char *kCloudeventsEventSubject = "cloudevents.event_subject"; /** - * Cosmos DB status code. + * The event_type + * contains a value describing the type of event related to the originating occurrence. */ -static constexpr const char *kDbCosmosdbStatusCode = "db.cosmosdb.status_code"; +static constexpr const char *kCloudeventsEventType = "cloudevents.event_type"; /** - * Cosmos DB sub status code. + * Parent-child Reference type + * + *

Notes: +

  • The causal relationship between a child Span and a parent Span.
*/ -static constexpr const char *kDbCosmosdbSubStatusCode = "db.cosmosdb.sub_status_code"; +static constexpr const char *kOpentracingRefType = "opentracing.ref_type"; /** * Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code @@ -1664,32 +1943,7 @@ static constexpr const char *kMessageType = "message.type"; */ static constexpr const char *kMessageUncompressedSize = "message.uncompressed_size"; -/** - * SHOULD be set to true if the exception event is recorded at a point where it is known that the -exception is escaping the scope of the span. - * - *

Notes: -

  • An exception is considered to have escaped (or left) the scope of a span, -if that span is ended while the exception is still logically "in flight". -This may be actually "in flight" in some languages (e.g. if the exception -is passed to a Context manager's {@code __exit__} method in Python) but will -usually be caught at the point of recording the exception in most languages.
  • It is usually -not possible to determine at the point where an exception is thrown whether it will escape the scope -of a span. However, it is trivial to know that an exception will escape, if one checks for an active -exception just before ending the span, as done in the example -above.
  • It follows that an exception may still escape the scope of the span even if the -{@code exception.escaped} attribute was not set or set to false, since the event might have been -recorded at a time where it was not clear whether the exception will escape.
- */ -static constexpr const char *kExceptionEscaped = "exception.escaped"; - // Enum definitions -namespace ErrorTypeValues -{ -/** A fallback error value to be used when the instrumentation doesn't define a custom value. */ -static constexpr const char *kOther = "_OTHER"; -} // namespace ErrorTypeValues - namespace FaasInvokedProviderValues { /** Alibaba Cloud. */ @@ -1718,16 +1972,6 @@ static constexpr const char *kTimer = "timer"; static constexpr const char *kOther = "other"; } // namespace FaasTriggerValues -namespace EventDomainValues -{ -/** Events from browser apps. */ -static constexpr const char *kBrowser = "browser"; -/** Events from mobile apps. */ -static constexpr const char *kDevice = "device"; -/** Events from Kubernetes. */ -static constexpr const char *kK8s = "k8s"; -} // namespace EventDomainValues - namespace LogIostreamValues { /** Logs from stdout stream. */ @@ -1773,6 +2017,38 @@ static constexpr const char *kIdle = "idle"; static constexpr const char *kUsed = "used"; } // namespace StateValues +namespace AspnetcoreRateLimitingResultValues +{ +/** Lease was acquired. */ +static constexpr const char *kAcquired = "acquired"; +/** Lease request was rejected by the endpoint limiter. */ +static constexpr const char *kEndpointLimiter = "endpoint_limiter"; +/** Lease request was rejected by the global limiter. */ +static constexpr const char *kGlobalLimiter = "global_limiter"; +/** Lease request was canceled. */ +static constexpr const char *kRequestCanceled = "request_canceled"; +} // namespace AspnetcoreRateLimitingResultValues + +namespace SignalrConnectionStatusValues +{ +/** The connection was closed normally. */ +static constexpr const char *kNormalClosure = "normal_closure"; +/** The connection was closed due to a timeout. */ +static constexpr const char *kTimeout = "timeout"; +/** The connection was closed because the app is shutting down. */ +static constexpr const char *kAppShutdown = "app_shutdown"; +} // namespace SignalrConnectionStatusValues + +namespace SignalrTransportValues +{ +/** ServerSentEvents protocol. */ +static constexpr const char *kServerSentEvents = "server_sent_events"; +/** LongPolling protocol. */ +static constexpr const char *kLongPolling = "long_polling"; +/** WebSockets protocol. */ +static constexpr const char *kWebSockets = "web_sockets"; +} // namespace SignalrTransportValues + namespace JvmMemoryTypeValues { /** Heap memory. */ @@ -1837,14 +2113,6 @@ static constexpr const char *kMajor = "major"; static constexpr const char *kMinor = "minor"; } // namespace SystemPagingTypeValues -namespace SystemDiskDirectionValues -{ -/** read. */ -static constexpr const char *kRead = "read"; -/** write. */ -static constexpr const char *kWrite = "write"; -} // namespace SystemDiskDirectionValues - namespace SystemFilesystemStateValues { /** used. */ @@ -1871,14 +2139,6 @@ static constexpr const char *kHfsplus = "hfsplus"; static constexpr const char *kExt4 = "ext4"; } // namespace SystemFilesystemTypeValues -namespace SystemNetworkDirectionValues -{ -/** transmit. */ -static constexpr const char *kTransmit = "transmit"; -/** receive. */ -static constexpr const char *kReceive = "receive"; -} // namespace SystemNetworkDirectionValues - namespace SystemNetworkStateValues { /** close. */ @@ -1907,17 +2167,209 @@ static constexpr const char *kSynSent = "syn_sent"; static constexpr const char *kTimeWait = "time_wait"; } // namespace SystemNetworkStateValues -namespace SystemProcessesStatusValues +namespace SystemProcessesStatusValues +{ +/** running. */ +static constexpr const char *kRunning = "running"; +/** sleeping. */ +static constexpr const char *kSleeping = "sleeping"; +/** stopped. */ +static constexpr const char *kStopped = "stopped"; +/** defunct. */ +static constexpr const char *kDefunct = "defunct"; +} // namespace SystemProcessesStatusValues + +namespace DbCassandraConsistencyLevelValues +{ +/** all. */ +static constexpr const char *kAll = "all"; +/** each_quorum. */ +static constexpr const char *kEachQuorum = "each_quorum"; +/** quorum. */ +static constexpr const char *kQuorum = "quorum"; +/** local_quorum. */ +static constexpr const char *kLocalQuorum = "local_quorum"; +/** one. */ +static constexpr const char *kOne = "one"; +/** two. */ +static constexpr const char *kTwo = "two"; +/** three. */ +static constexpr const char *kThree = "three"; +/** local_one. */ +static constexpr const char *kLocalOne = "local_one"; +/** any. */ +static constexpr const char *kAny = "any"; +/** serial. */ +static constexpr const char *kSerial = "serial"; +/** local_serial. */ +static constexpr const char *kLocalSerial = "local_serial"; +} // namespace DbCassandraConsistencyLevelValues + +namespace DbCosmosdbConnectionModeValues +{ +/** Gateway (HTTP) connections mode. */ +static constexpr const char *kGateway = "gateway"; +/** Direct connection. */ +static constexpr const char *kDirect = "direct"; +} // namespace DbCosmosdbConnectionModeValues + +namespace DbCosmosdbOperationTypeValues +{ +/** invalid. */ +static constexpr const char *kInvalid = "Invalid"; +/** create. */ +static constexpr const char *kCreate = "Create"; +/** patch. */ +static constexpr const char *kPatch = "Patch"; +/** read. */ +static constexpr const char *kRead = "Read"; +/** read_feed. */ +static constexpr const char *kReadFeed = "ReadFeed"; +/** delete. */ +static constexpr const char *kDelete = "Delete"; +/** replace. */ +static constexpr const char *kReplace = "Replace"; +/** execute. */ +static constexpr const char *kExecute = "Execute"; +/** query. */ +static constexpr const char *kQuery = "Query"; +/** head. */ +static constexpr const char *kHead = "Head"; +/** head_feed. */ +static constexpr const char *kHeadFeed = "HeadFeed"; +/** upsert. */ +static constexpr const char *kUpsert = "Upsert"; +/** batch. */ +static constexpr const char *kBatch = "Batch"; +/** query_plan. */ +static constexpr const char *kQueryPlan = "QueryPlan"; +/** execute_javascript. */ +static constexpr const char *kExecuteJavascript = "ExecuteJavaScript"; +} // namespace DbCosmosdbOperationTypeValues + +namespace DbSystemValues +{ +/** Some other SQL database. Fallback only. See notes. */ +static constexpr const char *kOtherSql = "other_sql"; +/** Microsoft SQL Server. */ +static constexpr const char *kMssql = "mssql"; +/** Microsoft SQL Server Compact. */ +static constexpr const char *kMssqlcompact = "mssqlcompact"; +/** MySQL. */ +static constexpr const char *kMysql = "mysql"; +/** Oracle Database. */ +static constexpr const char *kOracle = "oracle"; +/** IBM Db2. */ +static constexpr const char *kDb2 = "db2"; +/** PostgreSQL. */ +static constexpr const char *kPostgresql = "postgresql"; +/** Amazon Redshift. */ +static constexpr const char *kRedshift = "redshift"; +/** Apache Hive. */ +static constexpr const char *kHive = "hive"; +/** Cloudscape. */ +static constexpr const char *kCloudscape = "cloudscape"; +/** HyperSQL DataBase. */ +static constexpr const char *kHsqldb = "hsqldb"; +/** Progress Database. */ +static constexpr const char *kProgress = "progress"; +/** SAP MaxDB. */ +static constexpr const char *kMaxdb = "maxdb"; +/** SAP HANA. */ +static constexpr const char *kHanadb = "hanadb"; +/** Ingres. */ +static constexpr const char *kIngres = "ingres"; +/** FirstSQL. */ +static constexpr const char *kFirstsql = "firstsql"; +/** EnterpriseDB. */ +static constexpr const char *kEdb = "edb"; +/** InterSystems Caché. */ +static constexpr const char *kCache = "cache"; +/** Adabas (Adaptable Database System). */ +static constexpr const char *kAdabas = "adabas"; +/** Firebird. */ +static constexpr const char *kFirebird = "firebird"; +/** Apache Derby. */ +static constexpr const char *kDerby = "derby"; +/** FileMaker. */ +static constexpr const char *kFilemaker = "filemaker"; +/** Informix. */ +static constexpr const char *kInformix = "informix"; +/** InstantDB. */ +static constexpr const char *kInstantdb = "instantdb"; +/** InterBase. */ +static constexpr const char *kInterbase = "interbase"; +/** MariaDB. */ +static constexpr const char *kMariadb = "mariadb"; +/** Netezza. */ +static constexpr const char *kNetezza = "netezza"; +/** Pervasive PSQL. */ +static constexpr const char *kPervasive = "pervasive"; +/** PointBase. */ +static constexpr const char *kPointbase = "pointbase"; +/** SQLite. */ +static constexpr const char *kSqlite = "sqlite"; +/** Sybase. */ +static constexpr const char *kSybase = "sybase"; +/** Teradata. */ +static constexpr const char *kTeradata = "teradata"; +/** Vertica. */ +static constexpr const char *kVertica = "vertica"; +/** H2. */ +static constexpr const char *kH2 = "h2"; +/** ColdFusion IMQ. */ +static constexpr const char *kColdfusion = "coldfusion"; +/** Apache Cassandra. */ +static constexpr const char *kCassandra = "cassandra"; +/** Apache HBase. */ +static constexpr const char *kHbase = "hbase"; +/** MongoDB. */ +static constexpr const char *kMongodb = "mongodb"; +/** Redis. */ +static constexpr const char *kRedis = "redis"; +/** Couchbase. */ +static constexpr const char *kCouchbase = "couchbase"; +/** CouchDB. */ +static constexpr const char *kCouchdb = "couchdb"; +/** Microsoft Azure Cosmos DB. */ +static constexpr const char *kCosmosdb = "cosmosdb"; +/** Amazon DynamoDB. */ +static constexpr const char *kDynamodb = "dynamodb"; +/** Neo4j. */ +static constexpr const char *kNeo4j = "neo4j"; +/** Apache Geode. */ +static constexpr const char *kGeode = "geode"; +/** Elasticsearch. */ +static constexpr const char *kElasticsearch = "elasticsearch"; +/** Memcached. */ +static constexpr const char *kMemcached = "memcached"; +/** CockroachDB. */ +static constexpr const char *kCockroachdb = "cockroachdb"; +/** OpenSearch. */ +static constexpr const char *kOpensearch = "opensearch"; +/** ClickHouse. */ +static constexpr const char *kClickhouse = "clickhouse"; +/** Cloud Spanner. */ +static constexpr const char *kSpanner = "spanner"; +/** Trino. */ +static constexpr const char *kTrino = "trino"; +} // namespace DbSystemValues + +namespace HttpFlavorValues { -/** running. */ -static constexpr const char *kRunning = "running"; -/** sleeping. */ -static constexpr const char *kSleeping = "sleeping"; -/** stopped. */ -static constexpr const char *kStopped = "stopped"; -/** defunct. */ -static constexpr const char *kDefunct = "defunct"; -} // namespace SystemProcessesStatusValues +/** HTTP/1.0. */ +static constexpr const char *kHttp10 = "1.0"; +/** HTTP/1.1. */ +static constexpr const char *kHttp11 = "1.1"; +/** HTTP/2. */ +static constexpr const char *kHttp20 = "2.0"; +/** HTTP/3. */ +static constexpr const char *kHttp30 = "3.0"; +/** SPDY protocol. */ +static constexpr const char *kSpdy = "SPDY"; +/** QUIC protocol. */ +static constexpr const char *kQuic = "QUIC"; +} // namespace HttpFlavorValues namespace NetSockFamilyValues { @@ -1943,6 +2395,20 @@ static constexpr const char *kInproc = "inproc"; static constexpr const char *kOther = "other"; } // namespace NetTransportValues +namespace DiskIoDirectionValues +{ +/** read. */ +static constexpr const char *kRead = "read"; +/** write. */ +static constexpr const char *kWrite = "write"; +} // namespace DiskIoDirectionValues + +namespace ErrorTypeValues +{ +/** A fallback error value to be used when the instrumentation doesn't define a custom value. */ +static constexpr const char *kOther = "_OTHER"; +} // namespace ErrorTypeValues + namespace HttpRequestMethodValues { /** CONNECT method. */ @@ -2004,6 +2470,30 @@ static constexpr const char *kDelay = "delay"; static constexpr const char *kTransaction = "transaction"; } // namespace MessagingRocketmqMessageTypeValues +namespace MessagingSystemValues +{ +/** Apache ActiveMQ. */ +static constexpr const char *kActivemq = "activemq"; +/** Amazon Simple Queue Service (SQS). */ +static constexpr const char *kAwsSqs = "aws_sqs"; +/** Azure Event Grid. */ +static constexpr const char *kAzureEventgrid = "azure_eventgrid"; +/** Azure Event Hubs. */ +static constexpr const char *kAzureEventhubs = "azure_eventhubs"; +/** Azure Service Bus. */ +static constexpr const char *kAzureServicebus = "azure_servicebus"; +/** Google Cloud Pub/Sub. */ +static constexpr const char *kGcpPubsub = "gcp_pubsub"; +/** Java Message Service. */ +static constexpr const char *kJms = "jms"; +/** Apache Kafka. */ +static constexpr const char *kKafka = "kafka"; +/** RabbitMQ. */ +static constexpr const char *kRabbitmq = "rabbitmq"; +/** Apache RocketMQ. */ +static constexpr const char *kRocketmq = "rocketmq"; +} // namespace MessagingSystemValues + namespace NetworkConnectionSubtypeValues { /** GPRS. */ @@ -2064,6 +2554,14 @@ static constexpr const char *kUnavailable = "unavailable"; static constexpr const char *kUnknown = "unknown"; } // namespace NetworkConnectionTypeValues +namespace NetworkIoDirectionValues +{ +/** transmit. */ +static constexpr const char *kTransmit = "transmit"; +/** receive. */ +static constexpr const char *kReceive = "receive"; +} // namespace NetworkIoDirectionValues + namespace NetworkTransportValues { /** TCP. */ @@ -2172,6 +2670,14 @@ static constexpr const char *kApacheDubbo = "apache_dubbo"; static constexpr const char *kConnectRpc = "connect_rpc"; } // namespace RpcSystemValues +namespace TlsProtocolNameValues +{ +/** ssl. */ +static constexpr const char *kSsl = "ssl"; +/** tls. */ +static constexpr const char *kTls = "tls"; +} // namespace TlsProtocolNameValues + namespace OpentracingRefTypeValues { /** The parent Span depends on the child Span in some capacity. */ @@ -2180,182 +2686,6 @@ static constexpr const char *kChildOf = "child_of"; static constexpr const char *kFollowsFrom = "follows_from"; } // namespace OpentracingRefTypeValues -namespace DbSystemValues -{ -/** Some other SQL database. Fallback only. See notes. */ -static constexpr const char *kOtherSql = "other_sql"; -/** Microsoft SQL Server. */ -static constexpr const char *kMssql = "mssql"; -/** Microsoft SQL Server Compact. */ -static constexpr const char *kMssqlcompact = "mssqlcompact"; -/** MySQL. */ -static constexpr const char *kMysql = "mysql"; -/** Oracle Database. */ -static constexpr const char *kOracle = "oracle"; -/** IBM Db2. */ -static constexpr const char *kDb2 = "db2"; -/** PostgreSQL. */ -static constexpr const char *kPostgresql = "postgresql"; -/** Amazon Redshift. */ -static constexpr const char *kRedshift = "redshift"; -/** Apache Hive. */ -static constexpr const char *kHive = "hive"; -/** Cloudscape. */ -static constexpr const char *kCloudscape = "cloudscape"; -/** HyperSQL DataBase. */ -static constexpr const char *kHsqldb = "hsqldb"; -/** Progress Database. */ -static constexpr const char *kProgress = "progress"; -/** SAP MaxDB. */ -static constexpr const char *kMaxdb = "maxdb"; -/** SAP HANA. */ -static constexpr const char *kHanadb = "hanadb"; -/** Ingres. */ -static constexpr const char *kIngres = "ingres"; -/** FirstSQL. */ -static constexpr const char *kFirstsql = "firstsql"; -/** EnterpriseDB. */ -static constexpr const char *kEdb = "edb"; -/** InterSystems Caché. */ -static constexpr const char *kCache = "cache"; -/** Adabas (Adaptable Database System). */ -static constexpr const char *kAdabas = "adabas"; -/** Firebird. */ -static constexpr const char *kFirebird = "firebird"; -/** Apache Derby. */ -static constexpr const char *kDerby = "derby"; -/** FileMaker. */ -static constexpr const char *kFilemaker = "filemaker"; -/** Informix. */ -static constexpr const char *kInformix = "informix"; -/** InstantDB. */ -static constexpr const char *kInstantdb = "instantdb"; -/** InterBase. */ -static constexpr const char *kInterbase = "interbase"; -/** MariaDB. */ -static constexpr const char *kMariadb = "mariadb"; -/** Netezza. */ -static constexpr const char *kNetezza = "netezza"; -/** Pervasive PSQL. */ -static constexpr const char *kPervasive = "pervasive"; -/** PointBase. */ -static constexpr const char *kPointbase = "pointbase"; -/** SQLite. */ -static constexpr const char *kSqlite = "sqlite"; -/** Sybase. */ -static constexpr const char *kSybase = "sybase"; -/** Teradata. */ -static constexpr const char *kTeradata = "teradata"; -/** Vertica. */ -static constexpr const char *kVertica = "vertica"; -/** H2. */ -static constexpr const char *kH2 = "h2"; -/** ColdFusion IMQ. */ -static constexpr const char *kColdfusion = "coldfusion"; -/** Apache Cassandra. */ -static constexpr const char *kCassandra = "cassandra"; -/** Apache HBase. */ -static constexpr const char *kHbase = "hbase"; -/** MongoDB. */ -static constexpr const char *kMongodb = "mongodb"; -/** Redis. */ -static constexpr const char *kRedis = "redis"; -/** Couchbase. */ -static constexpr const char *kCouchbase = "couchbase"; -/** CouchDB. */ -static constexpr const char *kCouchdb = "couchdb"; -/** Microsoft Azure Cosmos DB. */ -static constexpr const char *kCosmosdb = "cosmosdb"; -/** Amazon DynamoDB. */ -static constexpr const char *kDynamodb = "dynamodb"; -/** Neo4j. */ -static constexpr const char *kNeo4j = "neo4j"; -/** Apache Geode. */ -static constexpr const char *kGeode = "geode"; -/** Elasticsearch. */ -static constexpr const char *kElasticsearch = "elasticsearch"; -/** Memcached. */ -static constexpr const char *kMemcached = "memcached"; -/** CockroachDB. */ -static constexpr const char *kCockroachdb = "cockroachdb"; -/** OpenSearch. */ -static constexpr const char *kOpensearch = "opensearch"; -/** ClickHouse. */ -static constexpr const char *kClickhouse = "clickhouse"; -/** Cloud Spanner. */ -static constexpr const char *kSpanner = "spanner"; -/** Trino. */ -static constexpr const char *kTrino = "trino"; -} // namespace DbSystemValues - -namespace DbCassandraConsistencyLevelValues -{ -/** all. */ -static constexpr const char *kAll = "all"; -/** each_quorum. */ -static constexpr const char *kEachQuorum = "each_quorum"; -/** quorum. */ -static constexpr const char *kQuorum = "quorum"; -/** local_quorum. */ -static constexpr const char *kLocalQuorum = "local_quorum"; -/** one. */ -static constexpr const char *kOne = "one"; -/** two. */ -static constexpr const char *kTwo = "two"; -/** three. */ -static constexpr const char *kThree = "three"; -/** local_one. */ -static constexpr const char *kLocalOne = "local_one"; -/** any. */ -static constexpr const char *kAny = "any"; -/** serial. */ -static constexpr const char *kSerial = "serial"; -/** local_serial. */ -static constexpr const char *kLocalSerial = "local_serial"; -} // namespace DbCassandraConsistencyLevelValues - -namespace DbCosmosdbConnectionModeValues -{ -/** Gateway (HTTP) connections mode. */ -static constexpr const char *kGateway = "gateway"; -/** Direct connection. */ -static constexpr const char *kDirect = "direct"; -} // namespace DbCosmosdbConnectionModeValues - -namespace DbCosmosdbOperationTypeValues -{ -/** invalid. */ -static constexpr const char *kInvalid = "Invalid"; -/** create. */ -static constexpr const char *kCreate = "Create"; -/** patch. */ -static constexpr const char *kPatch = "Patch"; -/** read. */ -static constexpr const char *kRead = "Read"; -/** read_feed. */ -static constexpr const char *kReadFeed = "ReadFeed"; -/** delete. */ -static constexpr const char *kDelete = "Delete"; -/** replace. */ -static constexpr const char *kReplace = "Replace"; -/** execute. */ -static constexpr const char *kExecute = "Execute"; -/** query. */ -static constexpr const char *kQuery = "Query"; -/** head. */ -static constexpr const char *kHead = "Head"; -/** head_feed. */ -static constexpr const char *kHeadFeed = "HeadFeed"; -/** upsert. */ -static constexpr const char *kUpsert = "Upsert"; -/** batch. */ -static constexpr const char *kBatch = "Batch"; -/** query_plan. */ -static constexpr const char *kQueryPlan = "QueryPlan"; -/** execute_javascript. */ -static constexpr const char *kExecuteJavascript = "ExecuteJavaScript"; -} // namespace DbCosmosdbOperationTypeValues - namespace OtelStatusCodeValues { /** The operation has been validated by an Application developer or Operator to have completed diff --git a/api/test/context/propagation/composite_propagator_test.cc b/api/test/context/propagation/composite_propagator_test.cc index 918f8cedd4..5bf18710ed 100644 --- a/api/test/context/propagation/composite_propagator_test.cc +++ b/api/test/context/propagation/composite_propagator_test.cc @@ -93,6 +93,23 @@ TEST_F(CompositePropagatorTest, Extract) EXPECT_EQ(Hex(span->GetContext().span_id()), "e457b5a2e4d86bd1"); EXPECT_EQ(span->GetContext().IsSampled(), true); EXPECT_EQ(span->GetContext().IsRemote(), true); + + // Now check that last propagator does not win if there is no header for it + carrier.headers_ = {{"traceparent", "00-4bf92f3577b34da6a3ce929d0e0e4736-0102030405060708-00"}}; + ctx1 = context::Context{}; + + ctx2 = composite_propagator_->Extract(carrier, ctx1); + + ctx2_span = ctx2.GetValue(trace::kSpanKey); + EXPECT_TRUE(nostd::holds_alternative>(ctx2_span)); + + span = nostd::get>(ctx2_span); + + // Here the first propagator (W3C) wins + EXPECT_EQ(Hex(span->GetContext().trace_id()), "4bf92f3577b34da6a3ce929d0e0e4736"); + EXPECT_EQ(Hex(span->GetContext().span_id()), "0102030405060708"); + EXPECT_EQ(span->GetContext().IsSampled(), false); + EXPECT_EQ(span->GetContext().IsRemote(), true); } TEST_F(CompositePropagatorTest, Inject) diff --git a/api/test/trace/propagation/b3_propagation_test.cc b/api/test/trace/propagation/b3_propagation_test.cc index 2538b5be29..9791c54378 100644 --- a/api/test/trace/propagation/b3_propagation_test.cc +++ b/api/test/trace/propagation/b3_propagation_test.cc @@ -51,7 +51,7 @@ TEST(B3PropagationTest, PropagateInvalidContext) // Do not propagate invalid trace context. TextMapCarrierTest carrier; context::Context ctx{ - "current-span", + trace::kSpanKey, nostd::shared_ptr(new trace::DefaultSpan(trace::SpanContext::GetInvalid()))}; format.Inject(carrier, ctx); EXPECT_TRUE(carrier.headers_.count("b3") == 0); @@ -64,8 +64,26 @@ TEST(B3PropagationTest, ExtractInvalidContext) context::Context ctx1 = context::Context{}; context::Context ctx2 = format.Extract(carrier, ctx1); auto ctx2_span = ctx2.GetValue(trace::kSpanKey); + EXPECT_FALSE(nostd::holds_alternative>(ctx2_span)); +} + +TEST(B3PropagationTest, DoNotOverwriteContextWithInvalidSpan) +{ + TextMapCarrierTest carrier; + constexpr uint8_t buf_span[] = {1, 2, 3, 4, 5, 6, 7, 8}; + constexpr uint8_t buf_trace[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + trace::SpanContext span_context{trace::TraceId{buf_trace}, trace::SpanId{buf_span}, + trace::TraceFlags{true}, false}; + nostd::shared_ptr sp{new trace::DefaultSpan{span_context}}; + + // Make sure this invalid span does not overwrite the active span context + carrier.headers_ = {{"b3", "00000000000000000000000000000000-0000000000000000-0"}}; + context::Context ctx1{trace::kSpanKey, sp}; + context::Context ctx2 = format.Extract(carrier, ctx1); + auto ctx2_span = ctx2.GetValue(trace::kSpanKey); auto span = nostd::get>(ctx2_span); - EXPECT_EQ(span->GetContext().IsRemote(), false); + + EXPECT_EQ(Hex(span->GetContext().trace_id()), "0102030405060708090a0b0c0d0e0f10"); } TEST(B3PropagationTest, DoNotExtractWithInvalidHex) @@ -75,8 +93,7 @@ TEST(B3PropagationTest, DoNotExtractWithInvalidHex) context::Context ctx1 = context::Context{}; context::Context ctx2 = format.Extract(carrier, ctx1); auto ctx2_span = ctx2.GetValue(trace::kSpanKey); - auto span = nostd::get>(ctx2_span); - EXPECT_EQ(span->GetContext().IsRemote(), false); + EXPECT_FALSE(nostd::holds_alternative>(ctx2_span)); } TEST(B3PropagationTest, SetRemoteSpan) diff --git a/api/test/trace/propagation/http_text_format_test.cc b/api/test/trace/propagation/http_text_format_test.cc index 8fa0e44ed2..e41e0fe65c 100644 --- a/api/test/trace/propagation/http_text_format_test.cc +++ b/api/test/trace/propagation/http_text_format_test.cc @@ -50,7 +50,7 @@ TEST(TextMapPropagatorTest, NoSendEmptyTraceState) TextMapCarrierTest carrier; carrier.headers_ = {{"traceparent", "00-4bf92f3577b34da6a3ce929d0e0e4736-0102030405060708-01"}}; context::Context ctx1 = context::Context{ - "current-span", + trace::kSpanKey, nostd::shared_ptr(new trace::DefaultSpan(trace::SpanContext::GetInvalid()))}; context::Context ctx2 = format.Extract(carrier, ctx1); TextMapCarrierTest carrier2; @@ -65,7 +65,7 @@ TEST(TextMapPropagatorTest, PropogateTraceState) carrier.headers_ = {{"traceparent", "00-4bf92f3577b34da6a3ce929d0e0e4736-0102030405060708-01"}, {"tracestate", "congo=t61rcWkgMzE"}}; context::Context ctx1 = context::Context{ - "current-span", + trace::kSpanKey, nostd::shared_ptr(new trace::DefaultSpan(trace::SpanContext::GetInvalid()))}; context::Context ctx2 = format.Extract(carrier, ctx1); @@ -82,7 +82,7 @@ TEST(TextMapPropagatorTest, PropagateInvalidContext) // Do not propagate invalid trace context. TextMapCarrierTest carrier; context::Context ctx{ - "current-span", + trace::kSpanKey, nostd::shared_ptr(new trace::DefaultSpan(trace::SpanContext::GetInvalid()))}; format.Inject(carrier, ctx); EXPECT_TRUE(carrier.headers_.count("traceparent") == 0); @@ -107,6 +107,25 @@ TEST(TextMapPropagatorTest, SetRemoteSpan) EXPECT_EQ(span->GetContext().IsRemote(), true); } +TEST(TextMapPropagatorTest, DoNotOverwriteContextWithInvalidSpan) +{ + TextMapCarrierTest carrier; + constexpr uint8_t buf_span[] = {1, 2, 3, 4, 5, 6, 7, 8}; + constexpr uint8_t buf_trace[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + trace::SpanContext span_context{trace::TraceId{buf_trace}, trace::SpanId{buf_span}, + trace::TraceFlags{true}, false}; + nostd::shared_ptr sp{new trace::DefaultSpan{span_context}}; + + // Make sure this invalid span does not overwrite the active span context + carrier.headers_ = {{"traceparent", "00-FOO92f3577b34da6a3ce929d0e0e4736-010BAR0405060708-01"}}; + context::Context ctx1{trace::kSpanKey, sp}; + context::Context ctx2 = format.Extract(carrier, ctx1); + auto ctx2_span = ctx2.GetValue(trace::kSpanKey); + auto span = nostd::get>(ctx2_span); + + EXPECT_EQ(Hex(span->GetContext().trace_id()), "0102030405060708090a0b0c0d0e0f10"); +} + TEST(TextMapPropagatorTest, GetCurrentSpan) { TextMapCarrierTest carrier; @@ -165,7 +184,7 @@ TEST(GlobalTextMapPropagator, NoOpPropagator) carrier.headers_ = {{"traceparent", "00-4bf92f3577b34da6a3ce929d0e0e4736-0102030405060708-01"}, {"tracestate", "congo=t61rcWkgMzE"}}; context::Context ctx1 = context::Context{ - "current-span", + trace::kSpanKey, nostd::shared_ptr(new trace::DefaultSpan(trace::SpanContext::GetInvalid()))}; context::Context ctx2 = propagator->Extract(carrier, ctx1); @@ -189,7 +208,7 @@ TEST(GlobalPropagator, SetAndGet) carrier.headers_ = {{"traceparent", "00-4bf92f3577b34da6a3ce929d0e0e4736-0102030405060708-01"}, {"tracestate", trace_state_value}}; context::Context ctx1 = context::Context{ - "current-span", + trace::kSpanKey, nostd::shared_ptr(new trace::DefaultSpan(trace::SpanContext::GetInvalid()))}; context::Context ctx2 = propagator->Extract(carrier, ctx1); diff --git a/api/test/trace/propagation/jaeger_propagation_test.cc b/api/test/trace/propagation/jaeger_propagation_test.cc index c337617383..add38eac6c 100644 --- a/api/test/trace/propagation/jaeger_propagation_test.cc +++ b/api/test/trace/propagation/jaeger_propagation_test.cc @@ -134,6 +134,25 @@ TEST(JaegerPropagatorTest, ExctractInvalidSpans) } } +TEST(JaegerPropagatorTest, DoNotOverwriteContextWithInvalidSpan) +{ + TextMapCarrierTest carrier; + constexpr uint8_t buf_span[] = {1, 2, 3, 4, 5, 6, 7, 8}; + constexpr uint8_t buf_trace[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + trace::SpanContext span_context{trace::TraceId{buf_trace}, trace::SpanId{buf_span}, + trace::TraceFlags{true}, false}; + nostd::shared_ptr sp{new trace::DefaultSpan{span_context}}; + + // Make sure this invalid span does not overwrite the active span context + carrier.headers_ = {{"uber-trace-id", "foo:bar:0:00"}}; + context::Context ctx1{trace::kSpanKey, sp}; + context::Context ctx2 = format.Extract(carrier, ctx1); + auto ctx2_span = ctx2.GetValue(trace::kSpanKey); + auto span = nostd::get>(ctx2_span); + + EXPECT_EQ(Hex(span->GetContext().trace_id()), "0102030405060708090a0b0c0d0e0f10"); +} + TEST(JaegerPropagatorTest, InjectsContext) { TextMapCarrierTest carrier; @@ -161,7 +180,7 @@ TEST(JaegerPropagatorTest, DoNotInjectInvalidContext) { TextMapCarrierTest carrier; context::Context ctx{ - "current-span", + trace::kSpanKey, nostd::shared_ptr(new trace::DefaultSpan(trace::SpanContext::GetInvalid()))}; format.Inject(carrier, ctx); EXPECT_TRUE(carrier.headers_.count("uber-trace-id") == 0); diff --git a/buildscripts/semantic-convention/generate.sh b/buildscripts/semantic-convention/generate.sh index 1994869439..f4785a19f6 100755 --- a/buildscripts/semantic-convention/generate.sh +++ b/buildscripts/semantic-convention/generate.sh @@ -18,7 +18,7 @@ ROOT_DIR="${SCRIPT_DIR}/../../" # https://github.com/open-telemetry/opentelemetry-specification # Repository from 1.21.0: # https://github.com/open-telemetry/semantic-conventions -SEMCONV_VERSION=1.23.1 +SEMCONV_VERSION=1.24.0 # repository: https://github.com/open-telemetry/build-tools GENERATOR_VERSION=0.23.0 diff --git a/buildscripts/semantic-convention/templates/SemanticAttributes.h.j2 b/buildscripts/semantic-convention/templates/SemanticAttributes.h.j2 index d35b99444e..3ec0317d4d 100644 --- a/buildscripts/semantic-convention/templates/SemanticAttributes.h.j2 +++ b/buildscripts/semantic-convention/templates/SemanticAttributes.h.j2 @@ -4,8 +4,14 @@ */ {# Adapted from: - opentelemetry-java/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 + https://github.com/open-telemetry/semantic-conventions-java/blob/main/buildscripts/templates/SemanticAttributes.java.j2 for opentelemetry-cpp + + For doc on the template syntax: + https://jinja.palletsprojects.com/en/3.0.x/ + + For doc on the semantic convention: + https://github.com/open-telemetry/build-tools/tree/main/semantic-conventions #} {%- macro to_cpp_return_type(type) -%} {%- if type == "string" -%} @@ -60,12 +66,12 @@ static constexpr const char *kSchemaUrl = "{{schemaUrl}}"; *

Notes:

    {{attribute.note | render_markdown(code="{{@code {0}}}", paragraph="
  • {0}
  • ", list="{0}")}}
{%- endif %} -{%- if (attribute.stability | string()) == "StabilityLevel.DEPRECATED" %} +{%- if (attribute.deprecated) %} * * @deprecated {{attribute.brief | to_doc_brief}}. {%- endif %} */ - {%- if (attribute.stability | string()) == "StabilityLevel.DEPRECATED" %} + {%- if (attribute.deprecated) %} OPENTELEMETRY_DEPRECATED {%- endif %} static constexpr const char *k{{attribute.fqn | to_camelcase(True)}} = "{{attribute.fqn}}"; diff --git a/docs/building-with-stdlib.md b/docs/building-with-stdlib.md index 22b8935595..7dd72eeccf 100644 --- a/docs/building-with-stdlib.md +++ b/docs/building-with-stdlib.md @@ -159,15 +159,15 @@ Valid values for `OPENTELEMETRY_STL_VERSION` are `2011`, `2014`, `2017`, `2020` List of compilers that support building with standard library classes: -Compiler | Language standard | Notes --------------------|-------------------|------------------- -Visual Studio 2015 | C++14 | requires `gsl::span` for `std::span` implementation -Visual Studio 2017 | C++17 | requires `gsl::span` for `std::span` implementation -Visual Studio 2019 | C++20 | -Xcode 11.x | C++17 | requires `gsl::span` for `std::span` implementation -Xcode 12.x | C++20 | -gcc-7 | C++17 | requires `gsl::span` for `std::span` implementation -gcc-9+ | C++20 | +| Compiler | Language standard | Notes | +| ------------------ | ----------------- | --------------------------------------------------- | +| Visual Studio 2015 | C++14 | requires `gsl::span` for `std::span` implementation | +| Visual Studio 2017 | C++17 | requires `gsl::span` for `std::span` implementation | +| Visual Studio 2019 | C++20 | | +| Xcode 11.x | C++17 | requires `gsl::span` for `std::span` implementation | +| Xcode 12.x | C++20 | | +| gcc-7 | C++17 | requires `gsl::span` for `std::span` implementation | +| gcc-9+ | C++20 | | If SDK is compiled without standard library classes, then `nostd::variant` implementation internally uses a private snapshot of [Abseil diff --git a/examples/metrics_simple/README.md b/examples/metrics_simple/README.md index 7e4f832160..1e2b1517d1 100644 --- a/examples/metrics_simple/README.md +++ b/examples/metrics_simple/README.md @@ -1,5 +1,8 @@ # Simple Metrics Example +See [INSTALL.md](../../INSTALL.md) for instructions on building and +running the example. + This example initializes the metrics pipeline with 3 different instrument types: - [Counter](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#counter) @@ -44,8 +47,9 @@ custom aggregation config, and attribute processor. Metrics SDK will implicitly create a missing view with default mapping between Instrument and Aggregation. ```cpp + std::string counter_name = "counter_name"; std::unique_ptr instrument_selector{ - new metric_sdk::InstrumentSelector(metric_sdk::InstrumentType::kCounter, "counter_name")}; + new metric_sdk::InstrumentSelector(metric_sdk::InstrumentType::kCounter, counter_name)}; std::unique_ptr meter_selector{ new metric_sdk::MeterSelector(name, version, schema)}; std::unique_ptr sum_view{ @@ -111,6 +115,3 @@ Ensure to keep the Instrument object active for the lifetime of collection. auto counter = meter->CreateDoubleObservableCounter(counter_name); counter->AddCallback(MeasurementFetcher::Fetcher, nullptr); ``` - -See [INSTALL.md](../../INSTALL.md) for instructions on building and -running the example. diff --git a/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h b/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h index b72ff4f917..31d63af983 100644 --- a/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h +++ b/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h @@ -7,7 +7,6 @@ #include "opentelemetry/common/spin_lock_mutex.h" #include "opentelemetry/ext/http/client/http_client_factory.h" #include "opentelemetry/nostd/shared_ptr.h" -#include "opentelemetry/nostd/type_traits.h" #include "opentelemetry/sdk/logs/exporter.h" #include "opentelemetry/sdk/logs/recordable.h" diff --git a/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter.h b/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter.h index a2897a5f26..ba5b28b9de 100644 --- a/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter.h +++ b/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter.h @@ -5,7 +5,7 @@ #include "opentelemetry/common/attribute_value.h" #include "opentelemetry/common/spin_lock_mutex.h" -#include "opentelemetry/nostd/type_traits.h" +#include "opentelemetry/nostd/span.h" #include "opentelemetry/sdk/common/attribute_utils.h" #include "opentelemetry/sdk/logs/exporter.h" diff --git a/exporters/ostream/include/opentelemetry/exporters/ostream/span_exporter.h b/exporters/ostream/include/opentelemetry/exporters/ostream/span_exporter.h index 03c95c23f9..139653686d 100644 --- a/exporters/ostream/include/opentelemetry/exporters/ostream/span_exporter.h +++ b/exporters/ostream/include/opentelemetry/exporters/ostream/span_exporter.h @@ -4,7 +4,7 @@ #pragma once #include "opentelemetry/common/spin_lock_mutex.h" -#include "opentelemetry/nostd/type_traits.h" +#include "opentelemetry/nostd/span.h" #include "opentelemetry/sdk/trace/exporter.h" #include "opentelemetry/sdk/trace/span_data.h" #include "opentelemetry/version.h" diff --git a/opentracing-shim/include/opentelemetry/opentracingshim/propagation.h b/opentracing-shim/include/opentelemetry/opentracingshim/propagation.h index c226d9da83..b2a9be5a80 100644 --- a/opentracing-shim/include/opentelemetry/opentracingshim/propagation.h +++ b/opentracing-shim/include/opentelemetry/opentracingshim/propagation.h @@ -8,7 +8,8 @@ #include "opentelemetry/baggage/baggage.h" #include "opentelemetry/common/attribute_value.h" #include "opentelemetry/context/propagation/text_map_propagator.h" -#include "opentelemetry/nostd/type_traits.h" +#include "opentelemetry/nostd/function_ref.h" +#include "opentelemetry/nostd/string_view.h" #include "opentracing/propagation.h" #include "opentracing/value.h" diff --git a/sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h b/sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h index 35b0dc6863..4f7c9069bf 100644 --- a/sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h +++ b/sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h @@ -4,10 +4,10 @@ #pragma once #include +#include #include "opentelemetry/common/key_value_iterable_view.h" #include "opentelemetry/nostd/string_view.h" -#include "opentelemetry/nostd/type_traits.h" #include "opentelemetry/nostd/unique_ptr.h" #include "opentelemetry/nostd/variant.h" #include "opentelemetry/sdk/common/attribute_utils.h" @@ -73,7 +73,7 @@ class InstrumentationScope */ template < class ArgumentType, - nostd::enable_if_t::value> + std::enable_if_t::value> * = nullptr> static nostd::unique_ptr Create(nostd::string_view name, nostd::string_view version, diff --git a/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h b/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h index 37ad328ae5..add4b9bed7 100644 --- a/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h +++ b/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h @@ -24,7 +24,7 @@ namespace SemanticConventions /** * The URL of the OpenTelemetry schema for these keys and values. */ -static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.23.1"; +static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.24.0"; /** * The cloud account ID the resource is assigned to. @@ -176,620 +176,629 @@ static constexpr const char *kContainerName = "container.name"; static constexpr const char *kContainerRuntime = "container.runtime"; /** - * The digest of the OCI image manifest. For container images specifically is the digest by which -the container image is known. + * A unique identifier representing the device * *

Notes: -

+
  • The device identifier MUST only be defined using the values outlined below. This value is + not an advertising identifier and MUST NOT be used as such. On iOS (Swift or Objective-C), this + value MUST be equal to the vendor + identifier. On Android (Java or Kotlin), this value MUST be equal to the Firebase Installation + ID or a globally unique UUID which is persisted across sessions in your application. More + information can be found here on best practices and + exact implementation details. Caution should be taken when storing personal data or anything which + can identify a user. GDPR and data protection laws may apply, ensure you do your own due + diligence.
*/ -static constexpr const char *kOciManifestDigest = "oci.manifest.digest"; +static constexpr const char *kDeviceId = "device.id"; /** - * Uniquely identifies the framework API revision offered by a version ({@code os.version}) of the - * android operating system. More information can be found here. + * The name of the device manufacturer + * + *

Notes: +

  • The Android OS provides this field via Build. iOS apps + SHOULD hardcode the value {@code Apple}.
*/ -static constexpr const char *kAndroidOsApiLevel = "android.os.api_level"; +static constexpr const char *kDeviceManufacturer = "device.manufacturer"; /** - * Array of brand name and version separated by a space + * The model identifier for the device * *

Notes: -

  • This value is intended to be taken from the UA client hints API ({@code - navigator.userAgentData.brands}).
+
  • It's recommended this value represents a machine-readable version of the model identifier + rather than the market or consumer-friendly name of the device.
*/ -static constexpr const char *kBrowserBrands = "browser.brands"; +static constexpr const char *kDeviceModelIdentifier = "device.model.identifier"; /** - * Preferred language of the user using the browser + * The marketing name for the device model * *

Notes: -

  • This value is intended to be taken from the Navigator API {@code - navigator.language}.
+
  • It's recommended this value represents a human-readable version of the device model + rather than a machine-readable alternative.
*/ -static constexpr const char *kBrowserLanguage = "browser.language"; +static constexpr const char *kDeviceModelName = "device.model.name"; /** - * A boolean that is true if the browser is running on a mobile device - * - *

Notes: -

  • This value is intended to be taken from the UA client hints API ({@code - navigator.userAgentData.mobile}). If unavailable, this attribute SHOULD be left unset.
+ * The CPU architecture the host system is running on. */ -static constexpr const char *kBrowserMobile = "browser.mobile"; +static constexpr const char *kHostArch = "host.arch"; /** - * The platform on which the browser is running - * - *

Notes: -

  • This value is intended to be taken from the UA client hints API ({@code -navigator.userAgentData.platform}). If unavailable, the legacy {@code navigator.platform} API SHOULD -NOT be used instead and this attribute SHOULD be left unset in order for the values to be -consistent. The list of possible values is defined in the W3C User-Agent Client Hints -specification. Note that some (but not all) of these values can overlap with values in the {@code os.type} and {@code os.name} attributes. However, for consistency, the -values in the {@code browser.platform} attribute should capture the exact value that the user agent -provides.
+ * The amount of level 2 memory cache available to the processor (in Bytes). */ -static constexpr const char *kBrowserPlatform = "browser.platform"; +static constexpr const char *kHostCpuCacheL2Size = "host.cpu.cache.l2.size"; /** - * The ARN of an ECS cluster. + * Family or generation of the CPU. */ -static constexpr const char *kAwsEcsClusterArn = "aws.ecs.cluster.arn"; +static constexpr const char *kHostCpuFamily = "host.cpu.family"; /** - * The Amazon Resource Name (ARN) of an ECS - * container instance. + * Model identifier. It provides more granular information about the CPU, distinguishing it from + * other CPUs within the same family. */ -static constexpr const char *kAwsEcsContainerArn = "aws.ecs.container.arn"; +static constexpr const char *kHostCpuModelId = "host.cpu.model.id"; /** - * The launch - * type for an ECS task. + * Model designation of the processor. */ -static constexpr const char *kAwsEcsLaunchtype = "aws.ecs.launchtype"; +static constexpr const char *kHostCpuModelName = "host.cpu.model.name"; /** - * The ARN of an ECS task - * definition. + * Stepping or core revisions. */ -static constexpr const char *kAwsEcsTaskArn = "aws.ecs.task.arn"; +static constexpr const char *kHostCpuStepping = "host.cpu.stepping"; /** - * The task definition family this task definition is a member of. + * Processor manufacturer identifier. A maximum 12-character string. + * + *

Notes: +

  • CPUID command returns the vendor ID string in + EBX, EDX and ECX registers. Writing these to memory in this order results in a 12-character + string.
*/ -static constexpr const char *kAwsEcsTaskFamily = "aws.ecs.task.family"; +static constexpr const char *kHostCpuVendorId = "host.cpu.vendor.id"; /** - * The revision for this task definition. + * 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 *kAwsEcsTaskRevision = "aws.ecs.task.revision"; +static constexpr const char *kHostId = "host.id"; /** - * The ARN of an EKS cluster. + * VM image ID or host OS image ID. For Cloud, this value is from the provider. */ -static constexpr const char *kAwsEksClusterArn = "aws.eks.cluster.arn"; +static constexpr const char *kHostImageId = "host.image.id"; /** - * The Amazon Resource Name(s) (ARN) of the AWS log group(s). - * - *

Notes: -

+ * Name of the VM image or OS install the host was instantiated from. */ -static constexpr const char *kAwsLogGroupArns = "aws.log.group.arns"; +static constexpr const char *kHostImageName = "host.image.name"; /** - * The name(s) of the AWS log group(s) an application is writing to. + * 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: -

  • Multiple log groups must be supported for cases like multi-container applications, where - a single application has sidecar containers, and each write to their own log group.
+
  • IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 addresses MUST be + specified in the RFC 5952 format.
  • +
*/ -static constexpr const char *kAwsLogGroupNames = "aws.log.group.names"; +static constexpr const char *kHostIp = "host.ip"; /** - * The ARN(s) of the AWS log stream(s). + * Available MAC addresses of the host, excluding loopback interfaces. * *

Notes: -

+
  • MAC Addresses MUST be represented in IEEE RA + hexadecimal form: as hyphen-separated octets in uppercase hexadecimal form from most to least + significant.
*/ -static constexpr const char *kAwsLogStreamArns = "aws.log.stream.arns"; +static constexpr const char *kHostMac = "host.mac"; /** - * The name(s) of the AWS log stream(s) an application is writing to. + * 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 *kAwsLogStreamNames = "aws.log.stream.names"; +static constexpr const char *kHostName = "host.name"; /** - * The name of the Cloud Run execution being run for the - * Job, as set by the {@code - * CLOUD_RUN_EXECUTION} environment variable. + * Type of host. For Cloud, this must be the machine type. */ -static constexpr const char *kGcpCloudRunJobExecution = "gcp.cloud_run.job.execution"; +static constexpr const char *kHostType = "host.type"; /** - * The index for a task within an execution as provided by the {@code - * CLOUD_RUN_TASK_INDEX} environment variable. + * The name of the cluster. */ -static constexpr const char *kGcpCloudRunJobTaskIndex = "gcp.cloud_run.job.task_index"; +static constexpr const char *kK8sClusterName = "k8s.cluster.name"; /** - * The hostname of a GCE instance. This is the full value of the default or custom hostname. + * A pseudo-ID for the cluster, set to the UID of the {@code kube-system} namespace. + * + *

Notes: +

  • K8s doesn't have support for obtaining a cluster ID. If this is ever +added, we will recommend collecting the {@code k8s.cluster.uid} through the +official APIs. In the meantime, we are able to use the {@code uid} of the +{@code kube-system} namespace as a proxy for cluster ID. Read on for the +rationale.
  • Every object created in a K8s cluster is assigned a distinct UID. The +{@code kube-system} namespace is used by Kubernetes itself and will exist +for the lifetime of the cluster. Using the {@code uid} of the {@code kube-system} +namespace is a reasonable proxy for the K8s ClusterID as it will only +change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are +UUIDs as standardized by +ISO/IEC 9834-8 and ITU-T X.667. +Which states:
  • +
  • If generated according to one of the mechanisms defined in Rec.
  • +
  • ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be + different from all other UUIDs generated before 3603 A.D., or is + extremely likely to be different (depending on the mechanism chosen).
  • Therefore, UIDs +between clusters should be extremely unlikely to conflict.
*/ -static constexpr const char *kGcpGceInstanceHostname = "gcp.gce.instance.hostname"; +static constexpr const char *kK8sClusterUid = "k8s.cluster.uid"; /** - * 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. + * 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 *kGcpGceInstanceName = "gcp.gce.instance.name"; +static constexpr const char *kK8sContainerName = "k8s.container.name"; /** - * Unique identifier for the application + * 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 *kHerokuAppId = "heroku.app.id"; +static constexpr const char *kK8sContainerRestartCount = "k8s.container.restart_count"; /** - * Commit hash for the current release + * The name of the CronJob. */ -static constexpr const char *kHerokuReleaseCommit = "heroku.release.commit"; +static constexpr const char *kK8sCronjobName = "k8s.cronjob.name"; /** - * Time and date the release was created + * The UID of the CronJob. */ -static constexpr const char *kHerokuReleaseCreationTimestamp = "heroku.release.creation_timestamp"; +static constexpr const char *kK8sCronjobUid = "k8s.cronjob.uid"; /** - * Name of the deployment - * environment (aka deployment tier). + * The name of the DaemonSet. */ -static constexpr const char *kDeploymentEnvironment = "deployment.environment"; +static constexpr const char *kK8sDaemonsetName = "k8s.daemonset.name"; /** - * A unique identifier representing the device - * - *

Notes: -

  • The device identifier MUST only be defined using the values outlined below. This value is - not an advertising identifier and MUST NOT be used as such. On iOS (Swift or Objective-C), this - value MUST be equal to the vendor - identifier. On Android (Java or Kotlin), this value MUST be equal to the Firebase Installation - ID or a globally unique UUID which is persisted across sessions in your application. More - information can be found here on best practices and - exact implementation details. Caution should be taken when storing personal data or anything which - can identify a user. GDPR and data protection laws may apply, ensure you do your own due - diligence.
+ * The UID of the DaemonSet. */ -static constexpr const char *kDeviceId = "device.id"; +static constexpr const char *kK8sDaemonsetUid = "k8s.daemonset.uid"; /** - * The name of the device manufacturer - * - *

Notes: -

  • The Android OS provides this field via Build. iOS apps - SHOULD hardcode the value {@code Apple}.
+ * The name of the Deployment. */ -static constexpr const char *kDeviceManufacturer = "device.manufacturer"; +static constexpr const char *kK8sDeploymentName = "k8s.deployment.name"; /** - * The model identifier for the device - * - *

Notes: -

  • It's recommended this value represents a machine readable version of the model identifier - rather than the market or consumer-friendly name of the device.
+ * The UID of the Deployment. */ -static constexpr const char *kDeviceModelIdentifier = "device.model.identifier"; +static constexpr const char *kK8sDeploymentUid = "k8s.deployment.uid"; /** - * The marketing name for the device model - * - *

Notes: -

  • It's recommended this value represents a human readable version of the device model - rather than a machine readable alternative.
+ * The name of the Job. */ -static constexpr const char *kDeviceModelName = "device.model.name"; +static constexpr const char *kK8sJobName = "k8s.job.name"; /** - * The execution environment ID as a string, that will be potentially reused for other invocations - to the same function/function version. - * - *

Notes: -

  • AWS Lambda: Use the (full) log stream name.
  • -
+ * The UID of the Job. */ -static constexpr const char *kFaasInstance = "faas.instance"; +static constexpr const char *kK8sJobUid = "k8s.job.uid"; /** - * The amount of memory available to the serverless function converted to Bytes. - * - *

Notes: -

  • It's recommended to set this attribute since e.g. too little memory can easily stop a - Java AWS Lambda function from working correctly. On AWS Lambda, the environment variable {@code - AWS_LAMBDA_FUNCTION_MEMORY_SIZE} provides this information (which must be multiplied by - 1,048,576).
+ * The name of the namespace that the pod is running in. */ -static constexpr const char *kFaasMaxMemory = "faas.max_memory"; +static constexpr const char *kK8sNamespaceName = "k8s.namespace.name"; /** - * The name of the single function that this runtime instance executes. - * - *

Notes: -

  • This is the name of the function as configured/deployed on the FaaS -platform and is usually different from the name of the callback -function (which may be stored in the -{@code code.namespace}/{@code -code.function} span attributes).
  • For some cloud providers, the above definition is -ambiguous. The following definition of function name MUST be used for this attribute (and -consequently the span name) for the listed cloud providers/products:
  • Azure: -The full name {@code /}, i.e., function app name followed by a forward slash followed -by the function name (this form can also be seen in the resource JSON for the function). This means -that a span attribute MUST be used, as an Azure function app can host multiple functions that would -usually share a TracerProvider (see also the {@code cloud.resource_id} attribute).
  • -
+ * The name of the Node. */ -static constexpr const char *kFaasName = "faas.name"; +static constexpr const char *kK8sNodeName = "k8s.node.name"; /** - * The immutable version of the function being executed. - * - *

Notes: -

  • Depending on the cloud provider and platform, use:
  • AWS Lambda: -The function -version (an integer represented as a decimal string).
  • Google Cloud Run -(Services): The revision -(i.e., the function name plus the revision suffix).
  • -
  • Google Cloud Functions: The value of the -{@code -K_REVISION} environment variable.
  • Azure Functions: Not applicable. Do -not set this attribute.
  • -
+ * The UID of the Node. */ -static constexpr const char *kFaasVersion = "faas.version"; +static constexpr const char *kK8sNodeUid = "k8s.node.uid"; /** - * The CPU architecture the host system is running on. + * The name of the Pod. */ -static constexpr const char *kHostArch = "host.arch"; +static constexpr const char *kK8sPodName = "k8s.pod.name"; /** - * 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. + * The UID of the Pod. */ -static constexpr const char *kHostId = "host.id"; +static constexpr const char *kK8sPodUid = "k8s.pod.uid"; /** - * VM image ID or host OS image ID. For Cloud, this value is from the provider. + * The name of the ReplicaSet. */ -static constexpr const char *kHostImageId = "host.image.id"; +static constexpr const char *kK8sReplicasetName = "k8s.replicaset.name"; /** - * Name of the VM image or OS install the host was instantiated from. + * The UID of the ReplicaSet. */ -static constexpr const char *kHostImageName = "host.image.name"; +static constexpr const char *kK8sReplicasetUid = "k8s.replicaset.uid"; /** - * The version string of the VM image or host OS as defined in Version Attributes. + * The name of the StatefulSet. */ -static constexpr const char *kHostImageVersion = "host.image.version"; +static constexpr const char *kK8sStatefulsetName = "k8s.statefulset.name"; /** - * Available IP addresses of the host, excluding loopback interfaces. - * - *

Notes: -

  • IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 addresses MUST be - specified in the RFC 5952 format.
  • -
+ * The UID of the StatefulSet. */ -static constexpr const char *kHostIp = "host.ip"; +static constexpr const char *kK8sStatefulsetUid = "k8s.statefulset.uid"; /** - * Available MAC addresses of the host, excluding loopback interfaces. + * The digest of the OCI image manifest. For container images specifically is the digest by which +the container image is known. * *

Notes: -

  • MAC Addresses MUST be represented in IEEE RA - hexadecimal form: as hyphen-separated octets in uppercase hexadecimal form from most to least - significant.
- */ -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"; +static constexpr const char *kOciManifestDigest = "oci.manifest.digest"; /** - * Type of host. For Cloud, this must be the machine type. + * Unique identifier for a particular build or compilation of the operating system. */ -static constexpr const char *kHostType = "host.type"; +static constexpr const char *kOsBuildId = "os.build_id"; /** - * The amount of level 2 memory cache available to the processor (in Bytes). + * 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 *kHostCpuCacheL2Size = "host.cpu.cache.l2.size"; +static constexpr const char *kOsDescription = "os.description"; /** - * Numeric value specifying the family or generation of the CPU. + * Human readable operating system name. */ -static constexpr const char *kHostCpuFamily = "host.cpu.family"; +static constexpr const char *kOsName = "os.name"; /** - * Model identifier. It provides more granular information about the CPU, distinguishing it from - * other CPUs within the same family. + * The operating system type. */ -static constexpr const char *kHostCpuModelId = "host.cpu.model.id"; +static constexpr const char *kOsType = "os.type"; /** - * Model designation of the processor. + * The version string of the operating system as defined in Version Attributes. */ -static constexpr const char *kHostCpuModelName = "host.cpu.model.name"; +static constexpr const char *kOsVersion = "os.version"; /** - * Stepping or core revisions. + * 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 *kHostCpuStepping = "host.cpu.stepping"; +static constexpr const char *kProcessCommand = "process.command"; /** - * Processor manufacturer identifier. A maximum 12-character string. - * - *

Notes: -

  • CPUID command returns the vendor ID string in - EBX, EDX and ECX registers. Writing these to memory in this order results in a 12-character - string.
+ * 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 *kHostCpuVendorId = "host.cpu.vendor.id"; +static constexpr const char *kProcessCommandArgs = "process.command_args"; /** - * The name of the cluster. + * 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 *kK8sClusterName = "k8s.cluster.name"; +static constexpr const char *kProcessCommandLine = "process.command_line"; /** - * A pseudo-ID for the cluster, set to the UID of the {@code kube-system} namespace. - * - *

Notes: -

  • K8s doesn't have support for obtaining a cluster ID. If this is ever -added, we will recommend collecting the {@code k8s.cluster.uid} through the -official APIs. In the meantime, we are able to use the {@code uid} of the -{@code kube-system} namespace as a proxy for cluster ID. Read on for the -rationale.
  • Every object created in a K8s cluster is assigned a distinct UID. The -{@code kube-system} namespace is used by Kubernetes itself and will exist -for the lifetime of the cluster. Using the {@code uid} of the {@code kube-system} -namespace is a reasonable proxy for the K8s ClusterID as it will only -change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are -UUIDs as standardized by -ISO/IEC 9834-8 and ITU-T X.667. -Which states:
  • -
  • If generated according to one of the mechanisms defined in Rec.
  • -
  • ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be - different from all other UUIDs generated before 3603 A.D., or is - extremely likely to be different (depending on the mechanism chosen).
  • Therefore, UIDs -between clusters should be extremely unlikely to conflict.
+ * 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 *kK8sClusterUid = "k8s.cluster.uid"; +static constexpr const char *kProcessExecutableName = "process.executable.name"; /** - * The name of the Node. + * 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 *kK8sNodeName = "k8s.node.name"; +static constexpr const char *kProcessExecutablePath = "process.executable.path"; /** - * The UID of the Node. + * The username of the user that owns the process. */ -static constexpr const char *kK8sNodeUid = "k8s.node.uid"; +static constexpr const char *kProcessOwner = "process.owner"; /** - * The name of the namespace that the pod is running in. + * Parent Process identifier (PPID). */ -static constexpr const char *kK8sNamespaceName = "k8s.namespace.name"; +static constexpr const char *kProcessParentPid = "process.parent_pid"; /** - * The name of the Pod. + * Process identifier (PID). */ -static constexpr const char *kK8sPodName = "k8s.pod.name"; +static constexpr const char *kProcessPid = "process.pid"; /** - * The UID of the Pod. + * An additional description about the runtime of the process, for example a specific vendor + * customization of the runtime environment. */ -static constexpr const char *kK8sPodUid = "k8s.pod.uid"; +static constexpr const char *kProcessRuntimeDescription = "process.runtime.description"; /** - * 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}). + * The name of the runtime of this process. For compiled native binaries, this SHOULD be the name of + * the compiler. */ -static constexpr const char *kK8sContainerName = "k8s.container.name"; +static constexpr const char *kProcessRuntimeName = "process.runtime.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. + * The version of the runtime of this process, as returned by the runtime without modification. */ -static constexpr const char *kK8sContainerRestartCount = "k8s.container.restart_count"; +static constexpr const char *kProcessRuntimeVersion = "process.runtime.version"; /** - * The name of the ReplicaSet. + * 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 *kK8sReplicasetName = "k8s.replicaset.name"; +static constexpr const char *kAndroidOsApiLevel = "android.os.api_level"; /** - * The UID of the ReplicaSet. + * Array of brand name and version separated by a space + * + *

Notes: +

  • This value is intended to be taken from the UA client hints API ({@code + navigator.userAgentData.brands}).
*/ -static constexpr const char *kK8sReplicasetUid = "k8s.replicaset.uid"; +static constexpr const char *kBrowserBrands = "browser.brands"; /** - * The name of the Deployment. + * Preferred language of the user using the browser + * + *

Notes: +

  • This value is intended to be taken from the Navigator API {@code + navigator.language}.
*/ -static constexpr const char *kK8sDeploymentName = "k8s.deployment.name"; +static constexpr const char *kBrowserLanguage = "browser.language"; /** - * The UID of the Deployment. + * A boolean that is true if the browser is running on a mobile device + * + *

Notes: +

  • This value is intended to be taken from the UA client hints API ({@code + navigator.userAgentData.mobile}). If unavailable, this attribute SHOULD be left unset.
*/ -static constexpr const char *kK8sDeploymentUid = "k8s.deployment.uid"; +static constexpr const char *kBrowserMobile = "browser.mobile"; /** - * The name of the StatefulSet. + * The platform on which the browser is running + * + *

Notes: +

  • This value is intended to be taken from the UA client hints API ({@code +navigator.userAgentData.platform}). If unavailable, the legacy {@code navigator.platform} API SHOULD +NOT be used instead and this attribute SHOULD be left unset in order for the values to be +consistent. The list of possible values is defined in the W3C User-Agent Client Hints +specification. Note that some (but not all) of these values can overlap with values in the {@code os.type} and {@code os.name} attributes. However, for consistency, the +values in the {@code browser.platform} attribute should capture the exact value that the user agent +provides.
*/ -static constexpr const char *kK8sStatefulsetName = "k8s.statefulset.name"; +static constexpr const char *kBrowserPlatform = "browser.platform"; /** - * The UID of the StatefulSet. + * The ARN of an ECS cluster. */ -static constexpr const char *kK8sStatefulsetUid = "k8s.statefulset.uid"; +static constexpr const char *kAwsEcsClusterArn = "aws.ecs.cluster.arn"; /** - * The name of the DaemonSet. + * The Amazon Resource Name (ARN) of an ECS + * container instance. */ -static constexpr const char *kK8sDaemonsetName = "k8s.daemonset.name"; +static constexpr const char *kAwsEcsContainerArn = "aws.ecs.container.arn"; /** - * The UID of the DaemonSet. + * The launch + * type for an ECS task. */ -static constexpr const char *kK8sDaemonsetUid = "k8s.daemonset.uid"; +static constexpr const char *kAwsEcsLaunchtype = "aws.ecs.launchtype"; /** - * The name of the Job. + * The ARN of an ECS task + * definition. */ -static constexpr const char *kK8sJobName = "k8s.job.name"; +static constexpr const char *kAwsEcsTaskArn = "aws.ecs.task.arn"; /** - * The UID of the Job. + * The task definition family this task definition is a member of. */ -static constexpr const char *kK8sJobUid = "k8s.job.uid"; +static constexpr const char *kAwsEcsTaskFamily = "aws.ecs.task.family"; /** - * The name of the CronJob. + * The revision for this task definition. */ -static constexpr const char *kK8sCronjobName = "k8s.cronjob.name"; +static constexpr const char *kAwsEcsTaskRevision = "aws.ecs.task.revision"; /** - * The UID of the CronJob. + * The ARN of an EKS cluster. */ -static constexpr const char *kK8sCronjobUid = "k8s.cronjob.uid"; +static constexpr const char *kAwsEksClusterArn = "aws.eks.cluster.arn"; /** - * Unique identifier for a particular build or compilation of the operating system. + * The Amazon Resource Name(s) (ARN) of the AWS log group(s). + * + *

Notes: +

*/ -static constexpr const char *kOsBuildId = "os.build_id"; +static constexpr const char *kAwsLogGroupArns = "aws.log.group.arns"; /** - * Human readable (not intended to be parsed) OS version information, like e.g. reported by {@code - * ver} or {@code lsb_release -a} commands. + * The name(s) of the AWS log group(s) an application is writing to. + * + *

Notes: +

  • Multiple log groups must be supported for cases like multi-container applications, where + a single application has sidecar containers, and each write to their own log group.
*/ -static constexpr const char *kOsDescription = "os.description"; +static constexpr const char *kAwsLogGroupNames = "aws.log.group.names"; /** - * Human readable operating system name. + * The ARN(s) of the AWS log stream(s). + * + *

Notes: +

*/ -static constexpr const char *kOsName = "os.name"; +static constexpr const char *kAwsLogStreamArns = "aws.log.stream.arns"; /** - * The operating system type. + * The name(s) of the AWS log stream(s) an application is writing to. */ -static constexpr const char *kOsType = "os.type"; +static constexpr const char *kAwsLogStreamNames = "aws.log.stream.names"; /** - * The version string of the operating system as defined in Version Attributes. + * 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 *kOsVersion = "os.version"; +static constexpr const char *kGcpCloudRunJobExecution = "gcp.cloud_run.job.execution"; /** - * 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}. + * The index for a task within an execution as provided by the {@code + * CLOUD_RUN_TASK_INDEX} environment variable. */ -static constexpr const char *kProcessCommand = "process.command"; +static constexpr const char *kGcpCloudRunJobTaskIndex = "gcp.cloud_run.job.task_index"; /** - * 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}. + * The hostname of a GCE instance. This is the full value of the default or custom hostname. */ -static constexpr const char *kProcessCommandArgs = "process.command_args"; +static constexpr const char *kGcpGceInstanceHostname = "gcp.gce.instance.hostname"; /** - * 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. + * 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 *kProcessCommandLine = "process.command_line"; +static constexpr const char *kGcpGceInstanceName = "gcp.gce.instance.name"; /** - * 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}. + * Unique identifier for the application */ -static constexpr const char *kProcessExecutableName = "process.executable.name"; +static constexpr const char *kHerokuAppId = "heroku.app.id"; /** - * 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}. + * Commit hash for the current release */ -static constexpr const char *kProcessExecutablePath = "process.executable.path"; +static constexpr const char *kHerokuReleaseCommit = "heroku.release.commit"; /** - * The username of the user that owns the process. + * Time and date the release was created */ -static constexpr const char *kProcessOwner = "process.owner"; +static constexpr const char *kHerokuReleaseCreationTimestamp = "heroku.release.creation_timestamp"; /** - * Parent Process identifier (PID). + * Name of the deployment +environment (aka deployment tier). + * + *

Notes: +

  • {@code deployment.environment} does not affect the uniqueness constraints defined through +the {@code service.namespace}, {@code service.name} and {@code service.instance.id} resource +attributes. This implies that resources carrying the following attribute combinations MUST be +considered to be identifying the same service:
  • {@code service.name=frontend}, {@code +deployment.environment=production}
  • {@code service.name=frontend}, {@code +deployment.environment=staging}.
  • +
*/ -static constexpr const char *kProcessParentPid = "process.parent_pid"; +static constexpr const char *kDeploymentEnvironment = "deployment.environment"; /** - * Process identifier (PID). + * The execution environment ID as a string, that will be potentially reused for other invocations + to the same function/function version. + * + *

Notes: +

  • AWS Lambda: Use the (full) log stream name.
  • +
*/ -static constexpr const char *kProcessPid = "process.pid"; +static constexpr const char *kFaasInstance = "faas.instance"; /** - * An additional description about the runtime of the process, for example a specific vendor - * customization of the runtime environment. + * The amount of memory available to the serverless function converted to Bytes. + * + *

Notes: +

  • It's recommended to set this attribute since e.g. too little memory can easily stop a + Java AWS Lambda function from working correctly. On AWS Lambda, the environment variable {@code + AWS_LAMBDA_FUNCTION_MEMORY_SIZE} provides this information (which must be multiplied by + 1,048,576).
*/ -static constexpr const char *kProcessRuntimeDescription = "process.runtime.description"; +static constexpr const char *kFaasMaxMemory = "faas.max_memory"; /** - * The name of the runtime of this process. For compiled native binaries, this SHOULD be the name of - * the compiler. + * The name of the single function that this runtime instance executes. + * + *

Notes: +

  • This is the name of the function as configured/deployed on the FaaS +platform and is usually different from the name of the callback +function (which may be stored in the +{@code code.namespace}/{@code +code.function} span attributes).
  • For some cloud providers, the above definition is +ambiguous. The following definition of function name MUST be used for this attribute (and +consequently the span name) for the listed cloud providers/products:
  • Azure: +The full name {@code /}, i.e., function app name followed by a forward slash followed +by the function name (this form can also be seen in the resource JSON for the function). This means +that a span attribute MUST be used, as an Azure function app can host multiple functions that would +usually share a TracerProvider (see also the {@code cloud.resource_id} attribute).
  • +
*/ -static constexpr const char *kProcessRuntimeName = "process.runtime.name"; +static constexpr const char *kFaasName = "faas.name"; /** - * The version of the runtime of this process, as returned by the runtime without modification. + * The immutable version of the function being executed. + * + *

Notes: +

  • Depending on the cloud provider and platform, use:
  • AWS Lambda: +The function +version (an integer represented as a decimal string).
  • Google Cloud Run +(Services): The revision +(i.e., the function name plus the revision suffix).
  • +
  • Google Cloud Functions: The value of the +{@code +K_REVISION} environment variable.
  • Azure Functions: Not applicable. Do +not set this attribute.
  • +
*/ -static constexpr const char *kProcessRuntimeVersion = "process.runtime.version"; +static constexpr const char *kFaasVersion = "faas.version"; /** * Logical name of the service. @@ -904,18 +913,12 @@ static constexpr const char *kOtelScopeVersion = "otel.scope.version"; /** * Deprecated, use the {@code otel.scope.name} attribute. - * - * @deprecated Deprecated, use the `otel.scope.name` attribute. */ -OPENTELEMETRY_DEPRECATED static constexpr const char *kOtelLibraryName = "otel.library.name"; /** * Deprecated, use the {@code otel.scope.version} attribute. - * - * @deprecated Deprecated, use the `otel.scope.version` attribute. */ -OPENTELEMETRY_DEPRECATED static constexpr const char *kOtelLibraryVersion = "otel.library.version"; // Enum definitions @@ -995,14 +998,6 @@ static constexpr const char *kIbmCloud = "ibm_cloud"; static constexpr const char *kTencentCloud = "tencent_cloud"; } // namespace CloudProviderValues -namespace AwsEcsLaunchtypeValues -{ -/** ec2. */ -static constexpr const char *kEc2 = "ec2"; -/** fargate. */ -static constexpr const char *kFargate = "fargate"; -} // namespace AwsEcsLaunchtypeValues - namespace HostArchValues { /** AMD64. */ @@ -1049,6 +1044,14 @@ static constexpr const char *kSolaris = "solaris"; static constexpr const char *kZOs = "z_os"; } // namespace OsTypeValues +namespace AwsEcsLaunchtypeValues +{ +/** ec2. */ +static constexpr const char *kEc2 = "ec2"; +/** fargate. */ +static constexpr const char *kFargate = "fargate"; +} // namespace AwsEcsLaunchtypeValues + namespace TelemetrySdkLanguageValues { /** cpp. */ diff --git a/third_party_release b/third_party_release index 7689cd8638..6031a829c1 100644 --- a/third_party_release +++ b/third_party_release @@ -22,4 +22,4 @@ nlohmann-json=v3.11.2 opentelemetry-proto=v1.1.0 opentracing-cpp=v1.6.0 prometheus-cpp=v1.1.0 -vcpkg=2022.08.15 +vcpkg=2023.10.19