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

Azure IoT Hub / Azure Event Hub input plugin (with go modules) #6928

Merged
merged 21 commits into from
Mar 16, 2020

Conversation

R290
Copy link
Contributor

@R290 R290 commented Jan 20, 2020

As discussed in issue #5231 and pull request #5370.
Feedback on code quality or anything else is greatly appreciated.

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

@danielnelson danielnelson added area/azure Azure plugins including eventhub_consumer, azure_storage_queue, azure_monitor new plugin labels Jan 22, 2020
@danielnelson danielnelson added this to the 1.14.0 milestone Jan 22, 2020
@sjwang90 sjwang90 added the area/iot New plugins or features relating to IoT monitoring label Feb 3, 2020
@sjwang90
Copy link
Contributor

Hi @R290, we will review this PR this week.

Copy link
Contributor

@danielnelson danielnelson left a comment

Choose a reason for hiding this comment

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

I haven't ran the plugin yet, planning to try it out soon, but here are my initial comments. In addition to these, I notice there are no tests. This is probably a tricky plugin to unit test, but I think we should get started with at least some tests for Init(), I may have some suggestions later on for more tests too.

go.mod Show resolved Hide resolved
plugins/inputs/eventhub/eventhub.go Outdated Show resolved Hide resolved
plugins/inputs/eventhub/eventhub.go Outdated Show resolved Hide resolved
plugins/inputs/eventhub/eventhub.go Outdated Show resolved Hide resolved
plugins/inputs/eventhub/eventhub.go Outdated Show resolved Hide resolved
plugins/inputs/eventhub/eventhub.go Outdated Show resolved Hide resolved
plugins/inputs/eventhub/eventhub.go Outdated Show resolved Hide resolved
plugins/inputs/eventhub/eventhub.go Outdated Show resolved Hide resolved
plugins/inputs/eventhub/eventhub.go Outdated Show resolved Hide resolved
plugins/inputs/eventhub/eventhub.go Outdated Show resolved Hide resolved
Copy link
Contributor

@danielnelson danielnelson left a comment

Choose a reason for hiding this comment

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

The metric tracking code is a bit fidgety, sorry about that. I'll put together a change that addresses my comments and open a PR against your fork.

metric tracking comment: #6928 (comment)

go.mod Outdated Show resolved Hide resolved
plugins/inputs/eventhub/eventhub.go Outdated Show resolved Hide resolved
plugins/inputs/eventhub/README.md Show resolved Hide resolved
@danielnelson
Copy link
Contributor

I opened the PR against your fork, R290#1, which should take care of the metric handling issues. There are a few more things on top of that PR that we need to take care of:

  1. I noticed during testing that if you are consuming more than one partition, it isn't safe to use the same offset to restart the consumer. This is because one partition could have a new offset that would be invalid on the other partition. I believe for the starting_offset option we will need to either allow it to be set per offset. Perhaps we should drop this option for now?
  2. Still need to add some tests.
  3. Rename to eventhub_consumer, we can do this after merge though.

@R290
Copy link
Contributor Author

R290 commented Mar 15, 2020

Thank you for your pull request!

  1. You are right and the from starting offset option is dropped
  2. What could we test without actually connecting to an eventhub? In an earlier comment you mentioned testing the Init() function, how would one go about writing tests for this? (I'm still very green when it comes to writing tests)
  3. Fine by me

At some point we could consider dropping the Azure/azure-event-hubs-go library altogether and creating a generic AMQP 1.0 consumer based on Azure/go-amqp. Some elements from Azure/azure-amqp-common-go could be needed for the Event Hub and IoT Hub specific stuff. I think this would allow for a plugin closer to the Telegraf design philosophy?

@danielnelson
Copy link
Contributor

I rebased your branch since I couldn't figure out why GitHub still reported a conflict.

At some point we could consider dropping the Azure/azure-event-hubs-go library altogether and creating a generic AMQP 1.0 consumer based on Azure/go-amqp.

I'd definitely like to do have a generic amqp1 input. I'm imagining we would have an eventhub_consumer + amqp1_consumer inputs and an eventhub + amqp1 output. I'm not sure if we could get away with eventually having only the amqp1 plugins though, we might need the eventhub plugin for some of the authentication options?

@danielnelson danielnelson merged commit f69b639 into influxdata:master Mar 16, 2020
denzilribeiro pushed a commit to denzilribeiro/telegraf that referenced this pull request Mar 27, 2020
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
veorlo pushed a commit to GlobalNOC/telegraf that referenced this pull request May 4, 2020
HarshitOnGitHub pushed a commit to HarshitOnGitHub/telegraf that referenced this pull request May 8, 2020
idohalevi pushed a commit to idohalevi/telegraf that referenced this pull request Sep 29, 2020
@R290 R290 deleted the eventhub branch January 18, 2022 20:57
arstercz pushed a commit to arstercz/telegraf that referenced this pull request Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/azure Azure plugins including eventhub_consumer, azure_storage_queue, azure_monitor area/iot New plugins or features relating to IoT monitoring new plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants