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

Additional filters and tests #163

Merged
merged 2 commits into from
May 17, 2024
Merged

Conversation

lquerel
Copy link
Contributor

@lquerel lquerel commented May 16, 2024

This PR adds/updates the following filters:

  • instantiated_type: Filters a type to return the instantiated type.
  • enum_type: Filters a type to return the enum type or an error if the type is not an enum.
  • capitalize_first: Capitalizes the first letter of a string.
  • map_text introduces a second parameter to define the default value if the name of the text map or the input are not found in the text_maps section (optional parameter).

This PR adds the following tests:

  • enum: Tests if an attribute has an enum type.
  • simple_type: Tests if a type is a simple type (i.e.: string | string[] | int | int[] | double | double[] | boolean | boolean[]).
  • template_type: Tests if a type is a template type (i.e.: template[]).
  • enum_type: Tests if a type is an enum type.

Documentation has been updated.
Unit tests have been created.

@lquerel lquerel requested a review from jsuereth as a code owner May 16, 2024 23:00
@lquerel lquerel self-assigned this May 16, 2024
@lquerel lquerel added the enhancement New feature or request label May 16, 2024
Filters:
- `instantiated_type`: Filters a type to return the instantiated type.
- `enum_type`: Filters a type to return the enum type or an error if the type is not an enum.

Tests:
- `enum`: Tests if an attribute has an enum type.
- `simple_type`: Tests if a type is a simple type (i.e.: string | string[] | int | int[] | double | double[] | boolean | boolean[]).
- `template_type`: Tests if a type is a template type (i.e.: template[]).
- `enum_type`: Tests if a type is an enum type.
Copy link

codecov bot commented May 17, 2024

Codecov Report

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

Project coverage is 75.2%. Comparing base (8183b50) to head (548edf7).

Files Patch % Lines
crates/weaver_forge/src/extensions/otel.rs 94.2% 4 Missing ⚠️
crates/weaver_semconv/src/attribute.rs 75.0% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main    #163     +/-   ##
=======================================
+ Coverage   74.7%   75.2%   +0.4%     
=======================================
  Files         45      45             
  Lines       2627    2704     +77     
=======================================
+ Hits        1963    2034     +71     
- Misses       664     670      +6     

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

if current_inferred_type != member_type {
// If the inferred type is different from the member type, then the enum
// type is "promoted" to a string.
Some("string".to_owned())
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this is the right way to go... We may need to improve enum in the model so type is actually specified AND enforced on members.

@lquerel lquerel merged commit 4401e3d into open-telemetry:main May 17, 2024
20 checks passed
@lquerel lquerel deleted the new-filters branch May 29, 2024 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants