influxdata / influxdata/telegraf

Handle labels in kube_inventory input like the kubernetes input does

Open
#8,546 1 comment 7 reactions 0 assignees View on GitHub
area/k8s feature request help wanted size/l
Dominant language
Go
Stars
17.8k
Forks
5.8k
Avg merge
1d 20h
Merged PRs (30d)
161

Description

## Feature Request

The Kubernetes input plugin can turn pod labels into tags on the `kubernetes_pod_container` measurement. For example, if you set `label_include = ["app.kubernetes.io/name"]`, then all your measurements will get a tag with the value of that field.

The Kubernetes Inventory plugin _also_ produces a measurement named `kubernetes_pod_container`, but this feature isn't available for that plugin. This makes it harder than necessary to aggregate across these two metrics sources (for example, to compare the `kubernetes_pod_container.memory_usage_bytes` field from the `kubernetes` plugin with the `kubernetes_pod_container.resource_requests_memory_bytes` field from the `kube_inventory` plugin.

### Proposal:

Copy the `label_include` and `label_exclude` functionality from the `kubernetes` plugin to the `kube_inventory` plugin.

...or just merge them into a single plugin, if at all possible; having them as separate plugins (that can't even really be deployed together) is kind of a PITA.

### Current behavior:
`kube_inventory` plugin doesn't allow you to turn labels into tags.

### Desired behavior:
`kube_inventory` plugin allows you to turn labels into tags, just like the `kubernetes` plugin does.

### Use case:
I want to build a dashboard in InfluxDB that displays current resource usage, resource request, and resource limit, all on the same graph. However, I want to be able to use a filter to limit the displayed metrics to pods of a given label value. I can already do this for the metrics generated by the `kubernetes` plugin (aka the resource usage), but I can't do it for metrics from the `kube_inventory` plugin (the requests and limits).

Contributor guide

Open the contributing guide

Research direction

Start by locating the kubernetes and kube_inventory input plugin implementations and compare how label_include and label_exclude are handled in the kubernetes plugin. Trace the related plugin tests or test fixtures before making the behavior consistent. Done means kube_inventory can expose selected pod labels as tags on kubernetes_pod_container while excluding configured labels, with coverage for the new behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
devops, infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.