Skip to content

Commit

Permalink
Update semantic convention constants generator script and template
Browse files Browse the repository at this point in the history
The template was updated to reflect the changes introduced in otel/semconvgen v0.3.0 and v0.3.1.
The script was updated to pin the version of the otel/semconvgen image, otherwise incompatible updates would break it.

Fixes open-telemetry#3042.
  • Loading branch information
arminru committed Apr 9, 2021
1 parent f5f0e1f commit 2086c49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions buildscripts/semantic-convention/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT_DIR="${SCRIPT_DIR}/../../"

# freeze the spec version to make SemanticAttributes generation reproducible
SPEC_VERSION=v1.1.0
SPEC_VERSION=a44d863edcdef63b0adce7b47df001933b7a158a # = v1.1.0 + number->int update; bump to v1.2.0 once released
GENERATOR_VERSION=0.3.1

cd ${SCRIPT_DIR}

Expand All @@ -22,7 +23,7 @@ docker run --rm \
-v ${SCRIPT_DIR}/opentelemetry-specification/semantic_conventions/trace:/source \
-v ${SCRIPT_DIR}/templates:/templates \
-v ${ROOT_DIR}/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/:/output \
otel/semconvgen \
otel/semconvgen:${GENERATOR_VERSION} \
-f /source code \
--template /templates/SemanticAttributes.java.j2 \
--output /output/SemanticAttributes.java \
Expand All @@ -33,7 +34,7 @@ docker run --rm \
-v ${SCRIPT_DIR}/opentelemetry-specification/semantic_conventions/resource:/source \
-v ${SCRIPT_DIR}/templates:/templates \
-v ${ROOT_DIR}/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/:/output \
otel/semconvgen \
otel/semconvgen:${GENERATOR_VERSION} \
-f /source code \
--template /templates/SemanticAttributes.java.j2 \
--output /output/ResourceAttributes.java \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
List<String>
{%- elif type == "boolean" -%}
boolean
{%- elif type == "number" -%}
{%- elif type == "int" -%}
long
{%- else -%}
{{type}}
Expand All @@ -24,7 +24,7 @@
stringArrayKey
{%- elif type == "boolean" -%}
booleanKey
{%- elif type == "number" -%}
{%- elif type == "int" -%}
longKey
{%- else -%}
{{lowerFirst(type)}}Key
Expand Down

0 comments on commit 2086c49

Please sign in to comment.