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

Report events to InfluxDB in batches #23

Merged
merged 3 commits into from
Jun 4, 2023

Conversation

randycoulman
Copy link
Contributor

@randycoulman randycoulman commented Oct 9, 2021

NOTE: This PR is built on top of #22 so that it was possible to run the tests successfully. Please merge that PR first. Only the last commit is part of this PR.

Closes #13
Closes #16

This is a replacement PR for #16, which we made a mess of accidentally. We have been running this code in production for some time now, and it seems to work well for us.

  • Introduces a new BatchReporter that collects formatted line protocol "events" to be published (up to the maximum batch_size configuration value) when events are being emitted quickly, but can scale down to publishing single events when they are emitted more slowly.
  • Introduces new configuration value :batch_size which is the maximum number of events to send to InfluxDB in a single batch (defaults to 1: no batching)
  • Introduces a new Publisher behavior with HTTP and UDP implementations. The Publisher is now responsible for sending events to InfluxDB based on the protocol specified in the config.
  • Start new EventHandler and publisher-specific GenServers at start time.
  • EventHandler is no longer responsible for sending events to InfluxDB. It now enqueues events with their corresponding config ([{event, config}]) in the BatchReporter. The BatchReporter calls the BatchHandler which uses the configured Publisher to publish/send the events to InfluxDB.
  • Removed now-obsolete protocol-specific EventHandlers.
  • Introduces a new BatchHandler that "handles" publishing batches of line protocol as a single newline separated body

Randy Coulman and others added 2 commits October 8, 2021 18:59
The official `latest` Docker image for InfluxDB is now a 2.x image. That image now supports initial provisioning via environment variables like the 1.x image does.

This makes the following changes:
- Explicitly use a v1.x image (latest is 1.8) for the v1 tests
- Use the DockerHub image for v2 tests
- Use the new image's built-in provisioning support to simplify the Makefile
- Use a hard-coded token to avoid having to inject it everywhere dynamically in the tests
- Revert back to using `/api/v2/delete` for cleaning up after tests. It is now supported again, and the v1 compatibility endpoint wasn't working the same way with the latest version.
- Remove the `.token` file from `.gitignore`; we no longer generate this file.
- Introduces a new BatchReporter that collects formatted line protocol "events" to be published (up to the maximum batch_size configuration value) when events are being emitted quickly, but can scale down to publishing single events when they are emitted more slowly.
- Introduces new configuration value :batch_size which is the maximum number of events to send to InfluxDB in a single batch (defaults to 1: no batching)
- Introduces a new Publisher behavior with HTTP and UDP implementations. The Publisher is now responsible for sending events to InfluxDB based on the protocol specified in the config.
- Start new EventHandler and publisher-specific GenServers at start time.
- EventHandler is no longer responsible for sending events to InfluxDB. It now enqueues events with their corresponding config ([{event, config}]) in the BatchReporter. The BatchReporter calls the BatchHandler which uses the configured Publisher to publish/send the events to InfluxDB.
- Removed now-obsolete protocol-specific EventHandlers.
- Introduces a new BatchHandler that "handles" publishing batches of line protocol as a single newline separated body

Co-authored-by: Iris Scholten <[email protected]>
Co-authored-by: Delmer Reed <[email protected]>
Co-authored-by: Palak Bhojani <[email protected]>
Co-authored-by: Marc Delagrammatikas <[email protected]>
@ludwikbukowski ludwikbukowski merged commit 2966d20 into ludwikbukowski:master Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase event throughput to InfluxDB
3 participants