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

OBSDATA-440 Adding SegmentMetadataEvent and publishing them via KafkaSegmentMetadataEmitter #106

Closed
wants to merge 1 commit into from

Conversation

harinirajendran
Copy link

@harinirajendran harinirajendran commented Aug 29, 2022

Adding the new SegmentMetadataEvent and publishing these segment-related metadata events into Kafka by enhancing the KafkaEmitter

Description

In this PR, we are enhancing KafkaEmitter, to emit metadata about published segments (SegmentMetadataEvent) into a Kafka topic. This segment metadata information that gets published into Kafka, can be used by any other downstream services to query Druid intelligently based on the segments published.

Old behavior of Kafka Emitter

Kafka Emitter always emits metrics and alerts and would emit requests if the config request.topic is configured.
Configs metric.topic and alert.topic are always mandatory and cannot be null.

Current behavior of Kafka Emitter [with backwards compatibility]

We introduced a new config named event.types which dictates the types of events we want the KafkaEmitter to emit. This config takes in a list of strings and can have one or more from [alerts, metrics, requests and segmentMetadata]. And based on this config, alert.topic, request.topic, metric.topic and segmentMetadata.topic should be configured and not left empty.
If no event.types is set, then by default, the kafka emitter would emit metrics and alerts. And in that case, to maintain backwards compatibility, decision to send out requests are based on if request.topic is empty or set.

Metadata format

The emitter by default would emit the metadata in json string format. If segment.metadata.format is set to protobuf, then the emitter emits it in protobuf format.

Testing Done

  • Added unit tests
  • Tested by running Druid and ingesting data.
  • Enabled compaction and verified the fields are appropriately set in the SegmentMetadataEvent class
  • Verified SegmentMetadataEvent is getting published in Kafka

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@harinirajendran harinirajendran requested review from a team as code owners August 29, 2022 19:20
@kkonstantine
Copy link
Member

@harinirajendran , fyi, if you open the PR as draft, it won't add the owners as reviewers after it's opened and will also provide a clear indication that this is a draft not ready to be merged yet.

@harinirajendran harinirajendran marked this pull request as draft August 30, 2022 16:30
@harinirajendran harinirajendran changed the title [DRAFT Do not review] Adding the new SegmentMetadataEvent and publishing these segment rela… Adding the new SegmentMetadataEvent and publishing these segment rela… Aug 30, 2022
@harinirajendran
Copy link
Author

@harinirajendran , fyi, if you open the PR as draft, it won't add the owners as reviewers after it's opened and will also provide a clear indication that this is a draft not ready to be merged yet.

Thanks @kkonstantine . I converted this to a Draft PR :)

@harinirajendran harinirajendran force-pushed the emitter branch 2 times, most recently from c27beb6 to 65afa3a Compare August 31, 2022 15:42
@harinirajendran harinirajendran changed the title Adding the new SegmentMetadataEvent and publishing these segment rela… ddd Aug 31, 2022
@harinirajendran harinirajendran changed the title ddd Adding SegmentMetadataEvent and publishing them via KafkaSegmentMetadataEmitter Aug 31, 2022
@harinirajendran harinirajendran changed the title Adding SegmentMetadataEvent and publishing them via KafkaSegmentMetadataEmitter OBSDATA-440 Adding SegmentMetadataEvent and publishing them via KafkaSegmentMetadataEmitter Aug 31, 2022
@harinirajendran harinirajendran marked this pull request as ready for review August 31, 2022 16:19
Copy link

@lqxshay lqxshay 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 PR. I did my first pass, would have to set up druid codebase also.

@harinirajendran harinirajendran requested a review from a team September 7, 2022 14:45
distribution/pom.xml Outdated Show resolved Hide resolved
Copy link
Author

@harinirajendran harinirajendran left a comment

Choose a reason for hiding this comment

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

I have addressed all other comments except this one in this update. Will add a different commit addressing this comment and re-request reviews at that point.

Copy link
Author

@harinirajendran harinirajendran left a comment

Choose a reason for hiding this comment

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

Updated the following

  1. Removed the -protobuf suffix when the segment metata format is not JSON.
  2. Fixed the double counting issue.

@harinirajendran harinirajendran requested a review from xvrl October 25, 2022 19:27
@harinirajendran harinirajendran requested a review from xvrl October 26, 2022 01:46
@harinirajendran harinirajendran requested a review from xvrl October 26, 2022 19:35
xvrl
xvrl previously approved these changes Oct 26, 2022
Copy link
Member

@xvrl xvrl left a comment

Choose a reason for hiding this comment

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

LGTM, added a note that we should do a follow-up to add tests for the eventTypes logic

@harinirajendran
Copy link
Author

Thanks, @xvrl for the review.

@harinirajendran harinirajendran changed the base branch from 24.0.0-confluent to major-druid-upgrade-confluent-rc2 October 26, 2022 19:56
@xvrl
Copy link
Member

xvrl commented Oct 26, 2022

before we merge this, we should make sure we enable tests for the target branch to ensure this passes all tests / validations

@kkonstantine kkonstantine force-pushed the major-druid-upgrade-confluent-rc2 branch from 10e598f to 25ee854 Compare October 27, 2022 02:16
@harinirajendran harinirajendran changed the base branch from major-druid-upgrade-confluent-rc2 to 24.0.0-confluent October 27, 2022 13:52
@harinirajendran harinirajendran dismissed xvrl’s stale review October 27, 2022 13:52

The base branch was changed.

@harinirajendran harinirajendran changed the base branch from 24.0.0-confluent to major-druid-upgrade-confluent-rc2 October 27, 2022 13:53
@harinirajendran harinirajendran changed the base branch from major-druid-upgrade-confluent-rc2 to 24.0.0-confluent October 27, 2022 13:54
@harinirajendran harinirajendran changed the base branch from 24.0.0-confluent to major-druid-upgrade-confluent-rc2 October 27, 2022 14:43
@harinirajendran harinirajendran changed the base branch from major-druid-upgrade-confluent-rc2 to 24.0.0-confluent October 27, 2022 14:44
@harinirajendran harinirajendran changed the base branch from 24.0.0-confluent to major-druid-upgrade-confluent-rc2 November 2, 2022 16:09
@harinirajendran harinirajendran changed the base branch from major-druid-upgrade-confluent-rc2 to 24.0.0-confluent November 2, 2022 16:10
@harinirajendran harinirajendran deleted the emitter branch July 12, 2023 17:30
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.

5 participants