You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It can be implemented once in rust and appear in the Jinja context as an additional ctx.grouped_attributes property - nobody would need to write and debug it again.
I'm not sure how far we can go there, but it could be that ctx.grouped_attributes from p1 above provides all the default behavior we want codegen to follow and resolves collisions in a common way. Someone can still use raw groups and massage data with JQ if they want to.
Minor: sort attributes in ctx.grouped_attributes by name. Requirement level does not appear in attribute definitions code, sorting by requirement level does not make sense there. If someone needs to sort differently, they still could
Ideal outcome would be that language SIGs won't need to write any JQ and would only do something complicated to implement non-standard behavior.
params:
excluded: ["ios", "aspnetcore", "signalr", "android", "dotnet", "jvm", "kestrel"]stable_package_name: opentelemetry.semconvtemplates:
- pattern: semantic_attributes.j2filter: > .grouped_attributes # filter based on stability - could be more convenient | map(select(if $filter == "any" then true else .stability == $filter end)) }) # filter based on excluded namespaces - could be more convenient | map(select(.root_namespace as $id | any( $excluded[]; . == $id) | not )) | map(select(.attributes | length > 0)) | map({ root_namespace, attributes, output: $output + "attributes/", stable_package_name: $stable_package_name + ".attributes", filter: $filter })
The text was updated successfully, but these errors were encountered:
lmolkova
changed the title
Add pre-massaged data into jinja context when generating registry
Add pre-massaged data into jinja/jq context when generating registry
Jun 10, 2024
When generating code, in many cases the JQ part would be similar between different languages.
It particular:
grouping attributes by the root namespace (note:
id
of the group in the registry is not always accurate - only the attribute name is ).Here's the JQ
It can be implemented once in rust and appear in the Jinja context as an additional
ctx.grouped_attributes
property - nobody would need to write and debug it again.Same with metrics, events, etc.
Implement the outcome of Code generation: how to avoid naming collisions semantic-conventions#1118
E.g. Option 3.5 implementation looks like
I'm not sure how far we can go there, but it could be that
ctx.grouped_attributes
from p1 above provides all the default behavior we want codegen to follow and resolves collisions in a common way. Someone can still use rawgroups
and massage data with JQ if they want to.Minor: sort attributes in
ctx.grouped_attributes
by name. Requirement level does not appear in attribute definitions code, sorting by requirement level does not make sense there. If someone needs to sort differently, they still couldIdeal outcome would be that language SIGs won't need to write any JQ and would only do something complicated to implement non-standard behavior.
As a first step, it'd be great to reduce https://github.com/lmolkova/opentelemetry-python/blob/5d151671ff9ad5ecb20c507ddfe64684a46aa6c6/scripts/semconv/templates/registry/weaver.yaml#L1-L31 to something like
The text was updated successfully, but these errors were encountered: