open-telemetry / open-telemetry/weaver

Weaver registry diff: template.set_file_name("schema-diff.yaml") in jinja is ignored when no output dir is provided

Open
#762 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
486
Forks
108
Avg merge
3d 4h
Merged PRs (30d)
40

Description

See https://github.com/open-telemetry/semantic-conventions/pull/2307.

It has jinja template with

{{- template.set_file_name("schema-diff.yaml") }}
...

following the same pattern as we have in codegen.

If I run it without -o option:

weaver registry diff -r  ./current --baseline-registry ./baseline --diff-template ./path/to/templates --diff-format yaml

the result is printed to stdout.

If I add -o ./diff then the result is written to ./diff/schema-diff.yaml.

Suggestion:

  • if no output folder was configured, but jinja attempted to set file name, we can default to current folder or fail
  • Use the same output config between codegen templates and diff templates instead of inventing a new one - weaver registry generate does not have -o param and does something else. If we prefer -o, let's do it consistently for both options.
  • There is no need to provide default stdout experience for people coming with custom templates and custom config - assume file output as a default for them, they can always cat the file if they need stdout.

Related to #760 and #761

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the weaver registry diff entry point and trace how Jinja templates handle template.set_file_name("schema-diff.yaml") with and without -o. Compare its output configuration with weaver registry generate and the related issues #760 and #761. Done means the intended no-output-directory behavior is defined and covered for custom diff templates.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.