Skip to content

Commit

Permalink
[model/semconv] Add generated_ prefix to generated files (#5148)
Browse files Browse the repository at this point in the history
For consistency with other generated names in across the collector repos. This also helps to distinguish files that has to be manually created for each semconv version.
  • Loading branch information
dmitryax authored Apr 5, 2022
1 parent caa4f27 commit ff6a8f6
Show file tree
Hide file tree
Showing 13 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ gensemconv:
@[ "${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 model/semconv/${SPECTAG} -t model/internal/semconv/template.j2 -s ${SPECTAG} -i ${SPECPATH}/semantic_conventions/resource -p conventionType=resource
semconvgen -o model/semconv/${SPECTAG} -t model/internal/semconv/template.j2 -s ${SPECTAG} -i ${SPECPATH}/semantic_conventions/trace -p conventionType=trace
semconvgen -o model/semconv/${SPECTAG} -t model/internal/semconv/template.j2 -s ${SPECTAG} -i ${SPECPATH}/semantic_conventions/resource -p conventionType=resource -f generated_resource.go
semconvgen -o model/semconv/${SPECTAG} -t model/internal/semconv/template.j2 -s ${SPECTAG} -i ${SPECPATH}/semantic_conventions/trace -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.
Expand Down
7 changes: 4 additions & 3 deletions model/semconv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ semconvgen -o model/semconv/v1.5.0 -t model/internal/semconv/template.j2 -s v1.5
semconvgen -o model/semconv/v1.5.0 -t model/internal/semconv/template.j2 -s v1.5.0 -i ~/dev/opentelemetry-specification/semantic_conventions/trace -p conventionType=trace
```

When generating the constants for a new version ot the specification it is important to note that only `trace.go` and
`resource.go` are generated automatically. The `schema.go` and `nonstandard.go` files should be copied from a prior
version's package and updated as appropriate. Most important will be to update the `SchemaURL` constant in `schema.go`.
When generating the constants for a new version ot the specification it is important to note that only
`generated_trace.go` and `generated_resource.go` are generated automatically. The `schema.go` and `nonstandard.go`
files should be copied from a prior version's package and updated as appropriate. Most important will be to update
the `SchemaURL` constant in `schema.go`.
2 changes: 1 addition & 1 deletion model/semconv/semconv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

func TestAllSemConvFilesAreCrated(t *testing.T) {
// Files that have to be present in each semconv package
var expectedFiles = []string{"nonstandard.go", "resource.go", "schema.go", "trace.go"}
var expectedFiles = []string{"generated_resource.go", "generated_trace.go", "nonstandard.go", "schema.go"}

files, err := os.ReadDir(".")
assert.NoError(t, err)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ff6a8f6

Please sign in to comment.