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

Semantic Convention generation tooling #1891

Merged
merged 18 commits into from
May 12, 2021

Conversation

Aneurysm9
Copy link
Member

This adds a tool to use the otel/semconvgen container image to generate resource and trace semantic conventions from the specification. It is not yet integrated with build processes and must be manually run, but it can produce constant and variable declarations with reasonable godoc.

Fixes #1879.

Signed-off-by: Anthony J Mirabella <[email protected]>
Signed-off-by: Anthony J Mirabella <[email protected]>
Signed-off-by: Anthony J Mirabella <[email protected]>
Signed-off-by: Anthony J Mirabella <[email protected]>
Signed-off-by: Anthony J Mirabella <[email protected]>
@MadVikingGod
Copy link
Contributor

Just because I couldn't tell I created a gist of the differences between keys: https://gist.github.com/MadVikingGod/9d108870779419171e7edecafe86e323

This isn't a comment on if this is appropriate or not, just so others don't have to try and work this out.

It looks like a few new Keys:

  • AWS*
  • DBCassandra
  • FaaS*
  • MessagingKafka*
  • other misc keys

Major change of

  • K8s* to K8S*
  • CodeLineNumberKey to CodeLinenoKey
  • DBRedisDBIndexKey to DBRedisDatabaseIndexKey

And the removal of

  • RPCMessage*
  • MessagingRabbit
  • RPCNameKey

@Aneurysm9
Copy link
Member Author

Thanks for doing that analysis @MadVikingGod! I've added replacements to fix the K8S* (though I wonder whether that's right), Redis, and LineNumber key names.

There were some FaaS* keys previously, though I think they were primarily in resource.go and new ones were added in trace.go. All of the added and removed keys are according to the conventions as they currently exist in the specification repo. If we want to restore the removed keys we'll need to get them into the spec and re-generate these files.

Copy link
Member

@XSAM XSAM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice 👍 Added a just few comments

internal/tools/semconv-gen/generator.go Outdated Show resolved Hide resolved
internal/tools/semconv-gen/generator.go Show resolved Hide resolved
internal/tools/semconv-gen/generator.go Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@MadVikingGod MadVikingGod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than finding the repo root magic, I think this is GTG.

Comment on lines +28 to +32
var (
HTTPSchemeHTTP = HTTPSchemeKey.String("http")
HTTPSchemeHTTPS = HTTPSchemeKey.String("https")
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just moved out of the other files? It doesn't seem like this was generated like the other files.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just moved out of the other files. It doesn't exist in the conventions and I'm not actually sure we should be introducing it, but it was used in some of the helpers here and I figured it was easier to move closer to its use and we can discuss whether to actually keep them separately if needed.

internal/tools/semconv-gen/generator.go Outdated Show resolved Hide resolved
internal/tools/semconv-gen/generator.go Outdated Show resolved Hide resolved
internal/tools/semconv-gen/generator.go Show resolved Hide resolved
internal/tools/semconv-gen/generator.go Outdated Show resolved Hide resolved
semconv/resource.go Outdated Show resolved Hide resolved
semconv/resource.go Outdated Show resolved Hide resolved
semconv/resource.go Outdated Show resolved Hide resolved
semconv/resource.go Outdated Show resolved Hide resolved
semconv/resource.go Outdated Show resolved Hide resolved
semconv/resource.go Outdated Show resolved Hide resolved
semconv/trace.go Outdated Show resolved Hide resolved
semconv/trace.go Outdated Show resolved Hide resolved
semconv/trace.go Outdated Show resolved Hide resolved
semconv/resource.go Outdated Show resolved Hide resolved
semconv/trace.go Outdated Show resolved Hide resolved
@MrAlias MrAlias added this to the RC1 milestone May 12, 2021
@codecov
Copy link

codecov bot commented May 12, 2021

Codecov Report

Merging #1891 (1432e46) into main (6219221) will increase coverage by 0.0%.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #1891   +/-   ##
=====================================
  Coverage   79.3%   79.3%           
=====================================
  Files        139     139           
  Lines       7425    7425           
=====================================
+ Hits        5892    5894    +2     
+ Misses      1286    1285    -1     
+ Partials     247     246    -1     
Impacted Files Coverage Δ
semconv/http.go 95.2% <ø> (ø)
sdk/trace/batch_span_processor.go 87.1% <0.0%> (+1.5%) ⬆️

@Aneurysm9 Aneurysm9 merged commit 5cb6263 into open-telemetry:main May 12, 2021
@Aneurysm9 Aneurysm9 deleted the semconvgen branch May 12, 2021 23:11
@Aneurysm9 Aneurysm9 mentioned this pull request Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate semconv package from semantic conventions YAML specification
5 participants