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

Migrate collector semconv codegen to weaver #11064

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

jsuereth
Copy link
Contributor

@jsuereth jsuereth commented Sep 5, 2024

NOTE: This PR is (currently) an example for discussion on the evolution of semconv codegen in the collector.

I regenerated v1.27.0 semconv package so you can get a feel for the changes - I can revert that if we go this route.

Description

Migrate semconv codegen to weaver.

Discovered a few things with codegen in the collector that may be problematic going forward, but did the bare minimum here:

  • Migrate from semconvgen docker image (transitive dependency from opentelemetry-go-build-tools). This image is deprecated, will break in the future
  • Split out codegen for event, resource + trace. These were not producing attributes today, and going forward I think some time/thought should be made into what this looks like. Semantic conventions has shifted direction overtime, and we have recommendations for codegen that we should co-design a new solution w/ Collector maintainers.
  • Update docker calls to run as local user rather than root (meaning generated files are no longer owned by root).
  • Remove requirement level from attribute registry (this was never an accurate description and any reliance on it was fundamentally broken).
  • Update documentation to leverage automatic git resolution of semconv tags built into weaver.

Link to tracking issue

Tracked at: open-telemetry/weaver#227

Testing

I manually ran the codegen against latest semconv and compared agianst current versions. I can run this codegen in existing directories for clarity.

Documentation

Documentation remains unchanged for codegen. I can add links to weaver documentation if needed.

Open Questions / Concerns

  • The Collector, unlike other systems, does NOT fragment stable vs. unstable portions of semantic conventions in codegen, instead having docs outline the current stability of constants. This might be ok given the versioned-packages, want to ensure that's true.
  • The existing collector semconvgen template appears to filter on stable attributes, but generated code does not, making me think perhaps the filter wasn't doing what was expected or was broken over time.
  • The codegen around events, traces and resource appears to not be producing anything. I think we can improve that, but I'm curious what collector authors/maintainers need here. For now I set up the ability to define a template and preserve existing behavior, but the previous template would not have produced anything useful for these, so I did not duplicate its logic.

Copy link

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.20%. Comparing base (631df98) to head (24a46cb).
Report is 108 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11064      +/-   ##
==========================================
- Coverage   92.23%   92.20%   -0.03%     
==========================================
  Files         405      414       +9     
  Lines       19089    19718     +629     
==========================================
+ Hits        17606    18181     +575     
- Misses       1123     1166      +43     
- Partials      360      371      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@lmolkova lmolkova left a comment

Choose a reason for hiding this comment

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

Weaver/template changes LGTM!

// Type: string
// Requirement Level: Optional
Copy link

Choose a reason for hiding this comment

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

requirement level disappeared

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes - There is not such things are requirement level on the attribute registry, that's signal specific.

I'm not even sure where it was pulling requirement level from before, but I call that out in the PR description.

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants