-
Notifications
You must be signed in to change notification settings - Fork 19
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
Define SemConv predefined JQ functions #246
Conversation
# Conflicts: # crates/weaver_forge/src/config.rs # crates/weaver_forge/src/extensions/case.rs # crates/weaver_forge/src/lib.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM. Just called out some of my concerns going forward on formalizing semconv decisions over here in the weaver codebase.
Could we postpone adding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some minor comments, looks great otherwise!
@lmolkova, @jsuereth, once I get confirmation for the few questions I have (see previous comment), I will make the changes, bump the weaver version, and create a new release. This release will be a good starting point for the codegen authors as these new JQ filters improve the UX. The step-by-step guide should also ease the process of the codegen migration. |
This PR adds a set of predefined JQ functions to simplify the processing and generation of semconv documentation/code.
Process Registry Attributes
The following JQ filter extracts the registry attributes from the resolved registry and returns a list of registry attributes grouped by namespace and sorted by attribute names.
The output of the JQ filter has the following structure:
The
semconv_grouped_attributes
function also supports options to exclude specified root namespaces, specific stability levels, and deprecated entities. The following syntax is supported:The structure of the output of
semconv_grouped_attributes
with these options is exactly the same as without the options. The JSON object passed as a parameter describes a series of options that can easily be extended if needed. Each of these options is optional. It's also possible to use the special parameter$params
as follows:Technically, the
semconv_grouped_attributes
function is a combination of two semconv JQ functions:The
semconv_attributes
function extracts the registry attributes and applies the given options. Thesemconv_group_attributes_by_root_namespace
function groups the attributes by root namespace. It's possible to combine these two functions with your own JQ filters if needed.Process Metrics
The following JQ filter extracts the metrics from the resolved registry, sorted by group root namespace and sorted by metric names.
The output of the JQ filter has the following structure:
The same options are supported by
semconv_grouped_metrics
, as shown in the following example:All the
semconv_grouped_<...>
functions are the composition of two functions:semconv_<...>
andsemconv_group_<...>_by_root_namespace
.Other improvements
This PR contains an update of the Weaver Forge README.md.
This PR updates the Rust example to leverage both the whitespace control settings and the new JQ filters.