prometheus-community / prometheus-community/stackdriver_exporter

Bug: --monitoring.filters flag broken when filter value contains : character

Open
#476 0 comments 0 reactions 0 assignees View on GitHub

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:

  1. Set --monitoring.filters=cloudsql.googleapis.com/database/up:resource.labels.database_id="project:instance"
  2. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.