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

Support clarifying shared attributes in other files #41

Closed
anuraaga opened this issue Apr 8, 2021 · 8 comments
Closed

Support clarifying shared attributes in other files #41

anuraaga opened this issue Apr 8, 2021 · 8 comments
Labels
question Further information is requested semconv/model Related to the data model or YAML format of the semantic convention generator semconv Related to the semantic convention generator.

Comments

@anuraaga
Copy link

anuraaga commented Apr 8, 2021

Currently, the way to refer to another attribute while clarifying its usage in a downstream semantic convention file, for example how aws-sdk does here

https://github.com/open-telemetry/opentelemetry-specification/blob/412fb5774cefc32ff9b7f47ef80e9e7d245e1e2e/semantic_conventions/trace/instrumentation/aws-sdk.yml#L13

The code generator seems to not correctly use the base definition. Perhaps this was too hacky of a way to do this approach but I think we need a way to refer to convventions from other files, and without breaking generation.

Also see:
open-telemetry/opentelemetry-specification#1607

/cc @weyert

@weyert
Copy link

weyert commented Apr 8, 2021

For an example see this generated file that uses 0.3.1 of the generator against the HEAD of specification-repo:
https://github.com/open-telemetry/opentelemetry-js/blob/3302972f519f936a800adb1bf9a26a71cb5c9ed5/packages/opentelemetry-semantic-conventions/src/trace/SemanticAttribute.ts#L469

@Oberon00 Oberon00 added question Further information is requested semconv Related to the semantic convention generator. semconv/model Related to the data model or YAML format of the semantic convention generator labels Apr 8, 2021
@Oberon00
Copy link
Member

Oberon00 commented Apr 8, 2021

@weyert Can you provide a link to your template? If you just do something like all attributes | unique by full name, you will get a random definition of each attribute if it was ref'd. But you should be able to filter for the primary definition somehow in the Jinja template. As this seems to be a trap that is easy to fall into, I think we should improve the generator tool though, e.g. by providing a list that only contains primary definitions out of the box.

@Oberon00
Copy link
Member

Oberon00 commented Apr 8, 2021

Perhaps this was too hacky of a way to do this

No, you used it exactly as designed. This is why ref allows overriding brief, etc.

@weyert
Copy link

weyert commented Apr 8, 2021

@Oberon00
Copy link
Member

Oberon00 commented Apr 8, 2021

@Oberon00
Copy link
Member

Oberon00 commented Apr 8, 2021

Actually by using is_local, the unique should no longer be needed.

@weyert
Copy link

weyert commented Apr 8, 2021

Thank you, I will give this a try and report back

@weyert
Copy link

weyert commented Apr 8, 2021

Looks ike I was able to make it work with:

  {%- for attribute in attributes if attribute.is_local and not attribute.ref %}

arminru added a commit to dynatrace-oss-contrib/opentelemetry-java that referenced this issue Apr 9, 2021
arminru added a commit to dynatrace-oss-contrib/opentelemetry-java that referenced this issue Apr 15, 2021
jkwatson pushed a commit to open-telemetry/opentelemetry-java that referenced this issue Apr 19, 2021
…3047)

* Update semantic convention constants generator script, template and spec reference

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 #3042.

* ./generate.sh

* Update template according to open-telemetry/build-tools#41

* ./generate.sh

The template was updated to use the correct base definitions, so the Javadoc for some attributes changed (the ones for `rpc.*`, for example).
This also changed the ordering but it is still reproducible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested semconv/model Related to the data model or YAML format of the semantic convention generator semconv Related to the semantic convention generator.
Projects
None yet
Development

No branches or pull requests

3 participants