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

Generate markdown snippets using weaver_forge templates #141

Merged
merged 11 commits into from
May 2, 2024

Conversation

jsuereth
Copy link
Contributor

@jsuereth jsuereth commented May 2, 2024

Fixes #117

Add an option where markdown snippets are generated using Jinja / weaver_forge.

  • Fix an issue in cache/git resolver now that semconv repo has non-model yaml files.
  • Add new hooks in weaver_forge for generating just strings from templates.
  • Add optional weaver_forge support to weaver_semconv_gen for snippet generation.
  • Update documentation of weaver_semconv_gen (note: maybe this one needs a better name)

Example:

weaver registry update-markdown \
  --registry=model \
  --attribute-registry-base-url=/docs/attributes-registry" \
  --templates=templates \
  --target=markdown \
  --dry_run \
  docs/

This will look for a jinja template templates/registry/markdown/snippet.md.j2 and use it to generate markdown snippets instead of hardcoded write! statements.

Create a prototype where markdown snippets are generated using Jinja / weaver_forge.

- Fix an issue in cache/git resolver now that semconv repo has non-model yaml files.
- Add new hooks in weaver_forge for generating just strings from templates.
- Add optional weaver_forge support to weaver_semconv_gen for snippet generation.

Lots of things that should be config are still hardcoded.
Copy link

codecov bot commented May 2, 2024

Codecov Report

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

Project coverage is 74.8%. Comparing base (f6cecba) to head (2c34804).

Files Patch % Lines
crates/weaver_cache/src/lib.rs 0.0% 5 Missing ⚠️
crates/weaver_forge/src/registry.rs 89.4% 4 Missing ⚠️
crates/weaver_forge/src/error.rs 0.0% 3 Missing ⚠️
crates/weaver_forge/src/lib.rs 77.7% 2 Missing ⚠️
crates/weaver_semconv_gen/src/lib.rs 97.7% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main    #141     +/-   ##
=======================================
+ Coverage   71.9%   74.8%   +2.8%     
=======================================
  Files         40      40             
  Lines       2208    2288     +80     
=======================================
+ Hits        1589    1712    +123     
+ Misses       619     576     -43     

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

jsuereth added 2 commits May 2, 2024 08:37
- Update to only use ONE snippet template for all snippets.
- Update context for snippets to include attribute registry base url
- Update documentation.
@jsuereth jsuereth changed the title Prototype snippets on templates Generate markdown snippets using weaver_forge templates May 2, 2024
@jsuereth jsuereth marked this pull request as ready for review May 2, 2024 12:50
@jsuereth jsuereth requested a review from lquerel as a code owner May 2, 2024 12:50
Copy link
Contributor

@lquerel lquerel left a comment

Choose a reason for hiding this comment

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

LGTM

crates/weaver_forge/src/lib.rs Outdated Show resolved Hide resolved
@jsuereth jsuereth merged commit 5774736 into open-telemetry:main May 2, 2024
20 checks passed
@jsuereth jsuereth deleted the snippet-gen-used-forge branch May 2, 2024 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Move semconv snippet generation to Jinja templating
2 participants