From e55a2938343cf42253bc2e6d422acc6de41dfe34 Mon Sep 17 00:00:00 2001 From: Jack Berg Date: Tue, 26 Jul 2022 15:09:59 -0500 Subject: [PATCH] Update to semconv 1.12.0, build tools 0.8.0 --- buildscripts/semantic-convention/generate.sh | 4 +- .../attributes/ResourceAttributes.java | 75 ++++++++++++++--- .../trace/attributes/SemanticAttributes.java | 80 +++++++++++++++++-- 3 files changed, 140 insertions(+), 19 deletions(-) diff --git a/buildscripts/semantic-convention/generate.sh b/buildscripts/semantic-convention/generate.sh index aeed653fefe..5061d12e042 100755 --- a/buildscripts/semantic-convention/generate.sh +++ b/buildscripts/semantic-convention/generate.sh @@ -4,10 +4,10 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="${SCRIPT_DIR}/../../" # freeze the spec & generator tools versions to make SemanticAttributes generation reproducible -SEMCONV_VERSION=1.9.0 +SEMCONV_VERSION=1.12.0 SPEC_VERSION=v$SEMCONV_VERSION SCHEMA_URL=https://opentelemetry.io/schemas/$SEMCONV_VERSION -GENERATOR_VERSION=0.7.0 +GENERATOR_VERSION=0.8.0 cd ${SCRIPT_DIR} diff --git a/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/ResourceAttributes.java b/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/ResourceAttributes.java index 67ae90e04de..9ef7b9af02d 100644 --- a/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/ResourceAttributes.java +++ b/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/ResourceAttributes.java @@ -16,7 +16,53 @@ // buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 public final class ResourceAttributes { /** The URL of the OpenTelemetry schema for these keys and values. */ - public static final String SCHEMA_URL = "https://opentelemetry.io/schemas/1.9.0"; + public static final String SCHEMA_URL = "https://opentelemetry.io/schemas/1.12.0"; + + /** + * Array of brand name and version separated by a space + * + *

Notes: + * + *

