Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename kubernetes_node measurements in inputs.kube_inventory or inputs.kubernetes #9451

Closed
sjwang90 opened this issue Jun 29, 2021 · 3 comments · Fixed by #15049
Closed

Rename kubernetes_node measurements in inputs.kube_inventory or inputs.kubernetes #9451

sjwang90 opened this issue Jun 29, 2021 · 3 comments · Fixed by #15049
Labels
area/k8s breaking change Improvement to Telegraf that requires changes to the plugin or agent; for minor/major releases feature request Requests for new plugin and for new features to existing plugins

Comments

@sjwang90
Copy link
Contributor

sjwang90 commented Jun 29, 2021

Feature Request

Proposal:

The same measurement name causes conflicts for those users that have both inputs.kube_inventory and inputs.kubernetes plugins.

Current behavior:

kubernetes_node metric is emitted by both inputs.kube_inventory and inputs.kubernetes but each emit different field and tag keys. This causes problems and confusion when both input plugins are enabled.

Example query:

select capacity_cpu_cores, cpu_usage_core_nanoseconds / 1000000000 from kubernetes_node where time > now() - 12h group by kubernetes_cluster;

Resulting in output such as:

2021-03-15T20:41:30Z 32
2021-03-15T20:41:30Z 32
2021-03-15T20:41:30Z 1.200665496
2021-03-15T20:41:30Z 32
2021-03-15T20:41:30Z 32
2021-03-15T20:41:30Z 32
2021-03-15T20:41:30Z 32 1.275632175
2021-03-15T20:41:30Z 32
2021-03-15T20:41:30Z 32
2021-03-15T20:41:30Z 32

Desired behavior:

One of the metrics should be renamed.

Use case:

When the customer tries to query a kubernetes_node measurement, they get no or incorrect results results, and it seems there is a conflict preventing results from showing up. A Telegraf user in Kubernetes is likely to enable both plugins so this could be a common problem.

@sjwang90 sjwang90 added the feature request Requests for new plugin and for new features to existing plugins label Jun 29, 2021
@chunleiz
Copy link

it could be achieved through configuration

[[inputs.kube_inventory]]
fieldpass = ["capacity_cpu_cores"]
[[inputs.kubernetes]]
fieldpass = ["cpu_usage_core_nanoseconds "]
[[processors.rename]]
[[processors.rename.replace]]
measurement = "kube_inventory"
dest = "kubernetes_node"
[[processors.rename.replace]]
measurement = "kubernetes"
dest = "kubernetes_node"

@sjwang90
Copy link
Contributor Author

Thanks @chunleiz - is adding a processor sufficient for you? If it is we'll just have this as an item to add to plugin READMEs.

@sjwang90
Copy link
Contributor Author

sjwang90 commented Mar 31, 2022

Current workaround:

  • Use the rename processor to rename one of the kubernetes_node measurement names
  • name_override won't work since it'll rename ALL measurement names

Proposed solutions:

Rename the inputs.kube_inventory measurement name since it's the newer plugin (release in 2019, inputs.kubernetes released in 2016)

  • Add a config option to existing inputs.kube_inventory config to rename measurement when using both kubernetes and kube_inventory plugins
  • BREAKING CHANGE (not until 2.0)
    • Permanently rename one of the measurements in one of the plugins
    • OR
    • Merge plugins together (might not be possible as kubernetes - performance focused, kube_inventory - state focused/metadata)

To-do:

  • Determine new measurement name for kube_inventory. @Jayclifford345 take a look at the kube_inventory endpoint to see what the kubernetes_node should be renamed

@sjwang90 sjwang90 added the breaking change Improvement to Telegraf that requires changes to the plugin or agent; for minor/major releases label Mar 31, 2022
powersj added a commit to powersj/telegraf that referenced this issue Mar 22, 2024
The k8s and kube_node plugins produce the same metric name that can
conflict. Provide an option in the k8s plugin to change the name.

fixes: influxdata#9451
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/k8s breaking change Improvement to Telegraf that requires changes to the plugin or agent; for minor/major releases feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants