Repository navigation
Make weaver.yaml more customizeable via toml and params - #1561
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends Weaverβs templating configuration model to support reusable template packages while allowing project-specific overrides via .weaver.toml, and adds conditional template execution via a new when (JQ) clause in weaver.yaml.
Changes:
- Add project-level
[template]config in.weaver.toml(acronyms + text maps) and merge it into each template packageβsweaver.yamlconfig with TOML taking precedence. - Add optional
when(JQ expression) on template entries to conditionally apply templates based on params/registry content. - Update schema/docs and add end-to-end tests covering acronym/text_map merging and
whengating.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/registry_generate.rs | Adds integration tests for TOML template merges and when gating. |
| src/registry/update_markdown.rs | Applies project-level template overrides when building template config for update-markdown. |
| src/registry/mod.rs | Introduces apply_template_config helper to merge project template settings into forge config. |
| src/registry/json_schema.rs | Exposes the new template section in the generated .weaver.toml schema. |
| src/registry/generate.rs | Applies project-level template overrides when building template config for generate. |
| schemas/weaver-config.json | Adds JSON schema for the new top-level template section. |
| docs/weaver-config.md | Documents the new per-template when clause. |
| crates/weaver_forge/src/lib.rs | Implements when evaluation and gating before filtering/rendering a template. |
| crates/weaver_forge/src/config.rs | Adds when field to template config; adds merge helpers for acronyms/text maps. |
| crates/weaver_config/src/template.rs | Defines TOML-deserializable project-level TemplateConfig. |
| crates/weaver_config/src/lib.rs | Adds template to WeaverConfig and re-exports TemplateConfig. |
π‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This PR has review comments. Review suggestions, whether from maintainers or automated reviewers, aren't always correct or required. Please evaluate each comment on its merits, then make sure each thread has a clear outcome. For example, link to the commit if you applied a suggestion, explain why it wasn't applied, or ask a follow-up question. Automation flags a PR for human review once every review thread has a reply or is marked as resolved. Status across open PRs is visible on the pull request dashboard. |
Codecov Reportβ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1561 +/- ##
=====================================
Coverage 81.9% 82.0%
=====================================
Files 129 129
Lines 10917 10948 +31
=====================================
+ Hits 8946 8978 +32
+ Misses 1971 1970 -1 β View full report in Codecov by Harness. π New features to boost your workflow:
|
|
I haven't had a detailed look at this yet but how does it fit in with the spec we agreed on here: https://github.com/open-telemetry/weaver/blob/main/docs/specs/package-vs-project-config/config-proposal.md ? I partially completed phase 2 in the implementation plan. But did not tackle things to do with templates, this bullet in the doc for example:
Phase 3 renames the weaver.yaml to weaver_template.yaml to disambiguate too. Perhaps this PR covers the missing parts of Phase 2 and should include Phase 3? |
The acronyms and maps are based exactly on the proposal with a caveat that I used It's part of the phase 2 and doesn't do anything from the phase 3 |
jerbly
left a comment
There was a problem hiding this comment.
Nice! Probably just needs a changelog entry and maybe something in the docs to finish.
To support reusable templates here open-telemetry/opentelemetry-weaver-packages#38, we need to make templates + weaver.yaml more customizable.
Several things that should be configurable by semconv repos:
This PR
whenclause into weaver yamltemplatesection that contains JQ expression that controls if this template is on.E.g.
Would only be triggered when
$generate_span_registryis trueand
would be triggered when any of
generate_*_registryparams is true.Reusing JQ conditions in
whento matchfilter.open-telemetry/opentelemetry-weaver-packages#38 is demonstrating this version and open-telemetry/semantic-conventions-genai@main...lmolkova:semantic-conventions-genai:reusable-templates-demo shows e2e.