Skip to content

Commit

Permalink
Add the schema URL to the generated files.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkwatson committed Jun 9, 2021
1 parent 4661aee commit 1b872b0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion buildscripts/semantic-convention/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.4.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}
Expand All @@ -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 \
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// 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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// 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
Expand Down

0 comments on commit 1b872b0

Please sign in to comment.