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

More semconv features and cleanups #97

Merged

Conversation

jsuereth
Copy link
Contributor

@jsuereth jsuereth commented Apr 11, 2024

  • Add new helper filter to split group ids into constituent parts, e.g. "registry.foo" => ["registry", "foo"]
  • Update weaver_forge tests to work on windows
    • Translate"\r\n" => "\n" for compared output
    • Add filename filter to jinja templates that converts "" to "/"
    • Improve error output when file system comparison fails.
    • Add 'trim' to a few templates to help remove platform specific EOLs
  • Update Dockerfile to use debug mode, so we get debug output on template failure

Fixes #84

@jsuereth jsuereth requested a review from lquerel as a code owner April 11, 2024 13:00
@jsuereth
Copy link
Contributor Author

Note: Overall weaver on windows tests still fail in other crates, mostly anything that prints file paths with expected output files.

Copy link

codecov bot commented Apr 11, 2024

Codecov Report

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

Project coverage is 63.6%. Comparing base (aa5a22f) to head (32ea520).

Files Patch % Lines
crates/weaver_forge/src/lib.rs 70.0% 3 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main     #97   +/-   ##
=====================================
  Coverage   63.6%   63.6%           
=====================================
  Files         54      54           
  Lines       3235    3245   +10     
=====================================
+ Hits        2058    2065    +7     
- Misses      1177    1180    +3     

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

Just 2 minor suggestions before approving this PR. @

Dockerfile Show resolved Hide resolved
@@ -1,7 +1,7 @@
{%- set file_name = ctx.id | file_name -%}
{{- template.set_file_name("attribute_group/" ~ file_name ~ ".md") -}}

## Group `{{ ctx.id }}` ({{ ctx.type }})
## Group `{{ ctx.id | split_id | list | join("_") }}` ({{ ctx.type }})
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why split_id does not directly return a Vec to avoid the list filter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My cluelessness in using Minijinja. If I can just return a Vec and it works, great. I thought that Value::from_seq + returning a Vec were basically the same with one being less obvious.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to vec. Wierdly minijinja still is confused on values.

Copy link
Contributor

Choose a reason for hiding this comment

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

Based on the code of the list filter (see below) you need to wrap the vec into a value.

#[cfg_attr(docsrs, doc(cfg(feature = "builtins")))]
pub fn list(state: &State, value: Value) -> Result<Value, Error> {
    let iter = ok!(state.undefined_behavior().try_iter(value).map_err(|err| {
        Error::new(ErrorKind::InvalidOperation, "cannot convert value to list").with_source(err)
    }));
    Ok(Value::from(iter.collect::<Vec<_>>()))
}

@lquerel
Copy link
Contributor

lquerel commented Apr 11, 2024

Note: Overall weaver on windows tests still fail in other crates, mostly anything that prints file paths with expected output files.

I don't have access to Windows, unfortunately. Can you create a GH issue to describe what's causing problems on Windows? It could be a perfect issue for someone who wants to start contributing to this repo.

@jsuereth
Copy link
Contributor Author

Note: Overall weaver on windows tests still fail in other crates, mostly anything that prints file paths with expected output files.

I don't have access to Windows, unfortunately. Can you create a GH issue to describe what's causing problems on Windows? It could be a perfect issue for someone who wants to start contributing to this repo.

I had one open for forge. I haven't investigate the issue for other crates you, but I'll open one when I'm back on my windows machine later.

crates/weaver_forge/src/lib.rs Fixed Show fixed Hide fixed
crates/weaver_forge/src/lib.rs Fixed Show fixed Hide fixed
crates/weaver_forge/src/lib.rs Fixed Show fixed Hide fixed
crates/weaver_forge/src/lib.rs Fixed Show fixed Hide fixed
@jsuereth jsuereth merged commit acf6fd0 into open-telemetry:main Apr 12, 2024
15 checks passed
@jsuereth jsuereth deleted the wip-features-for-semconv-registry branch April 12, 2024 03:22
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.

Cannot run weaver-forge tests on Windows
2 participants