feat: add configurable partition key for blob type dlq based on message timestamp#101
Merged
sumitaich1998 merged 4 commits intomainfrom Jan 23, 2026
Merged
Conversation
| return Paths.get(message.getTopic(), consumeDate); | ||
| DlqPartitionKeyType partitionKeyType = dlqConfig.getDlqBlobFilePartitionKey(); | ||
| if (partitionKeyType == DlqPartitionKeyType.PRODUCE_TIMESTAMP && message.getTimestamp() <= 0) { | ||
| firehoseInstrumentation.logInfo("DLQ partitioning fallback to consume timestamp for message topic: {}, partition: {}, offset: {}, timestamp: {}", |
Collaborator
There was a problem hiding this comment.
I think we should either add a metric that the produce timestamp is not good incase of the above mentioned condition. Or just log the timestamps for all the records, this is an extra if statement, which is not needed in my opinion.
| if (timestamp <= 0) { | ||
| timestamp = message.getConsumeTimestamp(); | ||
| } | ||
| } else { |
Collaborator
There was a problem hiding this comment.
Suggested change
| } else { | |
| public static String getDateFromMessage(Message message, ZoneId zoneId) { | |
| return getDateFromMessage( | |
| message, | |
| zoneId, | |
| DlqPartitionKeyType.CONSUME_TIMESTAMP | |
| ); | |
| } | |
| public static String getDateFromMessage( | |
| Message message, | |
| ZoneId zoneId, | |
| DlqPartitionKeyType partitionKeyType) { | |
| long timestamp = | |
| (partitionKeyType == DlqPartitionKeyType.PRODUCE_TIMESTAMP | |
| && message.getTimestamp() > 0) | |
| ? message.getTimestamp() | |
| : message.getConsumeTimestamp(); | |
| return Instant.ofEpochMilli(timestamp) | |
| .atZone(zoneId) | |
| .toLocalDate() | |
| .format(DateTimeFormatter.ISO_LOCAL_DATE); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have added a new feature to partition DLQ blob storage files based on the Kafka message produce timestamp. Earlier, it was only possible to partition based on the consume timestamp. Now, we introduced a new config DLQ_BLOB_FILE_PARTITION_KEY which allows you to choose between PRODUCE_TIMESTAMP and CONSUME_TIMESTAMP. The default is still CONSUME_TIMESTAMP. If you select PRODUCE_TIMESTAMP and the message timestamp is missing or zero, it will automatically fallback to use the consume timestamp. We also added logging to show which partition key is being used and when a fallback happens.