+ */ + public static final AttributeKey> BROWSER_BRANDS = stringArrayKey("browser.brands"); + + /** + * The platform on which the browser is running + * + *

Notes: + * + *

+ */ + public static final AttributeKey BROWSER_PLATFORM = stringKey("browser.platform"); + + /** + * 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. + *
+ */ + public static final AttributeKey BROWSER_USER_AGENT = stringKey("browser.user_agent"); /** Name of the cloud provider. */ public static final AttributeKey CLOUD_PROVIDER = stringKey("cloud.provider"); @@ -246,6 +292,14 @@ public final class ResourceAttributes { * 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 faas.id} attribute). * */ public static final AttributeKey FAAS_NAME = stringKey("faas.name"); @@ -256,10 +310,12 @@ public final class ResourceAttributes { *

    Notes: * *

      - *
    • Depending on the cloud provider, use: + *
    • 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. @@ -267,12 +323,11 @@ public final class ResourceAttributes { * href="https://cloud.google.com/iam/docs/full-resource-names">URI of the resource *
    • Azure: The Fully - * Qualified Resource ID. - *
    • On some providers, it may not be possible to determine the full ID at startup, which is - * why this field cannot be made required. For example, on AWS the account ID part of the - * ARN is not available without calling another AWS API which may be deemed too slow for a - * short-running lambda function. As an alternative, consider setting {@code faas.id} as a - * span attribute instead. + * 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. *
    */ public static final AttributeKey FAAS_ID = stringKey("faas.id"); @@ -690,7 +745,7 @@ public static final class OsTypeValues { public static final String HPUX = "hpux"; /** AIX (Advanced Interactive eXecutive). */ public static final String AIX = "aix"; - /** Oracle Solaris. */ + /** SunOS, Oracle Solaris. */ public static final String SOLARIS = "solaris"; /** IBM z/OS. */ public static final String Z_OS = "z_os"; diff --git a/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java b/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java index 81021575889..7c2cdae565b 100644 --- a/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java +++ b/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java @@ -18,7 +18,7 @@ // buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 public final class SemanticAttributes { /** The URL of the OpenTelemetry schema for these keys and values. */ - public static final String SCHEMA_URL = "https://opentelemetry.io/schemas/1.9.0"; + public static final String SCHEMA_URL = "https://opentelemetry.io/schemas/1.12.0"; /** * The full invoked ARN as provided on the {@code Context} passed to the function ({@code @@ -34,6 +34,45 @@ public final class SemanticAttributes { public static final AttributeKey AWS_LAMBDA_INVOKED_ARN = stringKey("aws.lambda.invoked_arn"); + /** + * The event_id + * uniquely identifies the event. + */ + public static final AttributeKey CLOUDEVENTS_EVENT_ID = stringKey("cloudevents.event_id"); + + /** + * The source + * identifies the context in which an event happened. + */ + public static final AttributeKey CLOUDEVENTS_EVENT_SOURCE = + stringKey("cloudevents.event_source"); + + /** + * The version + * of the CloudEvents specification which the event uses. + */ + public static final AttributeKey CLOUDEVENTS_EVENT_SPEC_VERSION = + stringKey("cloudevents.event_spec_version"); + + /** + * The event_type + * contains a value describing the type of event related to the originating occurrence. + */ + public static final AttributeKey CLOUDEVENTS_EVENT_TYPE = + stringKey("cloudevents.event_type"); + + /** + * The subject + * of the event in the context of the event producer (identified by source). + */ + public static final AttributeKey CLOUDEVENTS_EVENT_SUBJECT = + stringKey("cloudevents.event_subject"); + /** * Parent-child Reference type * @@ -227,7 +266,7 @@ public final class SemanticAttributes { *
  • 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. + * 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. @@ -344,7 +383,16 @@ public final class SemanticAttributes { /** Remote port number. */ public static final AttributeKey NET_PEER_PORT = longKey("net.peer.port"); - /** Remote hostname or similar, see note below. */ + /** + * Remote hostname or similar, see note below. + * + *

    Notes: + * + *

      + *
    • {@code net.peer.name} SHOULD NOT be set if capturing it would require an extra DNS + * lookup. + *
    + */ public static final AttributeKey NET_PEER_NAME = stringKey("net.peer.name"); /** Like {@code net.peer.ip} but for the host IP. Useful in case of a multi-IP host. */ @@ -532,6 +580,9 @@ public final class SemanticAttributes { public static final AttributeKey HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = longKey("http.response_content_length_uncompressed"); + /** The ordinal number of request re-sending attempt. */ + public static final AttributeKey HTTP_RETRY_COUNT = longKey("http.retry_count"); + /** * The primary server name of the matched virtual host. This should be obtained via configuration. * If no such configuration can be obtained, this attribute MUST NOT be set ( {@code @@ -794,7 +845,7 @@ public final class SemanticAttributes { public static final AttributeKey MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = stringKey("messaging.rocketmq.consumption_model"); - /** A string identifying the remoting system. */ + /** A string identifying the remoting system. See below for a list of well-known identifiers. */ public static final AttributeKey RPC_SYSTEM = stringKey("rpc.system"); /** @@ -1137,12 +1188,14 @@ private NetHostConnectionSubtypeValues() {} } public static final class HttpFlavorValues { - /** HTTP 1.0. */ + /** HTTP/1.0. */ public static final String HTTP_1_0 = "1.0"; - /** HTTP 1.1. */ + /** HTTP/1.1. */ public static final String HTTP_1_1 = "1.1"; - /** HTTP 2. */ + /** HTTP/2. */ public static final String HTTP_2_0 = "2.0"; + /** HTTP/3. */ + public static final String HTTP_3_0 = "3.0"; /** SPDY protocol. */ public static final String SPDY = "SPDY"; /** QUIC protocol. */ @@ -1191,6 +1244,19 @@ public static final class MessagingRocketmqConsumptionModelValues { private MessagingRocketmqConsumptionModelValues() {} } + public static final class RpcSystemValues { + /** gRPC. */ + public static final String GRPC = "grpc"; + /** Java RMI. */ + public static final String JAVA_RMI = "java_rmi"; + /** .NET WCF. */ + public static final String DOTNET_WCF = "dotnet_wcf"; + /** Apache Dubbo. */ + public static final String APACHE_DUBBO = "apache_dubbo"; + + private RpcSystemValues() {} + } + public static final class RpcGrpcStatusCodeValues { /** OK. */ public static final long OK = 0;