Skip to content

Commit

Permalink
Update to semconv 1.12.0, build tools 0.8.0 (#4637)
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-berg authored Jul 27, 2022
1 parent 2ef73c8 commit c72a01e
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 19 deletions.
4 changes: 2 additions & 2 deletions buildscripts/semantic-convention/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
* <p>Notes:
*
* <ul>
* <li>This value is intended to be taken from the <a
* href="https://wicg.github.io/ua-client-hints/#interface">UA client hints API</a>
* (navigator.userAgentData.brands).
* </ul>
*/
public static final AttributeKey<List<String>> BROWSER_BRANDS = stringArrayKey("browser.brands");

/**
* The platform on which the browser is running
*
* <p>Notes:
*
* <ul>
* <li>This value is intended to be taken from the <a
* href="https://wicg.github.io/ua-client-hints/#interface">UA client hints API</a>
* (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 <a
* href="https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform">W3C User-Agent Client
* Hints specification</a>. Note that some (but not all) of these values can overlap with
* values in the <a href="./os.md">os.type and os.name attributes</a>. However, for
* consistency, the values in the {@code browser.platform} attribute should capture the
* exact value that the user agent provides.
* </ul>
*/
public static final AttributeKey<String> BROWSER_PLATFORM = stringKey("browser.platform");

/**
* Full user-agent string provided by the browser
*
* <p>Notes:
*
* <ul>
* <li>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.
* </ul>
*/
public static final AttributeKey<String> BROWSER_USER_AGENT = stringKey("browser.user_agent");

/** Name of the cloud provider. */
public static final AttributeKey<String> CLOUD_PROVIDER = stringKey("cloud.provider");
Expand Down Expand Up @@ -246,6 +292,14 @@ public final class ResourceAttributes {
* usually different from the name of the callback function (which may be stored in the <a
* href="../../trace/semantic_conventions/span-general.md#source-code-attributes">{@code
* code.namespace}/{@code code.function}</a> span attributes).
* <li>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:
* <li><strong>Azure:</strong> The full name {@code <FUNCAPP>/<FUNC>}, 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).
* </ul>
*/
public static final AttributeKey<String> FAAS_NAME = stringKey("faas.name");
Expand All @@ -256,23 +310,24 @@ public final class ResourceAttributes {
* <p>Notes:
*
* <ul>
* <li>Depending on the cloud provider, use:
* <li>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.
* <li>The exact value to use for {@code faas.id} depends on the cloud provider:
* <li><strong>AWS Lambda:</strong> The function <a
* href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a>.
* <li>Take care not to use the &quot;invoked ARN&quot; directly but replace any <a
* Take care not to use the &quot;invoked ARN&quot; directly but replace any <a
* href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html">alias
* suffix</a> with the resolved function version, as the same runtime instance may be
* invokable with multiple different aliases.
* <li><strong>GCP:</strong> The <a
* href="https://cloud.google.com/iam/docs/full-resource-names">URI of the resource</a>
* <li><strong>Azure:</strong> The <a
* href="https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id">Fully
* Qualified Resource ID</a>.
* <li>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</a> of the invoked function, <em>not</em> the function app, having
* the form {@code
* /subscriptions/<SUBSCIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>}.
* This means that a span attribute MUST be used, as an Azure function app can host multiple
* functions that would usually share a TracerProvider.
* </ul>
*/
public static final AttributeKey<String> FAAS_ID = stringKey("faas.id");
Expand Down Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,6 +34,45 @@ public final class SemanticAttributes {
public static final AttributeKey<String> AWS_LAMBDA_INVOKED_ARN =
stringKey("aws.lambda.invoked_arn");

/**
* The <a
* href="https:/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id">event_id</a>
* uniquely identifies the event.
*/
public static final AttributeKey<String> CLOUDEVENTS_EVENT_ID = stringKey("cloudevents.event_id");

/**
* The <a
* href="https:/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1">source</a>
* identifies the context in which an event happened.
*/
public static final AttributeKey<String> CLOUDEVENTS_EVENT_SOURCE =
stringKey("cloudevents.event_source");

/**
* The <a
* href="https:/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion">version
* of the CloudEvents specification</a> which the event uses.
*/
public static final AttributeKey<String> CLOUDEVENTS_EVENT_SPEC_VERSION =
stringKey("cloudevents.event_spec_version");

/**
* The <a
* href="https:/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type">event_type</a>
* contains a value describing the type of event related to the originating occurrence.
*/
public static final AttributeKey<String> CLOUDEVENTS_EVENT_TYPE =
stringKey("cloudevents.event_type");

/**
* The <a
* href="https:/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject">subject</a>
* of the event in the context of the event producer (identified by source).
*/
public static final AttributeKey<String> CLOUDEVENTS_EVENT_SUBJECT =
stringKey("cloudevents.event_subject");

/**
* Parent-child Reference type
*
Expand Down Expand Up @@ -227,7 +266,7 @@ public final class SemanticAttributes {
* <li>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
* <a href="#exception-end-example">example above</a>.
* <a href="#recording-an-exception">example above</a>.
* <li>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.
Expand Down Expand Up @@ -344,7 +383,16 @@ public final class SemanticAttributes {
/** Remote port number. */
public static final AttributeKey<Long> NET_PEER_PORT = longKey("net.peer.port");

/** Remote hostname or similar, see note below. */
/**
* Remote hostname or similar, see note below.
*
* <p>Notes:
*
* <ul>
* <li>{@code net.peer.name} SHOULD NOT be set if capturing it would require an extra DNS
* lookup.
* </ul>
*/
public static final AttributeKey<String> 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. */
Expand Down Expand Up @@ -532,6 +580,9 @@ public final class SemanticAttributes {
public static final AttributeKey<Long> HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED =
longKey("http.response_content_length_uncompressed");

/** The ordinal number of request re-sending attempt. */
public static final AttributeKey<Long> 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
Expand Down Expand Up @@ -794,7 +845,7 @@ public final class SemanticAttributes {
public static final AttributeKey<String> 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<String> RPC_SYSTEM = stringKey("rpc.system");

/**
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c72a01e

Please sign in to comment.