Update the semconv to spec v1.4.0 (#3298)

* Update the semconv to spec v1.4.0

* Add the schema URL to the generated files.

* amend the CHANGELOG.md entry to add the schema url addition
This commit is contained in:
John Watson 2021-06-09 17:27:13 -07:00 committed by GitHub
parent f563f4494d
commit 81e2777114
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 92 additions and 1 deletions

View File

@ -2,6 +2,11 @@
## Unreleased:
### Semantic Conventions (alpha)
- The `SemanticAttributes` and `ResourceAttributes` classes have been updated to match the semantic conventions
as of specification release `1.4.0`. These classes also now expose a `SCHEMA_URL` field which points at the
version of the OpenTelemetry schema the files were generated from. There are no breaking changes in this update, only additions.
---
## Version 1.3.0 - 2021-06-09

View File

@ -4,7 +4,9 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT_DIR="${SCRIPT_DIR}/../../"
# freeze the spec & generator tools versions to make SemanticAttributes generation reproducible
SPEC_VERSION=v1.3.0
SEMCONV_VERSION=1.4.0
SPEC_VERSION=v$SEMCONV_VERSION
SCHEMA_URL=https://opentelemetry.io/schemas/$SEMCONV_VERSION
GENERATOR_VERSION=0.3.1
cd ${SCRIPT_DIR}
@ -28,6 +30,7 @@ docker run --rm \
--template /templates/SemanticAttributes.java.j2 \
--output /output/SemanticAttributes.java \
-Dclass=SemanticAttributes \
-DschemaUrl=$SCHEMA_URL \
-Dpkg=io.opentelemetry.semconv.trace.attributes
docker run --rm \
@ -39,6 +42,7 @@ docker run --rm \
--template /templates/SemanticAttributes.java.j2 \
--output /output/ResourceAttributes.java \
-Dclass=ResourceAttributes \
-DschemaUrl=$SCHEMA_URL \
-Dpkg=io.opentelemetry.semconv.resource.attributes
cd "$ROOT_DIR"

View File

@ -57,6 +57,10 @@ import java.util.List;
// DO NOT EDIT, this is an Auto-generated file from buildscripts/semantic-convention{{template}}
public final class {{class}} {
/**
* The URL of the OpenTelemetry schema for these keys and values.
*/
public static final String SCHEMA_URL = "{{schemaUrl}}";
{%- for attribute in attributes if attribute.is_local and not attribute.ref %}
/**

View File

@ -15,6 +15,8 @@ import java.util.List;
// DO NOT EDIT, this is an Auto-generated file from
// 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.4.0";
/** Name of the cloud provider. */
public static final AttributeKey<String> CLOUD_PROVIDER = stringKey("cloud.provider");
@ -142,6 +144,39 @@ public final class ResourceAttributes {
public static final AttributeKey<String> DEPLOYMENT_ENVIRONMENT =
stringKey("deployment.environment");
/**
* A unique identifier representing the device.
*
* <p>Note: 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](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor).
* 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](https://developer.android.com/training/articles/user-data-ids) 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.
*/
public static final AttributeKey<String> DEVICE_ID = stringKey("device.id");
/**
* The model identifier for the device.
*
* <p>Note: It&#39;s recommended this value represents a machine readable version of the model
* identifier rather than the market or consumer-friendly name of the device.
*/
public static final AttributeKey<String> DEVICE_MODEL_IDENTIFIER =
stringKey("device.model.identifier");
/**
* The marketing name for the device model.
*
* <p>Note: It&#39;s recommended this value represents a human readable version of the device
* model rather than a machine readable alternative.
*/
public static final AttributeKey<String> DEVICE_MODEL_NAME = stringKey("device.model.name");
/** The name of the function being executed. */
public static final AttributeKey<String> FAAS_NAME = stringKey("faas.name");
@ -267,6 +302,15 @@ public final class ResourceAttributes {
*/
public static final AttributeKey<String> OS_DESCRIPTION = stringKey("os.description");
/** Human readable operating system name. */
public static final AttributeKey<String> OS_NAME = stringKey("os.name");
/**
* The version string of the operating system as defined in [Version
* Attributes](../../resource/semantic_conventions/README.md#version-attributes).
*/
public static final AttributeKey<String> OS_VERSION = stringKey("os.version");
/** Process identifier (PID). */
public static final AttributeKey<Long> PROCESS_PID = longKey("process.pid");

View File

@ -17,6 +17,8 @@ import java.util.List;
// DO NOT EDIT, this is an Auto-generated file from
// 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.4.0";
/**
* An identifier for the database management system (DBMS) product being used. See below for a
@ -638,6 +640,34 @@ public final class SemanticAttributes {
*/
public static final AttributeKey<Long> RPC_GRPC_STATUS_CODE = longKey("rpc.grpc.status_code");
/**
* Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 does not
* specify this, the value can be omitted.
*/
public static final AttributeKey<String> RPC_JSONRPC_VERSION = stringKey("rpc.jsonrpc.version");
/**
* `method` property from request. Unlike `rpc.method`, this may not relate to the actual method
* being called. Useful for client-side traces since client does not know what will be called on
* the server.
*/
public static final AttributeKey<String> RPC_JSONRPC_METHOD = stringKey("rpc.jsonrpc.method");
/**
* `id` property of request or response. Since protocol allows id to be int, string, `null` or
* missing (for notifications), value is expected to be cast to string for simplicity. Use empty
* string in case of `null` value. Omit entirely if this is a notification.
*/
public static final AttributeKey<String> RPC_JSONRPC_REQUEST_ID =
stringKey("rpc.jsonrpc.request_id");
/** `error.code` property of response if it is an error response. */
public static final AttributeKey<Long> RPC_JSONRPC_ERROR_CODE = longKey("rpc.jsonrpc.error_code");
/** `error.message` property of response if it is an error response. */
public static final AttributeKey<String> RPC_JSONRPC_ERROR_MESSAGE =
stringKey("rpc.jsonrpc.error_message");
// Enum definitions
public static final class DbSystemValues {
/** Some other SQL database. Fallback only. See notes. */
@ -730,6 +760,10 @@ public final class SemanticAttributes {
public static final String GEODE = "geode";
/** Elasticsearch. */
public static final String ELASTICSEARCH = "elasticsearch";
/** Memcached. */
public static final String MEMCACHED = "memcached";
/** CockroachDB. */
public static final String COCKROACHDB = "cockroachdb";
private DbSystemValues() {}
}