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

feat: add nomad input plugin #10106

Merged
merged 14 commits into from
Dec 8, 2021

Conversation

efbar
Copy link
Contributor

@efbar efbar commented Nov 15, 2021

Required for all PRs:

Add the input for Hashicorp Nomad.

@telegraf-tiger
Copy link
Contributor

Thanks so much for the pull request!
🤝 ✒️ Just a reminder that the CLA has not yet been signed, and we'll need it before merging. Please sign the CLA when you get a chance, then post a comment here saying !signed-cla

@telegraf-tiger telegraf-tiger bot added fix pr to fix corresponding bug new plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Nov 15, 2021
@efbar
Copy link
Contributor Author

efbar commented Nov 15, 2021

!signed-cla

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.

Hey @efbar, thanks for this nice PR. Overall the code already looks quite good already. Nevertheless, I have some comments in the code, the most severe being the use of panic which should be replaced by a returned error. Please take a look.

plugins/inputs/nomad/README.md Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad_test.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad_test.go Outdated Show resolved Hide resolved
@srebhan srebhan removed the fix pr to fix corresponding bug label Nov 16, 2021
@srebhan srebhan self-assigned this Nov 16, 2021
@efbar
Copy link
Contributor Author

efbar commented Nov 16, 2021

Hi @srebhan, I will fix those suggestions as soon as possible.
On writing this plugin I've took inspiration from Kubernetes one, so probably some of those fixes are needed in there too.
Thank you for the review!

@srebhan
Copy link
Member

srebhan commented Nov 17, 2021

On writing this plugin I've took inspiration from Kubernetes one, so probably some of those fixes are needed in there too.

@efbar possibly. We have some "grown" plugins that were never pushed to the current possibilities. If you like, fixes are welcome. :-)

@efbar efbar requested a review from srebhan November 17, 2021 17:31
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.

Nice update @efbar! We are comming closer. Nevertheless, I have some more comments. Please take a look.

plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
@efbar efbar requested a review from srebhan November 18, 2021 15:49
@efbar
Copy link
Contributor Author

efbar commented Nov 18, 2021

Hi @srebhan , I think we are almost there. Let me know if you see something else. But I have a question maybe not strictly related. If I want to add a dashboard for these metrics, is this the right place to start? https://docs.influxdata.com/influxdb/v2.1/influxdb-templates/use/#use-influxdb-community-templates

plugins/inputs/nomad/README.md Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
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.

@efbar almost. I have 3 formatting/sync to README comments and one more regarding the timeout-handling. Currently, you enforce a minimum timeout of one second, I think you should rather set the default in init() (lowercase) as suggested in my comment and allow a free choice for the user (including a zero value which means "no timeout").

plugins/inputs/nomad/nomad_test.go Show resolved Hide resolved
plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
plugins/inputs/nomad/nomad_test.go Outdated Show resolved Hide resolved
@efbar efbar requested a review from srebhan November 23, 2021 15:15
@efbar
Copy link
Contributor Author

efbar commented Nov 23, 2021

Thank you (again) for the review @srebhan 🙂

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.

@efbar one last newline, otherwise code looks good.

plugins/inputs/nomad/nomad.go Outdated Show resolved Hide resolved
@efbar efbar requested a review from srebhan November 29, 2021 16:52
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.

Looks good to me. Thanks for all your effort @efbar!

@srebhan srebhan added ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. and removed ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. labels Nov 30, 2021
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.

Hey @efbar, sorry the linter found one more issue...

plugins/inputs/nomad/nomad_test.go Outdated Show resolved Hide resolved
@efbar efbar requested a review from srebhan November 30, 2021 11:04
@efbar
Copy link
Contributor Author

efbar commented Nov 30, 2021

Thanks for your time on the reviews @srebhan ! I appreciate your help so much 😄

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.

Looks good to me (and also the linter now). ;-P

@srebhan
Copy link
Member

srebhan commented Nov 30, 2021

Thanks for your kind words @efbar. Really love to work with all of you, it's a fantastic experience...

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Nov 30, 2021
@efbar
Copy link
Contributor Author

efbar commented Nov 30, 2021

