diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0d8e3c7c47..0311312b2d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,8 @@ Increment the:
top level.[#2062](https://github.com/open-telemetry/opentelemetry-cpp/pull/2062)
* [EXPORTERS]Add `ForceFlush` for `LogRecordExporter` and `SpanExporter`
[#2000](https://github.com/open-telemetry/opentelemetry-cpp/pull/2000)
+* [SEMANTIC CONVENTIONS] Upgrade to version 1.19.0
+ [#2017](https://github.com/open-telemetry/opentelemetry-cpp/pull/2017)
Important changes:
diff --git a/api/include/opentelemetry/trace/semantic_conventions.h b/api/include/opentelemetry/trace/semantic_conventions.h
index d0485704ef..051d865f86 100644
--- a/api/include/opentelemetry/trace/semantic_conventions.h
+++ b/api/include/opentelemetry/trace/semantic_conventions.h
@@ -21,7 +21,7 @@ namespace SemanticConventions
/**
* The URL of the OpenTelemetry schema for these keys and values.
*/
-static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.18.0";
+static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.19.0";
/**
* The type of the exception (its fully-qualified class name, if applicable). The dynamic type of
@@ -40,6 +40,38 @@ static constexpr const char *kExceptionMessage = "exception.message";
*/
static constexpr const char *kExceptionStacktrace = "exception.stacktrace";
+/**
+ * HTTP request method.
+ */
+static constexpr const char *kHttpMethod = "http.method";
+
+/**
+ * HTTP response status code.
+ */
+static constexpr const char *kHttpStatusCode = "http.status_code";
+
+/**
+ * Kind of HTTP protocol used.
+ */
+static constexpr const char *kHttpFlavor = "http.flavor";
+
+/**
+ * The URI scheme identifying the used protocol.
+ */
+static constexpr const char *kHttpScheme = "http.scheme";
+
+/**
+ * The matched route (path template in the format used by the respective server framework). See note
+below
+ *
+ *
Notes:
+
- MUST NOT be populated when this is not supported by the HTTP server framework as the
+route attribute should have low-cardinality and the URI path can NOT substitute it. SHOULD include
+the application
+root if there is one.
+ */
+static constexpr const char *kHttpRoute = "http.route";
+
/**
* The name identifies the event.
*/
@@ -59,7 +91,7 @@ static constexpr const char *kEventDomain = "event.domain";
Lambda-Runtime-Invoked-Function-Arn} header on the {@code /runtime/invocation/next} applicable).
*
* Notes:
-
- This may be different from {@code faas.id} if an alias is involved.
+ - This may be different from {@code cloud.resource_id} if an alias is involved.
*/
static constexpr const char *kAwsLambdaInvokedArn = "aws.lambda.invoked_arn";
@@ -255,7 +287,7 @@ static constexpr const char *kOtelStatusCode = "otel.status_code";
static constexpr const char *kOtelStatusDescription = "otel.status_description";
/**
- * Type of the trigger which caused this function execution.
+ * Type of the trigger which caused this function invocation.
*
* Notes:
- For the server/consumer span on the incoming side,
@@ -268,9 +300,9 @@ lambda, which is often HTTP).
static constexpr const char *kFaasTrigger = "faas.trigger";
/**
- * The execution ID of the current function execution.
+ * The invocation ID of the current function invocation.
*/
-static constexpr const char *kFaasExecution = "faas.execution";
+static constexpr const char *kFaasInvocationId = "faas.invocation_id";
/**
* The name of the source on which the triggering operation was performed. For example, in Cloud
@@ -343,6 +375,30 @@ static constexpr const char *kFaasInvokedProvider = "faas.invoked_provider";
*/
static constexpr const char *kFaasInvokedRegion = "faas.invoked_region";
+/**
+ * The unique identifier of the feature flag.
+ */
+static constexpr const char *kFeatureFlagKey = "feature_flag.key";
+
+/**
+ * The name of the service provider that performs the flag evaluation.
+ */
+static constexpr const char *kFeatureFlagProviderName = "feature_flag.provider_name";
+
+/**
+ * SHOULD be a semantic identifier for a value. If one is unavailable, a stringified version of the
+value can be used.
+ *
+ * Notes:
+
- A semantic identifier, commonly referred to as a variant, provides a means
+for referring to a value without including the value itself. This can
+provide additional context for understanding the meaning behind a value.
+For example, the variant {@code red} maybe be used for the value {@code #c05543}.
- A
+stringified version of the value can be used in situations where a semantic identifier is
+unavailable. String representation of the value should be determined by the implementer.
+ */
+static constexpr const char *kFeatureFlagVariant = "feature_flag.variant";
+
/**
* Transport protocol used. See note below.
*/
@@ -521,31 +577,6 @@ static constexpr const char *kCodeLineno = "code.lineno";
*/
static constexpr const char *kCodeColumn = "code.column";
-/**
- * HTTP request method.
- */
-static constexpr const char *kHttpMethod = "http.method";
-
-/**
- * HTTP response status code.
- */
-static constexpr const char *kHttpStatusCode = "http.status_code";
-
-/**
- * Kind of HTTP protocol used.
- *
- * Notes:
-
- If {@code net.transport} is not specified, it can be assumed to be {@code IP.TCP} except
- if {@code http.flavor} is {@code QUIC}, in which case {@code IP.UDP} is assumed.
- */
-static constexpr const char *kHttpFlavor = "http.flavor";
-
-/**
- * Value of the HTTP
- * User-Agent header sent by the client.
- */
-static constexpr const char *kHttpUserAgent = "http.user_agent";
-
/**
* The size of the request payload body in bytes. This is the number of bytes transferred excluding
* headers and is often, but not always, present as the Notes:
- - MUST NOT be populated when this is not supported by the HTTP server framework as the
-route attribute should have low-cardinality and the URI path can NOT substitute it. SHOULD include
-the application root if there is one.
- */
-static constexpr const char *kHttpRoute = "http.route";
-
/**
* The IP address of the original client behind all proxies, if known (e.g. from X-Forwarded-For).
@@ -1054,7 +1069,79 @@ static constexpr const char *kRpcJsonrpcErrorCode = "rpc.jsonrpc.error_code";
*/
static constexpr const char *kRpcJsonrpcErrorMessage = "rpc.jsonrpc.error_message";
+/**
+ * Whether this is a received or sent message.
+ */
+static constexpr const char *kMessageType = "message.type";
+
+/**
+ * MUST be calculated as two different counters starting from {@code 1} one for sent messages and
+ one for received message.
+ *
+ * Notes:
+
- This way we guarantee that the values will be consistent between different
+ implementations.
+ */
+static constexpr const char *kMessageId = "message.id";
+
+/**
+ * Compressed size of the message in bytes.
+ */
+static constexpr const char *kMessageCompressedSize = "message.compressed_size";
+
+/**
+ * Uncompressed size of the message in bytes.
+ */
+static constexpr const char *kMessageUncompressedSize = "message.uncompressed_size";
+
+/**
+ * The error codes of the Connect
+ * request. Error codes are always string values.
+ */
+static constexpr const char *kRpcConnectRpcErrorCode = "rpc.connect_rpc.error_code";
+
+/**
+ * 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";
+
+/**
+ * Value of the HTTP
+ * User-Agent header sent by the client.
+ */
+static constexpr const char *kUserAgentOriginal = "user_agent.original";
+
// Enum definitions
+namespace HttpFlavorValues
+{
+/** 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 EventDomainValues
{
/** Events from browser apps. */
@@ -1336,22 +1423,6 @@ static constexpr const char *kNrnsa = "nrnsa";
static constexpr const char *kLteCa = "lte_ca";
} // namespace NetHostConnectionSubtypeValues
-namespace HttpFlavorValues
-{
-/** 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 GraphqlOperationTypeValues
{
/** GraphQL query. */
@@ -1418,6 +1489,8 @@ static constexpr const char *kJavaRmi = "java_rmi";
static constexpr const char *kDotnetWcf = "dotnet_wcf";
/** Apache Dubbo. */
static constexpr const char *kApacheDubbo = "apache_dubbo";
+/** Connect RPC. */
+static constexpr const char *kConnectRpc = "connect_rpc";
} // namespace RpcSystemValues
namespace RpcGrpcStatusCodeValues
@@ -1458,6 +1531,50 @@ static constexpr const int kDataLoss = 15;
static constexpr const int kUnauthenticated = 16;
} // namespace RpcGrpcStatusCodeValues
+namespace MessageTypeValues
+{
+/** sent. */
+static constexpr const char *kSent = "SENT";
+/** received. */
+static constexpr const char *kReceived = "RECEIVED";
+} // namespace MessageTypeValues
+
+namespace RpcConnectRpcErrorCodeValues
+{
+/** cancelled. */
+static constexpr const char *kCancelled = "cancelled";
+/** unknown. */
+static constexpr const char *kUnknown = "unknown";
+/** invalid_argument. */
+static constexpr const char *kInvalidArgument = "invalid_argument";
+/** deadline_exceeded. */
+static constexpr const char *kDeadlineExceeded = "deadline_exceeded";
+/** not_found. */
+static constexpr const char *kNotFound = "not_found";
+/** already_exists. */
+static constexpr const char *kAlreadyExists = "already_exists";
+/** permission_denied. */
+static constexpr const char *kPermissionDenied = "permission_denied";
+/** resource_exhausted. */
+static constexpr const char *kResourceExhausted = "resource_exhausted";
+/** failed_precondition. */
+static constexpr const char *kFailedPrecondition = "failed_precondition";
+/** aborted. */
+static constexpr const char *kAborted = "aborted";
+/** out_of_range. */
+static constexpr const char *kOutOfRange = "out_of_range";
+/** unimplemented. */
+static constexpr const char *kUnimplemented = "unimplemented";
+/** internal. */
+static constexpr const char *kInternal = "internal";
+/** unavailable. */
+static constexpr const char *kUnavailable = "unavailable";
+/** data_loss. */
+static constexpr const char *kDataLoss = "data_loss";
+/** unauthenticated. */
+static constexpr const char *kUnauthenticated = "unauthenticated";
+} // namespace RpcConnectRpcErrorCodeValues
+
} // namespace SemanticConventions
} // namespace trace
OPENTELEMETRY_END_NAMESPACE
diff --git a/buildscripts/semantic-convention/generate.sh b/buildscripts/semantic-convention/generate.sh
index ee9d3ae1a4..22f556c486 100755
--- a/buildscripts/semantic-convention/generate.sh
+++ b/buildscripts/semantic-convention/generate.sh
@@ -15,10 +15,10 @@ ROOT_DIR="${SCRIPT_DIR}/../../"
# freeze the spec & generator tools versions to make SemanticAttributes generation reproducible
# repository: https://github.com/open-telemetry/opentelemetry-specification
-SEMCONV_VERSION=1.18.0
+SEMCONV_VERSION=1.19.0
# repository: https://github.com/open-telemetry/build-tools
-GENERATOR_VERSION=0.15.1
+GENERATOR_VERSION=0.18.0
SPEC_VERSION=v$SEMCONV_VERSION
SCHEMA_URL=https://opentelemetry.io/schemas/$SEMCONV_VERSION
@@ -46,7 +46,7 @@ docker run --rm \
-v ${SCRIPT_DIR}/templates:/templates \
-v ${ROOT_DIR}/api/include/opentelemetry/trace/:/output \
otel/semconvgen:$GENERATOR_VERSION \
- --only span \
+ --only span,event,attribute_group,scope \
-f /source code \
--template /templates/SemanticAttributes.h.j2 \
--output /output/semantic_conventions.h \
diff --git a/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h b/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h
index 27aff268cc..895aa720d3 100644
--- a/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h
+++ b/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h
@@ -23,7 +23,7 @@ namespace SemanticConventions
/**
* The URL of the OpenTelemetry schema for these keys and values.
*/
-static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.18.0";
+static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.19.0";
/**
* Array of brand name and version separated by a space
@@ -62,16 +62,6 @@ static constexpr const char *kBrowserPlatform = "browser.platform";
*/
static constexpr const char *kBrowserMobile = "browser.mobile";
-/**
- * Full user-agent string provided by the browser
- *
- * Notes:
-
- The user-agent value SHOULD be provided only from browsers that do not have a mechanism
- to retrieve brands and platform individually from the User-Agent Client Hints API. To retrieve the
- value, the legacy {@code navigator.userAgent} API can be used.
- */
-static constexpr const char *kBrowserUserAgent = "browser.user_agent";
-
/**
* Preferred language of the user using the browser
*
@@ -100,11 +90,41 @@ static constexpr const char *kCloudAccountId = "cloud.account.id";
href="https://aws.amazon.com/about-aws/global-infrastructure/regions_az/">AWS regions, Azure regions, Google Cloud regions, or Tencent Cloud regions.
-
+ href="https://www.tencentcloud.com/document/product/213/6091">Tencent Cloud regions.
*/
static constexpr const char *kCloudRegion = "cloud.region";
+/**
+ * Cloud provider-specific native identifier of the monitored cloud resource (e.g. an ARN on AWS, a
+fully qualified
+resource ID on Azure, a full resource name
+on GCP)
+ *
+ * Notes:
+
- On some cloud providers, it may not be possible to determine the full ID at startup,
+so it may be necessary to set {@code cloud.resource_id} as a span attribute instead.
- The
+exact value to use for {@code cloud.resource_id} depends on the cloud provider. The following
+well-known definitions MUST be used if you set this attribute and they apply:
- AWS
+Lambda: The function ARN. Take care
+not to use the "invoked ARN" directly but replace any alias suffix with
+the resolved function version, as the same runtime instance may be invokable with multiple different
+aliases.
- GCP: The URI of the resource
+- Azure: The Fully Qualified
+Resource ID of the invoked function, not the function app, having the form
+{@code
+/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/}.
+This means that a span attribute MUST be used, as an Azure function app can host multiple functions
+that would usually share a TracerProvider.
+
+ */
+static constexpr const char *kCloudResourceId = "cloud.resource_id";
+
/**
* Cloud regions often have multiple, isolated locations known as zones to increase availability.
Availability zone represents the zone where the resource is running.
@@ -201,6 +221,21 @@ static constexpr const char *kAwsLogStreamNames = "aws.log.stream.names";
*/
static constexpr const char *kAwsLogStreamArns = "aws.log.stream.arns";
+/**
+ * Time and date the release was created
+ */
+static constexpr const char *kHerokuReleaseCreationTimestamp = "heroku.release.creation_timestamp";
+
+/**
+ * Commit hash for the current release
+ */
+static constexpr const char *kHerokuReleaseCommit = "heroku.release.commit";
+
+/**
+ * Unique identifier for the application
+ */
+static constexpr const char *kHerokuAppId = "heroku.app.id";
+
/**
* Container name used by container runtime.
*/
@@ -295,35 +330,11 @@ providers/products:Azure: The full name {@code
+the {@code cloud.resource_id} attribute).
*/
static constexpr const char *kFaasName = "faas.name";
-/**
- * The unique ID of the single function that this runtime instance executes.
- *
- * Notes:
-
- On some cloud providers, it may not be possible to determine the full ID at startup,
-so consider setting {@code faas.id} as a span attribute instead.
- The exact value to use for
-{@code faas.id} depends on the cloud provider:
- AWS Lambda: The function ARN. Take care
-not to use the "invoked ARN" directly but replace any alias suffix with
-the resolved function version, as the same runtime instance may be invokable with multiple different
-aliases.
- GCP: The URI of the resource
-- Azure: The Fully Qualified
-Resource ID of the invoked function, not the function app, having the form
-{@code
-/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/}.
-This means that a span attribute MUST be used, as an Azure function app can host multiple functions
-that would usually share a TracerProvider.
-
- */
-static constexpr const char *kFaasId = "faas.id";
-
/**
* The immutable version of the function being executed.
*
@@ -352,19 +363,20 @@ static constexpr const char *kFaasVersion = "faas.version";
static constexpr const char *kFaasInstance = "faas.instance";
/**
- * The amount of memory available to the serverless function in MiB.
+ * 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.
+ AWS_LAMBDA_FUNCTION_MEMORY_SIZE} provides this information (which must be multiplied by
+ 1,048,576).
*/
static constexpr const char *kFaasMaxMemory = "faas.max_memory";
/**
* Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For
- * non-containerized Linux systems, the {@code machine-id} located in {@code /etc/machine-id} or
- * {@code /var/lib/dbus/machine-id} may be used.
+ * non-containerized systems, this should be the {@code machine-id}. See the table below for the
+ * sources to use to determine the {@code machine-id} based on operating system.
*/
static constexpr const char *kHostId = "host.id";
@@ -703,6 +715,8 @@ static constexpr const char *kAws = "aws";
static constexpr const char *kAzure = "azure";
/** Google Cloud Platform. */
static constexpr const char *kGcp = "gcp";
+/** Heroku Platform as a Service. */
+static constexpr const char *kHeroku = "heroku";
/** IBM Cloud. */
static constexpr const char *kIbmCloud = "ibm_cloud";
/** Tencent Cloud. */