Skip to content

Commit 380f0f2

Browse files
authored
Upgraded semantic conventions to 1.19.0 (open-telemetry#2017)
1 parent 3305bd7 commit 380f0f2

File tree

4 files changed

+240
-107
lines changed

4 files changed

+240
-107
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Increment the:
2323
top level.[#2062](https://github.com/open-telemetry/opentelemetry-cpp/pull/2062)
2424
* [EXPORTERS]Add `ForceFlush` for `LogRecordExporter` and `SpanExporter`
2525
[#2000](https://github.com/open-telemetry/opentelemetry-cpp/pull/2000)
26+
* [SEMANTIC CONVENTIONS] Upgrade to version 1.19.0
27+
[#2017](https://github.com/open-telemetry/opentelemetry-cpp/pull/2017)
2628

2729
Important changes:
2830

api/include/opentelemetry/trace/semantic_conventions.h

+179-62
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace SemanticConventions
2121
/**
2222
* The URL of the OpenTelemetry schema for these keys and values.
2323
*/
24-
static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.18.0";
24+
static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.19.0";
2525

2626
/**
2727
* 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";
4040
*/
4141
static constexpr const char *kExceptionStacktrace = "exception.stacktrace";
4242

43+
/**
44+
* HTTP request method.
45+
*/
46+
static constexpr const char *kHttpMethod = "http.method";
47+
48+
/**
49+
* <a href="https://tools.ietf.org/html/rfc7231#section-6">HTTP response status code</a>.
50+
*/
51+
static constexpr const char *kHttpStatusCode = "http.status_code";
52+
53+
/**
54+
* Kind of HTTP protocol used.
55+
*/
56+
static constexpr const char *kHttpFlavor = "http.flavor";
57+
58+
/**
59+
* The URI scheme identifying the used protocol.
60+
*/
61+
static constexpr const char *kHttpScheme = "http.scheme";
62+
63+
/**
64+
* The matched route (path template in the format used by the respective server framework). See note
65+
below
66+
*
67+
* <p>Notes:
68+
<ul> <li>MUST NOT be populated when this is not supported by the HTTP server framework as the
69+
route attribute should have low-cardinality and the URI path can NOT substitute it. SHOULD include
70+
the <a href="/specification/trace/semantic_conventions/http.md#http-server-definitions">application
71+
root</a> if there is one.</li> </ul>
72+
*/
73+
static constexpr const char *kHttpRoute = "http.route";
74+
4375
/**
4476
* The name identifies the event.
4577
*/
@@ -59,7 +91,7 @@ static constexpr const char *kEventDomain = "event.domain";
5991
Lambda-Runtime-Invoked-Function-Arn} header on the {@code /runtime/invocation/next} applicable).
6092
*
6193
* <p>Notes:
62-
<ul> <li>This may be different from {@code faas.id} if an alias is involved.</li> </ul>
94+
<ul> <li>This may be different from {@code cloud.resource_id} if an alias is involved.</li> </ul>
6395
*/
6496
static constexpr const char *kAwsLambdaInvokedArn = "aws.lambda.invoked_arn";
6597

@@ -255,7 +287,7 @@ static constexpr const char *kOtelStatusCode = "otel.status_code";
255287
static constexpr const char *kOtelStatusDescription = "otel.status_description";
256288

257289
/**
258-
* Type of the trigger which caused this function execution.
290+
* Type of the trigger which caused this function invocation.
259291
*
260292
* <p>Notes:
261293
<ul> <li>For the server/consumer span on the incoming side,
@@ -268,9 +300,9 @@ lambda, which is often HTTP).</li> </ul>
268300
static constexpr const char *kFaasTrigger = "faas.trigger";
269301

270302
/**
271-
* The execution ID of the current function execution.
303+
* The invocation ID of the current function invocation.
272304
*/
273-
static constexpr const char *kFaasExecution = "faas.execution";
305+
static constexpr const char *kFaasInvocationId = "faas.invocation_id";
274306

275307
/**
276308
* 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";
343375
*/
344376
static constexpr const char *kFaasInvokedRegion = "faas.invoked_region";
345377

378+
/**
379+
* The unique identifier of the feature flag.
380+
*/
381+
static constexpr const char *kFeatureFlagKey = "feature_flag.key";
382+
383+
/**
384+
* The name of the service provider that performs the flag evaluation.
385+
*/
386+
static constexpr const char *kFeatureFlagProviderName = "feature_flag.provider_name";
387+
388+
/**
389+
* SHOULD be a semantic identifier for a value. If one is unavailable, a stringified version of the
390+
value can be used.
391+
*
392+
* <p>Notes:
393+
<ul> <li>A semantic identifier, commonly referred to as a variant, provides a means
394+
for referring to a value without including the value itself. This can
395+
provide additional context for understanding the meaning behind a value.
396+
For example, the variant {@code red} maybe be used for the value {@code #c05543}.</li><li>A
397+
stringified version of the value can be used in situations where a semantic identifier is
398+
unavailable. String representation of the value should be determined by the implementer.</li> </ul>
399+
*/
400+
static constexpr const char *kFeatureFlagVariant = "feature_flag.variant";
401+
346402
/**
347403
* Transport protocol used. See note below.
348404
*/
@@ -521,31 +577,6 @@ static constexpr const char *kCodeLineno = "code.lineno";
521577
*/
522578
static constexpr const char *kCodeColumn = "code.column";
523579

524-
/**
525-
* HTTP request method.
526-
*/
527-
static constexpr const char *kHttpMethod = "http.method";
528-
529-
/**
530-
* <a href="https://tools.ietf.org/html/rfc7231#section-6">HTTP response status code</a>.
531-
*/
532-
static constexpr const char *kHttpStatusCode = "http.status_code";
533-
534-
/**
535-
* Kind of HTTP protocol used.
536-
*
537-
* <p>Notes:
538-
<ul> <li>If {@code net.transport} is not specified, it can be assumed to be {@code IP.TCP} except
539-
if {@code http.flavor} is {@code QUIC}, in which case {@code IP.UDP} is assumed.</li> </ul>
540-
*/
541-
static constexpr const char *kHttpFlavor = "http.flavor";
542-
543-
/**
544-
* Value of the <a href="https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent">HTTP
545-
* User-Agent</a> header sent by the client.
546-
*/
547-
static constexpr const char *kHttpUserAgent = "http.user_agent";
548-
549580
/**
550581
* The size of the request payload body in bytes. This is the number of bytes transferred excluding
551582
* headers and is often, but not always, present as the <a
@@ -583,27 +614,11 @@ static constexpr const char *kHttpUrl = "http.url";
583614
*/
584615
static constexpr const char *kHttpResendCount = "http.resend_count";
585616

586-
/**
587-
* The URI scheme identifying the used protocol.
588-
*/
589-
static constexpr const char *kHttpScheme = "http.scheme";
590-
591617
/**
592618
* The full request target as passed in a HTTP request line or equivalent.
593619
*/
594620
static constexpr const char *kHttpTarget = "http.target";
595621

596-
/**
597-
* The matched route (path template in the format used by the respective server framework). See note
598-
below
599-
*
600-
* <p>Notes:
601-
<ul> <li>MUST NOT be populated when this is not supported by the HTTP server framework as the
602-
route attribute should have low-cardinality and the URI path can NOT substitute it. SHOULD include
603-
the <a href="#http-server-definitions">application root</a> if there is one.</li> </ul>
604-
*/
605-
static constexpr const char *kHttpRoute = "http.route";
606-
607622
/**
608623
* The IP address of the original client behind all proxies, if known (e.g. from <a
609624
href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For">X-Forwarded-For</a>).
@@ -1054,7 +1069,79 @@ static constexpr const char *kRpcJsonrpcErrorCode = "rpc.jsonrpc.error_code";
10541069
*/
10551070
static constexpr const char *kRpcJsonrpcErrorMessage = "rpc.jsonrpc.error_message";
10561071

1072+
/**
1073+
* Whether this is a received or sent message.
1074+
*/
1075+
static constexpr const char *kMessageType = "message.type";
1076+
1077+
/**
1078+
* MUST be calculated as two different counters starting from {@code 1} one for sent messages and
1079+
one for received message.
1080+
*
1081+
* <p>Notes:
1082+
<ul> <li>This way we guarantee that the values will be consistent between different
1083+
implementations.</li> </ul>
1084+
*/
1085+
static constexpr const char *kMessageId = "message.id";
1086+
1087+
/**
1088+
* Compressed size of the message in bytes.
1089+
*/
1090+
static constexpr const char *kMessageCompressedSize = "message.compressed_size";
1091+
1092+
/**
1093+
* Uncompressed size of the message in bytes.
1094+
*/
1095+
static constexpr const char *kMessageUncompressedSize = "message.uncompressed_size";
1096+
1097+
/**
1098+
* The <a href="https://connect.build/docs/protocol/#error-codes">error codes</a> of the Connect
1099+
* request. Error codes are always string values.
1100+
*/
1101+
static constexpr const char *kRpcConnectRpcErrorCode = "rpc.connect_rpc.error_code";
1102+
1103+
/**
1104+
* SHOULD be set to true if the exception event is recorded at a point where it is known that the
1105+
exception is escaping the scope of the span.
1106+
*
1107+
* <p>Notes:
1108+
<ul> <li>An exception is considered to have escaped (or left) the scope of a span,
1109+
if that span is ended while the exception is still logically &quot;in flight&quot;.
1110+
This may be actually &quot;in flight&quot; in some languages (e.g. if the exception
1111+
is passed to a Context manager's {@code __exit__} method in Python) but will
1112+
usually be caught at the point of recording the exception in most languages.</li><li>It is usually
1113+
not possible to determine at the point where an exception is thrown whether it will escape the scope
1114+
of a span. However, it is trivial to know that an exception will escape, if one checks for an active
1115+
exception just before ending the span, as done in the <a href="#recording-an-exception">example
1116+
above</a>.</li><li>It follows that an exception may still escape the scope of the span even if the
1117+
{@code exception.escaped} attribute was not set or set to false, since the event might have been
1118+
recorded at a time where it was not clear whether the exception will escape.</li> </ul>
1119+
*/
1120+
static constexpr const char *kExceptionEscaped = "exception.escaped";
1121+
1122+
/**
1123+
* Value of the <a href="https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent">HTTP
1124+
* User-Agent</a> header sent by the client.
1125+
*/
1126+
static constexpr const char *kUserAgentOriginal = "user_agent.original";
1127+
10571128
// Enum definitions
1129+
namespace HttpFlavorValues
1130+
{
1131+
/** HTTP/1.0. */
1132+
static constexpr const char *kHttp10 = "1.0";
1133+
/** HTTP/1.1. */
1134+
static constexpr const char *kHttp11 = "1.1";
1135+
/** HTTP/2. */
1136+
static constexpr const char *kHttp20 = "2.0";
1137+
/** HTTP/3. */
1138+
static constexpr const char *kHttp30 = "3.0";
1139+
/** SPDY protocol. */
1140+
static constexpr const char *kSpdy = "SPDY";
1141+
/** QUIC protocol. */
1142+
static constexpr const char *kQuic = "QUIC";
1143+
} // namespace HttpFlavorValues
1144+
10581145
namespace EventDomainValues
10591146
{
10601147
/** Events from browser apps. */
@@ -1336,22 +1423,6 @@ static constexpr const char *kNrnsa = "nrnsa";
13361423
static constexpr const char *kLteCa = "lte_ca";
13371424
} // namespace NetHostConnectionSubtypeValues
13381425

1339-
namespace HttpFlavorValues
1340-
{
1341-
/** HTTP/1.0. */
1342-
static constexpr const char *kHttp10 = "1.0";
1343-
/** HTTP/1.1. */
1344-
static constexpr const char *kHttp11 = "1.1";
1345-
/** HTTP/2. */
1346-
static constexpr const char *kHttp20 = "2.0";
1347-
/** HTTP/3. */
1348-
static constexpr const char *kHttp30 = "3.0";
1349-
/** SPDY protocol. */
1350-
static constexpr const char *kSpdy = "SPDY";
1351-
/** QUIC protocol. */
1352-
static constexpr const char *kQuic = "QUIC";
1353-
} // namespace HttpFlavorValues
1354-
13551426
namespace GraphqlOperationTypeValues
13561427
{
13571428
/** GraphQL query. */
@@ -1418,6 +1489,8 @@ static constexpr const char *kJavaRmi = "java_rmi";
14181489
static constexpr const char *kDotnetWcf = "dotnet_wcf";
14191490
/** Apache Dubbo. */
14201491
static constexpr const char *kApacheDubbo = "apache_dubbo";
1492+
/** Connect RPC. */
1493+
static constexpr const char *kConnectRpc = "connect_rpc";
14211494
} // namespace RpcSystemValues
14221495

14231496
namespace RpcGrpcStatusCodeValues
@@ -1458,6 +1531,50 @@ static constexpr const int kDataLoss = 15;
14581531
static constexpr const int kUnauthenticated = 16;
14591532
} // namespace RpcGrpcStatusCodeValues
14601533

1534+
namespace MessageTypeValues
1535+
{
1536+
/** sent. */
1537+
static constexpr const char *kSent = "SENT";
1538+
/** received. */
1539+
static constexpr const char *kReceived = "RECEIVED";
1540+
} // namespace MessageTypeValues
1541+
1542+
namespace RpcConnectRpcErrorCodeValues
1543+
{
1544+
/** cancelled. */
1545+
static constexpr const char *kCancelled = "cancelled";
1546+
/** unknown. */
1547+
static constexpr const char *kUnknown = "unknown";
1548+
/** invalid_argument. */
1549+
static constexpr const char *kInvalidArgument = "invalid_argument";
1550+
/** deadline_exceeded. */
1551+
static constexpr const char *kDeadlineExceeded = "deadline_exceeded";
1552+
/** not_found. */
1553+
static constexpr const char *kNotFound = "not_found";
1554+
/** already_exists. */
1555+
static constexpr const char *kAlreadyExists = "already_exists";
1556+
/** permission_denied. */
1557+
static constexpr const char *kPermissionDenied = "permission_denied";
1558+
/** resource_exhausted. */
1559+
static constexpr const char *kResourceExhausted = "resource_exhausted";
1560+
/** failed_precondition. */
1561+
static constexpr const char *kFailedPrecondition = "failed_precondition";
1562+
/** aborted. */
1563+
static constexpr const char *kAborted = "aborted";
1564+
/** out_of_range. */
1565+
static constexpr const char *kOutOfRange = "out_of_range";
1566+
/** unimplemented. */
1567+
static constexpr const char *kUnimplemented = "unimplemented";
1568+
/** internal. */
1569+
static constexpr const char *kInternal = "internal";
1570+
/** unavailable. */
1571+
static constexpr const char *kUnavailable = "unavailable";
1572+
/** data_loss. */
1573+
static constexpr const char *kDataLoss = "data_loss";
1574+
/** unauthenticated. */
1575+
static constexpr const char *kUnauthenticated = "unauthenticated";
1576+
} // namespace RpcConnectRpcErrorCodeValues
1577+
14611578
} // namespace SemanticConventions
14621579
} // namespace trace
14631580
OPENTELEMETRY_END_NAMESPACE

buildscripts/semantic-convention/generate.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ ROOT_DIR="${SCRIPT_DIR}/../../"
1515
# freeze the spec & generator tools versions to make SemanticAttributes generation reproducible
1616

1717
# repository: https://github.com/open-telemetry/opentelemetry-specification
18-
SEMCONV_VERSION=1.18.0
18+
SEMCONV_VERSION=1.19.0
1919

2020
# repository: https://github.com/open-telemetry/build-tools
21-
GENERATOR_VERSION=0.15.1
21+
GENERATOR_VERSION=0.18.0
2222

2323
SPEC_VERSION=v$SEMCONV_VERSION
2424
SCHEMA_URL=https://opentelemetry.io/schemas/$SEMCONV_VERSION
@@ -46,7 +46,7 @@ docker run --rm \
4646
-v ${SCRIPT_DIR}/templates:/templates \
4747
-v ${ROOT_DIR}/api/include/opentelemetry/trace/:/output \
4848
otel/semconvgen:$GENERATOR_VERSION \
49-
--only span \
49+
--only span,event,attribute_group,scope \
5050
-f /source code \
5151
--template /templates/SemanticAttributes.h.j2 \
5252
--output /output/semantic_conventions.h \

0 commit comments

Comments
 (0)