Allow grafana discovery tag to be passed in via commandline - #330
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped, updates all known call sites, and includes validation plus a targeted test for the new CLI surface.
Pull request overview
This PR restores cross-subscription Azure Monitor Workspace discovery for ARO Classic by making the Resource Graph discovery tag key configurable via grafanactl (instead of being implicitly tied to the ARO-HCP-specific tag).
Changes:
- Add
--discovery-tag-keybase flag (defaultaroHCPPurpose) with input validation and a unit test. - Thread the configured tag key into the Resource Graph discovery query used by
clean,manage reconcile, andmodify datasource reconcile. - Extend pipeline types + JSON schema to allow
discoveryTagKeyto be specified for Grafana-related steps, and document the new behavior.
File summaries
| File | Description |
|---|---|
| tools/grafanactl/README.md | Documents discovery-by-tag behavior and the new --discovery-tag-key flag. |
| tools/grafanactl/internal/azure/monitor.go | Adds a tag key field to Resource Graph discovery and uses it in the KQL query. |
| tools/grafanactl/cmd/modify/options.go | Passes the validated discovery tag key into the Resource Graph discovery client. |
| tools/grafanactl/cmd/manage/options.go | Passes the validated discovery tag key into the Resource Graph discovery client. |
| tools/grafanactl/cmd/clean/options.go | Passes the validated discovery tag key into the Resource Graph discovery client. |
| tools/grafanactl/cmd/base/options.go | Introduces DiscoveryTagKey, binds --discovery-tag-key, and validates it to prevent KQL injection. |
| tools/grafanactl/cmd/base/options_test.go | Adds coverage to ensure invalid tag keys are rejected. |
| pipelines/types/pipeline.schema.v1.json | Adds discoveryTagKey fields to Grafana step schemas. |
| pipelines/types/common.go | Adds DiscoveryTagKey to Grafana pipeline step structs and required-input discovery. |
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abiduke612, rachelvweber The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Allow grafana discovery tag to be passed in via commandline.
The requirement of the aro-hcp specific tag broke AMW discovery for ARO Classic.