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

Add Kafka sink DLQ for kafka to BQ template, kafka to gcs template #1570

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

AnandInguva
Copy link
Contributor

No description provided.

<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>3.7.0</version>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

todo: Check the latest version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove these file changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done now.

@AnandInguva
Copy link
Contributor Author

cc: @johnjcasey

@AnandInguva AnandInguva requested a review from Dippatel98 May 17, 2024 15:30
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
Copy link
Member

Choose a reason for hiding this comment

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

v2/common module shouldn't have a dependency on Kafka, it's supposed to provide only generic classes/utils. Kafka-related code should be placed under v2/kafka-common, which already has Kafka client deps.

/**
* {@link DeadLetterQueueOptions} is used for any Dead letter queue sinks for the failed records.
*/
public interface DeadLetterQueueOptions extends PipelineOptions {
Copy link
Member

Choose a reason for hiding this comment

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

If this Options class is expected to have only Kafka DLQ options, I'd call it KafkaDeadLetterQueueOptions.

@@ -58,6 +70,9 @@ public abstract class AvroWriteTransform
PCollection<KafkaRecord<byte[], byte[]>>, WriteFilesResult<AvroDestination>> {
private static final String subject = "UNUSED";
static final int DEFAULT_CACHE_CAPACITY = 1000;
Copy link
Member

Choose a reason for hiding this comment

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

Can be made private?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 257 to 259
private String schemaRegistryURL = null;
private String schemaPath = null;
private boolean useMock;
Copy link
Member

Choose a reason for hiding this comment

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

Seems like all 3 can be made final?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Getting error when changing this to final

@@ -62,7 +68,8 @@ public POutput expand(PCollection<KafkaRecord<byte[], byte[]>> kafkaRecord) {
.setSchemaRegistryURL(options().getSchemaRegistryURL())
.setSchemaPath(options().getSchemaPath())
.setWindowDuration(options().getWindowDuration())
.build());
.build()
.withBadRecordErrorHandlers(errorHandlers()));
Copy link
Member

Choose a reason for hiding this comment

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

Calling withX() after build() seems like a strange pattern to me. Should setErrorHandlers() be part of the builder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have only changed this(having setErrorHandlers) for the classes that have AutoValue annotations.

Copy link

codecov bot commented May 17, 2024

Codecov Report

Attention: Patch coverage is 0% with 235 lines in your changes are missing coverage. Please review.

Project coverage is 40.86%. Comparing base (80ad3ae) to head (bbdd4b7).
Report is 67 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1570      +/-   ##
============================================
- Coverage     43.54%   40.86%   -2.68%     
- Complexity      654     2829    +2175     
============================================
  Files           294      745     +451     
  Lines         15542    43127   +27585     
  Branches       1548     4595    +3047     
============================================
+ Hits           6768    17626   +10858     
- Misses         8255    24002   +15747     
- Partials        519     1499     +980     
Components Coverage Δ
spanner-templates 60.04% <100.00%> (+4.31%) ⬆️
spanner-import-export 65.59% <ø> (∅)
spanner-live-forward-migration 73.64% <ø> (ø)
spanner-live-reverse-replication 48.66% <ø> (+0.11%) ⬆️
spanner-bulk-migration 78.07% <100.00%> (ø)
Files Coverage Δ
...e/cloud/teleport/v2/transforms/WriteTransform.java 0.00% <0.00%> (ø)
...leport/v2/kafka/dlq/KafkaDeadLetterQueueUtils.java 0.00% <0.00%> (ø)
...ud/teleport/v2/kafka/dlq/KafkaDeadLetterQueue.java 0.00% <0.00%> (ø)
...le/cloud/teleport/v2/templates/KafkaToGcsFlex.java 0.00% <0.00%> (ø)
...oud/teleport/v2/templates/KafkaToBigQueryFlex.java 0.00% <0.00%> (ø)
...oud/teleport/v2/transforms/AvroWriteTransform.java 0.00% <0.00%> (ø)
...d/teleport/v2/transforms/AvroDynamicTransform.java 0.00% <0.00%> (ø)
...le/cloud/teleport/v2/transforms/AvroTransform.java 0.00% <0.00%> (ø)

... and 460 files with indirect coverage changes

@AnandInguva AnandInguva requested a review from an2x May 19, 2024 15:24
an2x
an2x previously approved these changes May 21, 2024
@AnandInguva AnandInguva self-assigned this May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants