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

Added support for List of Array examples. #177

Merged
merged 6 commits into from
May 29, 2024

Conversation

jerbly
Copy link
Contributor

@jerbly jerbly commented May 28, 2024

The current implementation does not support all the Example types as defined here: https://github.com/open-telemetry/build-tools/blob/main/semantic-conventions/syntax.md#examples-for-examples - specifically multiple example values for array types.

I have added these as ListOf* variants to the Examples enum.

The legacy markdown generation had to be updated to accommodate this, and to fix the presentation of array type examples. An example for a string[] attribute type should be displayed as an array: ["a", "b"]. In the current implementation they are shown as multiple examples appropriate for string type: a; b. I'm not sure where the legacy markdown writer is actually used in practice though.

This error in representation of examples has also been carried through to the jinja templates in the semconv project and so currently all the published examples for array types in the documentation are incorrect. (I have a PR to fix this going up ASAP).

Not sure what the pattern is for the changelog, it appears to show all unreleased entries and yet 0.3.0 has been released?? (But the main cargo.toml has 0.1.0??)

crates/weaver_semconv_gen/src/gen.rs Show resolved Hide resolved
@@ -410,6 +410,14 @@ pub enum Examples {
Bools(Vec<bool>),
/// A array of strings example.
Strings(Vec<String>),
/// List of arrays of integers example.
ListOfInts(Vec<Vec<i64>>),
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a test to ensure this is working?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added tests... feels like I'm just testing serde_yaml though ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, and agreed. I had intended for those tests to be on full resolution ensuring these are preserved through the resolution process, but what you have is fine for now.

@jerbly jerbly requested a review from jsuereth May 29, 2024 01:03
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.

Overall, it LGTM, but the [!NOTE] tags need to be put back in place because they are interpreted by GitHub in a specific way. It is possible that rustdoc or clippy might not be happy, in which case you should use a #[allow()] to suppress the warnings. Thank you for this contribution.

@@ -105,10 +105,8 @@ deny[schema_evolution_violation("attr_removed", old_group.id, old_attr.id)] {
}
```

> [!NOTE]
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link

codecov bot commented May 29, 2024

Codecov Report

Attention: Patch coverage is 31.03448% with 20 lines in your changes are missing coverage. Please review.

Project coverage is 74.6%. Comparing base (29387f5) to head (7740726).

Current head 7740726 differs from pull request most recent head b91c6ea

Please upload reports for the commit b91c6ea to get more accurate results.

Files Patch % Lines
crates/weaver_semconv_gen/src/gen.rs 31.0% 20 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main    #177     +/-   ##
=======================================
- Coverage   75.5%   74.6%   -1.0%     
=======================================
  Files         44      43      -1     
  Lines       2849    2751     -98     
=======================================
- Hits        2153    2053    -100     
- Misses       696     698      +2     

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

@lquerel
Copy link
Contributor

lquerel commented May 29, 2024

@jerbly The issue with check-external-types will be fixed if you update your branch with the last version of the main branch.

@jerbly jerbly requested a review from lquerel May 29, 2024 09:36
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.

Thank you for the updates.

@@ -410,6 +410,14 @@ pub enum Examples {
Bools(Vec<bool>),
/// A array of strings example.
Strings(Vec<String>),
/// List of arrays of integers example.
ListOfInts(Vec<Vec<i64>>),
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, and agreed. I had intended for those tests to be on full resolution ensuring these are preserved through the resolution process, but what you have is fine for now.

@jsuereth jsuereth merged commit 79b7ec1 into open-telemetry:main May 29, 2024
17 checks passed
@jerbly jerbly deleted the fix-examples branch May 29, 2024 12:58
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