Skip to content

docs(specs): Labels and Selectors for Plugin Enablement #16884

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

neelayu
Copy link
Contributor

@neelayu neelayu commented Apr 26, 2025

Summary

Provides a spec for Plugin enable and disablement using labels and selectors.

Checklist

  • No AI generated code was used in this PR

Related issues

resolves NA
related #16704

@telegraf-tiger telegraf-tiger bot added the docs Issues related to Telegraf documentation and configuration descriptions label Apr 26, 2025
Copy link
Contributor

@Hipska Hipska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content of the spec looks good to me. Only some markup changes requested.

Please also increase/decrease headings by 1 per step. (not 3)

@neelayu neelayu requested a review from Hipska May 22, 2025 08:11
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the spec @neelayu and sorry for this taking so long! I do have some suggestions in the document...

Comment on lines 77 to 90
## Previous Issues

[Issue #9304](https://github.com/influxdata/telegraf/issues/9304)

[Issue #1317](https://github.com/influxdata/telegraf/issues/1317)

[Issue #10543](https://github.com/influxdata/telegraf/issues/10543)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Previous Issues
[Issue #9304](https://github.com/influxdata/telegraf/issues/9304)
[Issue #1317](https://github.com/influxdata/telegraf/issues/1317)
[Issue #10543](https://github.com/influxdata/telegraf/issues/10543)
## Related Issues
- [issue #1317](https://github.com/influxdata/telegraf/issues/1317) for allowing to enable/disable plugin instances
- [issue #9304](https://github.com/influxdata/telegraf/issues/9304) for partially enable a config file
- [issue #10543](https://github.com/influxdata/telegraf/issues/10543) for allowing to enable/disable plugin instances

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either you didn't push the change or you didn't apply it... At least the current code is still the old one...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably got overwritten. thanks

@srebhan srebhan self-assigned this May 28, 2025
@neelayu neelayu force-pushed the labels-selector-spec branch from d3c6bcf to 4012095 Compare May 30, 2025 11:24
@neelayu
Copy link
Contributor Author

neelayu commented May 30, 2025

Hi @srebhan
thanks for reviewing. I have addressed some of the comments- I think you got labels and selectors mixed up. Labels will be simply a list, and selectors will be following logical operations depending on the input.
Accordingly I have made the changes. Let me know.

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update @neelayu! I have some comments in the code...

Please wrap the text (not tables or code) at 80 columns as this is the convention.

Furthermore, I do have a question: With the current description how do you select
(app=web AND region=us-east) OR (app=backend AND region=eu-central) with the --label flags? I think you need to support lists also on the command-line flag to do this. Anyway, I'm OK to keep the spec as is and extend it later...


## Keywords

configuration Management, dynamic plugin selection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
configuration Management, dynamic plugin selection
configuration, dynamic plugin selection

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 13 to 15
Currently, managing plugin configurations across multiple Telegraf instances is cumbersome. Methods like commenting out plugins or renaming configuration files are not scalable. A label and selector system provides a more flexible and elegant solution.

This feature aims to simplify plugin management in Telegraf by introducing a label and selector system inspired by [Kubernetes](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/). Labels are key-value pairs provided at runtime, and selectors are defined in plugin configurations to match against these labels. This approach allows to enable plugin dynamically at startup-time, making it easier to manage configurations in large-scale deployments where a single configuration is fetched from a centralized configuration-source.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please wrap the text at 80 columns. Furthermore, use indirect links as that's more readable and we do it everywhere else (at least we should)...

Suggested change
Currently, managing plugin configurations across multiple Telegraf instances is cumbersome. Methods like commenting out plugins or renaming configuration files are not scalable. A label and selector system provides a more flexible and elegant solution.
This feature aims to simplify plugin management in Telegraf by introducing a label and selector system inspired by [Kubernetes](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/). Labels are key-value pairs provided at runtime, and selectors are defined in plugin configurations to match against these labels. This approach allows to enable plugin dynamically at startup-time, making it easier to manage configurations in large-scale deployments where a single configuration is fetched from a centralized configuration-source.
Currently, managing plugin configurations across multiple Telegraf instances is cumbersome. Methods like commenting out plugins or renaming configuration files are not scalable. A label and selector system provides a more flexible and elegant solution.
This feature aims to simplify plugin management in Telegraf by introducing a label and selector system inspired by [Kubernetes][k8s_labels]. Labels are key-value pairs provided at runtime, and selectors are defined in plugin configurations to match against these labels. This approach allows to enable plugin dynamically at startup-time, making it easier to manage configurations in large-scale deployments where a single configuration is fetched from a centralized configuration-source.
[k8s_labels]: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. made the changes

Comment on lines 77 to 90
## Previous Issues

[Issue #9304](https://github.com/influxdata/telegraf/issues/9304)

[Issue #1317](https://github.com/influxdata/telegraf/issues/1317)

[Issue #10543](https://github.com/influxdata/telegraf/issues/10543)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either you didn't push the change or you didn't apply it... At least the current code is still the old one...

Comment on lines 84 to 90
## Previous Issues

[Issue #9304](https://github.com/influxdata/telegraf/issues/9304)

[Issue #1317](https://github.com/influxdata/telegraf/issues/1317)

[Issue #10543](https://github.com/influxdata/telegraf/issues/10543)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Previous Issues
[Issue #9304](https://github.com/influxdata/telegraf/issues/9304)
[Issue #1317](https://github.com/influxdata/telegraf/issues/1317)
[Issue #10543](https://github.com/influxdata/telegraf/issues/10543)
## Related Issues
- [issue #1317](https://github.com/influxdata/telegraf/issues/1317) for allowing to enable/disable plugin instances
- [issue #9304](https://github.com/influxdata/telegraf/issues/9304) for partially enable a config file
- [issue #10543](https://github.com/influxdata/telegraf/issues/10543) for allowing to enable/disable plugin instances

@neelayu
Copy link
Contributor Author

neelayu commented Jun 6, 2025

@srebhan

Furthermore, I do have a question: With the current description how do you select
(app=web AND region=us-east) OR (app=backend AND region=eu-central) with the --label flags? I think you need to support lists also on the command-line flag to do this.

This would mean we pass

selectors = ["app=web,region=us-east", "app=backend,region=eu-central"]

To match it against the labels, we require a list of labels and it is documented in this spec. We would pass one or more --label flags

--label="app=web" --label="region=us-east" --label="another=value"

This would match for the first selector. This case is present in the 5th example of the table.

@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented Jun 6, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Issues related to Telegraf documentation and configuration descriptions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants