Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[model/semconv] Add generated_ prefix to generated files #5148

Merged
merged 1 commit into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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