GoogleCloudPlatform / GoogleCloudPlatform/ops-agent
Add metrics processor for excluding based on metric label
- Dominant language
- Go
- Stars
- 204
- Forks
- 87
- Avg merge
- 21h 54m
- Merged PRs (30d)
- 23
Description
I'm running the ops agent on a GCE instance. The instance is running an application that uses a large number of loopback devices, like `/dev/loop1`, `/dev/loop2`, etc. I do not want metrics to be stored for these loopback devices because it accounts for a substantial portion of the storage cost of my application's metrics.
Currently, all I can find is to disable the entire `agent.googleapis.com/disk/*` class of metrics, which is a blunt instrument that throws out metrics I want to track, like disk utilization on the main device `/dev/sda2`.
I'd like to be able to write a processor like this:
```yaml
metrics:
processors:
metrics_filter:
type: exclude_by_label
label: device
label_pattern: /dev/loop*
metrics_pattern:
- agent.googleapis.com/disk/*
```
Explanation: this is a new metrics filter type named `exclude_by_label`. It takes a `label` option, indicating the label to consider as part of the filter, and a `label_pattern` option, indicating pattern to be matched. If the value of the label matches the pattern, then the metric entry should be excluded. I kept `metrics_pattern` to indicate the metrics to which to apply the filter.
_duplicated from #2176 and from #2244 which got closed as inactive. do I need a bot to keep marking this as active so your bot doesn't automatically close it?_
Contributor guide
Research direction
Start by locating the metrics processor configuration entry point for metrics.processors.metrics_filter and reviewing how existing metrics filters apply metrics_pattern. Define the exclude_by_label behavior for label and label_pattern, then verify that matching loopback-device metrics are excluded while nonmatching disk metrics remain available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- gcp, go
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100