prometheus-community / prometheus-community/stackdriver_exporter
Bug: --monitoring.filters flag broken when filter value contains : character
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 295
- Forks
- 117
- Avg merge
- 9d 14h
- Merged PRs (30d)
- 7
Description
Root cause:
In stackdriver_exporter.go the SplitExtraFilter function uses : as a separator to split the metric prefix from the filter value:
`utils.SplitExtraFilter(ef, ":")
This breaks when the `database_id` value contains `:`, for example:
project:instance`
Fix:
`sed -i 's/utils.SplitExtraFilter(ef, ":")/utils.SplitExtraFilter(ef, "|")/' stackdriver_exporter.go
This changes the separator to `|`, so flags are written as:
--monitoring.filters=cloudsql.googleapis.com/database/up|resource.labels.database_id="project:instance"`
Steps to reproduce:
- Set --monitoring.filters=cloudsql.googleapis.com/database/up:resource.labels.database_id="project:instance"
- Exporter does not apply the filter and returns metrics for all instances
Expected: Filter is applied, only the selected instance is returned
Actual: Filter is silently ignored, all instances are returned
Environment:
- stackdriver_exporter master branch (go 1.24.0)
- Google CloudSQL database metrics
- database_id format: project-id:instance-name (contains :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in stackdriver_exporter.go at the --monitoring.filters handling and its SplitExtraFilter call. Reproduce the CloudSQL case with a database_id containing a colon, then verify that the filter is applied and only the selected instance's metrics are returned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, google-cloud
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100