ci: warn when plugin metric field names are removed or renamed#18957
ci: warn when plugin metric field names are removed or renamed#18957yaseen-vm wants to merge 6 commits into
Conversation
This reverts commit ab48a5d.
Adds scripts/check-metric-names.sh and a GitHub Actions workflow that runs on every PR targeting master. When a plugin README's metric table loses a field name that was present on master, the check emits a ::warning annotation and explains the backward-compatibility impact, helping contributors acknowledge breaking changes before they merge. Closes influxdata#18955
|
Thanks so much for the pull request! |
|
!signed-cla |
|
Thanks for your contribution @yaseen-vm! Please restore the PR description template, especially the AI section, as we cannot review your PR otherwise. |
|
Thanks for the heads-up @srebhan! I've restored the PR description template and checked the AI-generated code box as this was built with Claude Code following the InfluxData AI policy. Sorry for the oversight. |
|
@yaseen-vm from what I see your approach expects the metrics to be described in the following format However, this formatting is neither guaranteed nor does a majority of the REAMEs follow this convention. So how do you expect this to work? |
|
Thank you for the feedback, @srebhan. You're right — the original implementation only matched the pipe-table format ( After sampling several plugins (e.g. I've updated the
This should give the check meaningful coverage across the plugin ecosystem. Let me know if you see any other edge cases worth handling. |
The original parser only matched pipe-table formatted field names (`| \`field_name\` | ... |`), which is rarely used across Telegraf plugin READMEs. The dominant convention is the bullet-list format under a Metrics section (` - field_name (type)`). Updated extract_fields to handle both formats so the check has meaningful coverage across the plugin ecosystem. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
|
Thanks for driving this @yaseen-vm! Instead of handling edge-cases I would prefer enforcing a certain structure for the metric description. How about the following
While this is way more than you target here it is certainly the most sustainable approach in the long run. What do you think? Are you willing to work on this? |
|
Thanks for the thoughtful feedback @srebhan! Absolutely agree — patching edge cases in the CI script is the wrong direction, and a spec-first approach is the right long-term investment. I'm happy to take this on. I've opened issue #19003 to track the full scope of work: 👉 Enforce structured metric descriptions via spec, linter, and CI #19003 The plan there mirrors exactly what you outlined:
I'll start with the spec and linter extension and keep that issue updated as I progress. Let me know if you have any preferences on the spec format or linter structure before I dive in! |
Summary
Closes #18955
scripts/check-metric-names.sh— extracts backtick-quoted field names from plugin README metric tables and warns when any name present onmasterdisappears in the PR.github/workflows/metric-names.yml— runs the script on every PR targetingmaster, only when plugin READMEs are modified0(informational warning, not a hard block), consistent with the issue's request for a CI warningHow it works
Each plugin README documents its metrics in markdown tables like:
The script compares the set of backtick-quoted names in the first column between
origin/masterandHEAD. If any name is gone, a::warningannotation is emitted pointing contributors to:legacy_*include optionVerification
Verified locally by temporarily renaming
n_cpus→n_cpus_RENAMEDinplugins/inputs/system/README.md(replicating the exact change from #18919 that triggered this issue). The check correctly identifiedn_cpusas removed and emitted the warning with guidance.No plugin READMEs changed)::warningwhen a field name is removed from a metric tableplugins/**/README.mdfiles are modifiedChecklist
Related issues
resolves #18955