From eed3b4e9c5efaf6d6e5073d13fbd3d57991d4d0f Mon Sep 17 00:00:00 2001 From: Alex Boten Date: Fri, 8 Dec 2023 10:32:06 -0800 Subject: [PATCH] [chore] update gensemconv to use .tools (#9055) Also updating documentation to specify the semantic-conventions repository instead of the spec repo. Signed-off-by: Alex Boten --- Makefile | 8 ++++---- Makefile.Common | 1 + semconv/README.md | 11 ++++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 426af0d5224..c80861ea4d5 100644 --- a/Makefile +++ b/Makefile @@ -227,13 +227,13 @@ genpdata: $(MAKE) fmt # Generate semantic convention constants. Requires a clone of the opentelemetry-specification repo -gensemconv: +gensemconv: $(SEMCONVGEN) @[ "${SPECPATH}" ] || ( echo ">> env var SPECPATH is not set"; exit 1 ) @[ "${SPECTAG}" ] || ( echo ">> env var SPECTAG is not set"; exit 1 ) @echo "Generating semantic convention constants from specification version ${SPECTAG} at ${SPECPATH}" - semconvgen -o semconv/${SPECTAG} -t semconv/template.j2 -s ${SPECTAG} -i ${SPECPATH}/semantic_conventions/. --only=resource -p conventionType=resource -f generated_resource.go - semconvgen -o semconv/${SPECTAG} -t semconv/template.j2 -s ${SPECTAG} -i ${SPECPATH}/semantic_conventions/. --only=event -p conventionType=event -f generated_event.go - semconvgen -o semconv/${SPECTAG} -t semconv/template.j2 -s ${SPECTAG} -i ${SPECPATH}/semantic_conventions/. --only=span -p conventionType=trace -f generated_trace.go + $(SEMCONVGEN) -o semconv/${SPECTAG} -t semconv/template.j2 -s ${SPECTAG} -i ${SPECPATH}/model/. --only=resource -p conventionType=resource -f generated_resource.go + $(SEMCONVGEN) -o semconv/${SPECTAG} -t semconv/template.j2 -s ${SPECTAG} -i ${SPECPATH}/model/. --only=event -p conventionType=event -f generated_event.go + $(SEMCONVGEN) -o semconv/${SPECTAG} -t semconv/template.j2 -s ${SPECTAG} -i ${SPECPATH}/model/. --only=span -p conventionType=trace -f generated_trace.go # Checks that the HEAD of the contrib repo checked out in CONTRIB_PATH compiles # against the current version of this repo. diff --git a/Makefile.Common b/Makefile.Common index 36e0b527bf1..f6095aea562 100644 --- a/Makefile.Common +++ b/Makefile.Common @@ -31,6 +31,7 @@ IMPI := $(TOOLS_BIN_DIR)/impi MISSPELL := $(TOOLS_BIN_DIR)/misspell MULTIMOD := $(TOOLS_BIN_DIR)/multimod PORTO := $(TOOLS_BIN_DIR)/porto +SEMCONVGEN := $(TOOLS_BIN_DIR)/semconvgen YQ := $(TOOLS_BIN_DIR)/yq .PHONY: install-tools diff --git a/semconv/README.md b/semconv/README.md index dcbcc71c797..6c9aea8b422 100644 --- a/semconv/README.md +++ b/semconv/README.md @@ -6,14 +6,15 @@ from definitions in the specification. ## Generation To generate the constants you can use the `gensemconv` make target. You must provide the path to the root of a clone of -the `opentelemetry-specification` repository in the `SPECPATH` variable and the version of the conventions to generate +the `semantic-conventions` repository in the `SPECPATH` variable and the version of the conventions to generate in the `SPECTAG` variable. ```console -$ make gensemconv SPECPATH=~/dev/opentelemetry-specification SPECTAG=v1.5.0 -Generating semantic convention constants from specification version v1.5.0 at ~/dev/opentelemetry-specification -semconvgen -o semconv/v1.5.0 -t semconv/template.j2 -s v1.5.0 -i ~/dev/opentelemetry-specification/semantic_conventions/resource -p conventionType=resource -semconvgen -o semconv/v1.5.0 -t semconv/template.j2 -s v1.5.0 -i ~/dev/opentelemetry-specification/semantic_conventions/trace -p conventionType=trace +$ make gensemconv SPECPATH=/tmp/semantic-conventions SPECTAG=v1.22.0 +Generating semantic convention constants from specification version v1.22.0 at /tmp/semantic-conventions +.tools/semconvgen -o semconv/v1.22.0 -t semconv/template.j2 -s v1.22.0 -i /tmp/semantic-conventions/model/. --only=resource -p conventionType=resource -f generated_resource.go +.tools/semconvgen -o semconv/v1.22.0 -t semconv/template.j2 -s v1.22.0 -i /tmp/semantic-conventions/model/. --only=event -p conventionType=event -f generated_event.go +.tools/semconvgen -o semconv/v1.22.0 -t semconv/template.j2 -s v1.22.0 -i /tmp/semantic-conventions/model/. --only=span -p conventionType=trace -f generated_trace.go ``` When generating the constants for a new version ot the specification it is important to note that only