Hi @srebhan , just in time for this fix. After some deeper review I noticed that Nomad metrics API, unlike most of the others, doesn't need of any token for query metric. So I removed completely that token handling part. (here, https://www.nomadproject.io/api-docs/metrics, you can see that no ACL is needed, surprisedly).
From the plugin point of view this solution is better in the sense that is even simpler to configure.

@efbar efbar requested a review from srebhan November 30, 2021 14:19
@telegraf-tiger
Copy link
Contributor

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.

@efbar even better as we now carry less code. :-)
Still looks good to me.

@efbar efbar mentioned this pull request Dec 1, 2021
3 tasks
Copy link
Contributor

@MyaLongmire MyaLongmire left a comment

Choose a reason for hiding this comment

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

Thank you for this pr!

@MyaLongmire MyaLongmire merged commit dbf5553 into influxdata:master Dec 8, 2021
@efbar
Copy link
Contributor Author

efbar commented Dec 10, 2021

Happy I could be of help @MyaLongmire !

powersj pushed a commit to powersj/telegraf that referenced this pull request Jan 21, 2022
phemmer added a commit to phemmer/telegraf that referenced this pull request Feb 18, 2022
* origin/master: (133 commits)
  chore: restart service if it is already running and upgraded via RPM (influxdata#9970)
  feat: update etc/telegraf.conf and etc/telegraf_windows.conf (influxdata#10237)
  fix: Handle duplicate registration of protocol-buffer files gracefully. (influxdata#10188)
  fix(http_listener_v2): fix panic on close (influxdata#10132)
  feat: add Vault input plugin (influxdata#10198)
  feat: support aws managed service for prometheus (influxdata#10202)
  fix: Make telegraf compile on Windows with golang 1.16.2 (influxdata#10246)
  Update changelog
  feat: Modbus add per-request tags (influxdata#10231)
  fix: Implement NaN and inf handling for elasticsearch output (influxdata#10196)
  feat: add nomad input plugin (influxdata#10106)
  fix: Print loaded plugins and deprecations for once and test (influxdata#10205)
  fix: eliminate MIB dependency for ifname processor (influxdata#10214)
  feat: Optimize locking for SNMP MIBs loading. (influxdata#10206)
  feat: Add SMART plugin concurrency configuration option, nvme-cli v1.14+ support and lint fixes. (influxdata#10150)
  feat: update configs (influxdata#10236)
  fix(inputs/kube_inventory): set TLS server name config properly (influxdata#9975)
  fix: Sudden close of Telegraf caused by OPC UA input plugin (influxdata#10230)
  fix: bump github.com/eclipse/paho.mqtt.golang from 1.3.0 to 1.3.5 (influxdata#9913)
  fix: json_v2 parser timestamp setting (influxdata#10221)
  fix: ensure graylog spec fields not prefixed with '_' (influxdata#10209)
  docs: remove duplicate links in CONTRIBUTING.md (influxdata#10218)
  fix: pool detection and metrics gathering for ZFS >= 2.1.x (influxdata#10099)
  fix: parallelism fix for ifname processor (influxdata#10007)
  chore: Forbids "log" package only for aggregators, inputs, outputs, parsers and processors (influxdata#10191)
  docs: address documentation gap when running telegraf in k8s (influxdata#10215)
  feat: update etc/telegraf.conf and etc/telegraf_windows.conf (influxdata#10211)
  fix: mqtt topic extracting no longer requires all three fields (influxdata#10208)
  fix: windows service - graceful shutdown of telegraf (influxdata#9616)
  feat: update etc/telegraf.conf and etc/telegraf_windows.conf (influxdata#10201)
  feat: Modbus support multiple slaves (gateway feature) (influxdata#9279)
  fix: Revert unintented corruption of the Makefile from influxdata#10200. (influxdata#10203)
  chore: remove triggering update-config bot in CI (influxdata#10195)
  Update changelog
  feat: Implement deprecation infrastructure (influxdata#10200)
  fix: extra lock on init for safety (influxdata#10199)
  fix: resolve influxdata#10027 (influxdata#10112)
  fix: register bigquery to output plugins influxdata#10177 (influxdata#10178)
  fix: sysstat use unique temp file vs hard-coded (influxdata#10165)
  refactor: snmp to use gosmi (influxdata#9518)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants