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

Metrics and Events don't require attributes #494

Merged

Conversation

jerbly
Copy link
Contributor

@jerbly jerbly commented Nov 30, 2024

Fix for issue #405

  • Updated the EBNF and JSON schema to define the extends or attributes requirement mandatory for all group types except metric and event.
  • Added a group validity check as a warning.

@jerbly jerbly force-pushed the metrics-don't-require-attributes branch from 9297170 to 1a91ee7 Compare November 30, 2024 02:33
Copy link
Contributor

@lquerel lquerel left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks

@lquerel lquerel requested a review from lmolkova December 1, 2024 18:35
Copy link
Contributor

@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.

LGTM and thank you!

@lquerel
Copy link
Contributor

lquerel commented Dec 3, 2024

@jerbly This PR is still in draft mode. Is that intentional? If not, please click “Ready for Review,” and I’ll proceed with merging it. Thanks!

@jerbly
Copy link
Contributor Author

jerbly commented Dec 3, 2024

@lquerel it's currently failing unrelated clippy checks. One is a simple fix. The other is documentation and formatting in the generated code in weaver-codegen - I'm not sure what to do with it. Perhaps change clippy settings in that crate?

@lquerel
Copy link
Contributor

lquerel commented Dec 3, 2024

Regarding Clippy, I suggest implementing the changes proposed in Clippy’s report regarding the possibility of eliding certain lifetimes. Currently, our build pipeline is configured to always use the latest version of the Rust toolchain, which has the advantage of benefiting from the latest changes and improvements but also the drawback of introducing new Clippy errors unrelated to the PR. We could pin the toolchain version to avoid this, but at the same time, the current approach ensures we don’t forget to update it.

@jerbly
Copy link
Contributor Author

jerbly commented Dec 3, 2024

The lifetimes one is easy. The doc problems in the generated code was where I had my doubts it was worth the effort. I'll work on it.

@jerbly jerbly marked this pull request as ready for review December 3, 2024 16:56
@jerbly jerbly requested review from a team as code owners December 3, 2024 16:56
@jerbly
Copy link
Contributor Author

jerbly commented Dec 3, 2024

@lquerel - I've fixed those issues so this is ready to merge now. :)

Copy link

codecov bot commented Dec 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.9%. Comparing base (19c5746) to head (c7d9005).
Report is 2 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #494   +/-   ##
=====================================
  Coverage   73.9%   73.9%           
=====================================
  Files         50      50           
  Lines       3902    3911    +9     
=====================================
+ Hits        2886    2893    +7     
- Misses      1016    1018    +2     

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

Copy link
Contributor

@lquerel lquerel left a comment

Choose a reason for hiding this comment

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

I missed something but I didn’t understand the changes to the code generation section. What was the issue exactly? Why comment out that part of the code generation?

Comment on lines +16 to +17
//! Attributes for the `{{ attributes_root_namespace.root_namespace }}` namespace.
//! pub mod {{ attributes_root_namespace.root_namespace | snake_case }};
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I didn’t understand these changes. Why comment out this part of the code generation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clippy was complaining about the documentation and formatting. The jinja template previously created:

/// Attributes for the `system` namespace.
pub mod system;

for example.

Then here:

// For the purpose of the integration test located in `tests/codegen.rs`, we need to:
// - Combine all generated files to form a single file containing all the generated code
// organized in nested modules.
// - Replace `//!` with `//`
// - Remove `pub mod` lines
create_single_generated_rs_file(target_dir.as_path());
the pub mod lines are removed leaving a floating /// doc comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, ok. I had forgotten about that part of the plumbing in the code :-)

Comment on lines +14 to +15
//! Metrics for the `{{ attributes_root_namespace.root_namespace }}` namespace.
//! pub mod {{ attributes_root_namespace.root_namespace | snake_case }};
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same answer ;)

@lquerel lquerel merged commit 53b6235 into open-telemetry:main Dec 3, 2024
24 checks passed
@jerbly jerbly deleted the metrics-don't-require-attributes branch December 4, 2024 18:41
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.

3 participants