Skip to content

[8.15](backport #39796) Upgrade azure-eventhub to the new Event Hub SDK#40455

Merged
zmoog merged 3 commits into8.15from
mergify/bp/8.15/pr-39796
Aug 12, 2024
Merged

[8.15](backport #39796) Upgrade azure-eventhub to the new Event Hub SDK#40455
zmoog merged 3 commits into8.15from
mergify/bp/8.15/pr-39796

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify bot commented Aug 8, 2024

Proposed commit message

Restructure the azure-eventhub input, rebranding the current version as processor v1. Add a brand new processor v2, allowing users to select which version to use in the config:

  • processor v1: uses the legacy Event Hub SDK (default processor, at least for 8.15)
  • processor v2: uses the modern Event Hub SDK

Why are we introducing a processor v2?

Notes for reviewers

Overview

To help with the review, here is an overview of the main flow of the processor v2-based input.

  • The processor v2 starts a new consumer for each event hub partition.
  • Each consumer creates a pipeline client.
  • When a consumer receives an event, it decodes it and sends it to the pipeline client.
  • When the pipeline successfully processes the event, it acknowledges with the consumer.
  • The consumer stores the sequence number of the last successful event in the partition blob in the storage account container.

image

New features

  • Replace the legacy SDK with the new modern and supported SDK
  • Add support for publishing ACKs
  • Add a migration assistant to migrate checkpoint v1 information to the v2 format

Replace the legacy SDK with the new modern and supported SDK

The new SDK is more flexible and allows us to implement new features and configuration options.

Add support for publishing ACKs

Now, the processor v2 updates the sequence number only when the events have been successfully delivered to Elasticsearch.

Add a migration assistant to migrate checkpoint v1 information to the v2 format

On the first start of the processor v2, the migration assistant (enabled by default) checks if checkpoint v1 information exists from processor v1 and migrates them to the v2 format.

See "Scenario 001: Migration" at x-pack/filebeat/input/azureeventhub/README.md for more details.

New configuration options

There are new configuration options for v2:

  • storage_account_connection_string (required) to authenticate with the storage account container.
  • migrate_checkpoint (optional, default: yes) controls if the processor v2 should check and migrate checkpoint v1 information on start.
  • processor_version (optional, default: v1) which processor version to use.
  • processor_update_interval (optional, default: 10s) time interval between checking if new partitions are available.
  • processor_start_position (optional, default: earliest) controls if the processor should start from the beginning earliest or the latest event in the event hub retention period.
  • partition_receive_timeout (optional, default: 5s)
  • partition_receive_count (optional, default: 100)

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Disruptive User Impact

How to test this PR locally

See "Test Scenarios" section in the x-pack/filebeat/input/azureeventhub/README.md file.

Related issues

Use cases

Screenshots

Logs

### Author's Checklist
- [ ] Test that the `migrationAssistant` returns a "failed to download checkpoint v1 information for partition"
- [ ] Test that the `migrationAssistant` returns a "failed to parse offset"
- [ ] Compare Storage Account metrics (transactions, blob capacity, blob count, egress, ingress) between v1 and v2
- [ ] Elastic Agent build
- [ ] Performance testing with 1K, 10K, 100K, 1M log events
```<hr>This is an automatic backport of pull request #39796 done by [Mergify](https://mergify.com).

Restructure the `azure-eventhub` input, rebranding the current version as processor v1. Add a brand new processor v2, allowing users to select which version to use in the config:

- processor v1: uses the [legacy](https://github.com/azure/azure-event-hubs-go) Event Hub SDK (default processor, at least for 8.15)
- processor v2: uses the [modern](https://github.com/azure/azure-sdk-for-go/blob/main/sdk/messaging/azeventhubs/) Event Hub SDK

Why are we introducing a processor v2?

- processor v1 uses deprecated libraries
  - [github.com/Azure/azure-event-hubs-go](http://github.com/Azure/azure-event-hubs-go) (legacy)
  - [github.com/Azure/azure-storage-blob-go](http://github.com/Azure/azure-storage-blob-go) (legacy, [retiring](https://azure.microsoft.com/en-gb/updates/retirement-notice-the-legacy-azure-storage-go-client-libraries-will-be-retired-on-13-september-2024/) on Sep 2024)
- processor v1 does not support publishing acks (mostly due to lack of hooks; the legacy SDK is a black box)

---------

Co-authored-by: Tiago Queiroz <me@tiago.life>
Co-authored-by: Andrew Gizas <andreas.gkizas@elastic.co>
Co-authored-by: subham sarkar <sarkar.subhams2@gmail.com>
(cherry picked from commit b95a8a0)

# Conflicts:
#	go.mod
#	go.sum
@mergify mergify bot requested review from a team as code owners August 8, 2024 05:41
@mergify mergify bot added backport conflicts There is a conflict in the backported pull request labels Aug 8, 2024
@mergify mergify bot assigned zmoog Aug 8, 2024
@mergify
Copy link
Copy Markdown
Contributor Author

mergify bot commented Aug 8, 2024

Cherry-pick of b95a8a0 has failed:

On branch mergify/bp/8.15/pr-39796
Your branch is up to date with 'origin/8.15'.

You are currently cherry-picking commit b95a8a0383.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   NOTICE.txt
	new file:   x-pack/filebeat/input/azureeventhub/README.md
	modified:   x-pack/filebeat/input/azureeventhub/config.go
	modified:   x-pack/filebeat/input/azureeventhub/config_test.go
	new file:   x-pack/filebeat/input/azureeventhub/decoder.go
	new file:   x-pack/filebeat/input/azureeventhub/decoder_test.go
	modified:   x-pack/filebeat/input/azureeventhub/input.go
	modified:   x-pack/filebeat/input/azureeventhub/input_test.go
	modified:   x-pack/filebeat/input/azureeventhub/metrics.go
	modified:   x-pack/filebeat/input/azureeventhub/metrics_test.go
	modified:   x-pack/filebeat/input/azureeventhub/sanitization_test.go
	modified:   x-pack/filebeat/input/azureeventhub/v1_input.go
	new file:   x-pack/filebeat/input/azureeventhub/v1_input_test.go
	new file:   x-pack/filebeat/input/azureeventhub/v2_input.go
	new file:   x-pack/filebeat/input/azureeventhub/v2_migration.go
	modified:   x-pack/filebeat/module/azure/activitylogs/config/azure-eventhub.yml
	modified:   x-pack/filebeat/module/azure/activitylogs/manifest.yml
	modified:   x-pack/filebeat/module/azure/auditlogs/config/azure-eventhub.yml
	modified:   x-pack/filebeat/module/azure/auditlogs/manifest.yml
	modified:   x-pack/filebeat/module/azure/platformlogs/config/azure-eventhub.yml
	modified:   x-pack/filebeat/module/azure/platformlogs/manifest.yml
	modified:   x-pack/filebeat/module/azure/signinlogs/config/azure-eventhub.yml
	modified:   x-pack/filebeat/module/azure/signinlogs/manifest.yml

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   go.mod
	both modified:   go.sum

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Aug 8, 2024
@botelastic
Copy link
Copy Markdown

botelastic bot commented Aug 8, 2024

This pull request doesn't have a Team:<team> label.

@mergify
Copy link
Copy Markdown
Contributor Author

mergify bot commented Aug 12, 2024

This pull request has not been merged yet. Could you please review and merge it @zmoog? 🙏

@pierrehilbert
Copy link
Copy Markdown
Contributor

@zmoog could you please have a look here?

@zmoog
Copy link
Copy Markdown
Contributor

zmoog commented Aug 12, 2024

@zmoog could you please have a look here?

Yep, it's on my today's to-do list.

@pierrehilbert
Copy link
Copy Markdown
Contributor

Thanks, just wanted to ensure it was under your radar.

@zmoog zmoog merged commit c3c40c6 into 8.15 Aug 12, 2024
@zmoog zmoog deleted the mergify/bp/8.15/pr-39796 branch August 12, 2024 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport conflicts There is a conflict in the backported pull request needs_team Indicates that the issue/PR needs a Team:* label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants