chore(metrics): generate internal metric documentation from Rust source#25446
Closed
thomasqueirozb wants to merge 46 commits into
Closed
chore(metrics): generate internal metric documentation from Rust source#25446thomasqueirozb wants to merge 46 commits into
thomasqueirozb wants to merge 46 commits into
Conversation
…rable macro to support deprecated = "..." on enum variants
…ripped tag descriptions
…ags in Rust, eliminate enum metric blocks from internal_metrics.cue
…al_metrics.cue is now metadata-only
…and compile-time constants
…or inline tag shapes
…ck, remove CUE tag helpers
…ally dropped from internal_metrics.cue
…tags CUE reference
…r to use generated metrics
Member
Author
|
@vectordotdev/documentation These are the additions which should be reviewed:
All other metrics are pre-existing. |
Member
Author
|
Replaces with #25460 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #25374: internal metric documentation is now fully generated from Rust source rather than manually maintained in CUE.
website/cue/reference/components/sources/internal_metrics.cueis now metadata-only and all metric output definitions come from the generated file.CounterName,HistogramName,GaugeNameinlib/vector-common/src/internal_event/metric_name.rsnow carry///doc comments (descriptions) and#[configurable(metadata(docs::tags = ...))]annotations encoding the full tag set for each metric — including deprecation via#[configurable(deprecated = "...")]on enum variants.src/generate_schema.rsinjects_metric_schemas: {counters, histograms, gauges}into the schema JSON produced byvector generate-schema.vdev build component-docsreads_metric_schemasand generateswebsite/cue/reference/generated/internal_metric_descriptions.cuewithdescription,type,default_namespace, andtagsfor every metric.All tag-set definitions live in
lib/vector-common/src/internal_event/metric_tags.rsas composablepub static LazyLock<Value>statics built with amerge_lazy()helper. Single-use tag shapes are inlined at the variant withmerge_lazy(&BASE, json!({...})).The
#[configurable]macro now accepts path constants (SOME_CONST), macro invocations (json!(...)), reference expressions (&*LAZY), and function calls (merge_lazy(...)) as metadata values.#[configurable(deprecated = "...")]is extended to work on enum variants (previously fields only).Vector configuration
NA
How did you test this PR?
make generate-component-docspasses.cargo check --workspace --no-default-featurespasses.make check-clippypasses.The following script compares
docs.jsonbetweenmasterand this branch to verify metric fidelity (124 shared metrics are fully equal after normalization; 3 intentional changes noted):verify_metrics.py
Output
The 3 differences are intentional: two grammar fixes (
collecting of→collecting,a HTTP→an HTTP) and one type correction (open_files:counter→gauge).Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References