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

Support enhanced configuration of the Kafka source and buffer loggers #4126

Closed
1 of 2 tasks
dlvenable opened this issue Feb 14, 2024 · 0 comments · Fixed by #4663
Closed
1 of 2 tasks

Support enhanced configuration of the Kafka source and buffer loggers #4126

dlvenable opened this issue Feb 14, 2024 · 0 comments · Fixed by #4663
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@dlvenable
Copy link
Member

dlvenable commented Feb 14, 2024

Is your feature request related to a problem? Please describe.

The kafka buffer and kafka source share a significant number of classes. Many of these classes have their own loggers. And they also use org.apache.kafka classes and use those loggers.

I'd like to have more logging control over the Kafka components depending on whether the logger is used by the source or the buffer. This solution should also extend to the upcoming kafka sink.

Describe the solution you'd like

I'd like to have the Kafka plugins set an MDC context. This way, we can know the context for the different loggers.

try {
    MDC.put("kafkaPluginType", "buffer");
    // All existing work
} finally {
     MDC.remove("kafkaPluginType");
}

Describe alternatives you've considered (Optional)

One idea I had is to attempt to set MDC in Data Prepper core and then plugins can get MDC automatically. This could be a nice feature, but may take a significant amount of effort. I think we can start with this simple approach and then see how we'd like to make it evolve.

Another approach would be to have different loggers. This would likely require a base class and then sub-classes.

public abstract class KafkaCustomProducer<T> {
  protected abstract Logger getLogger();
}
public class KafkaBufferCustomProducer<T> {
  private static final Logger LOG = LoggerFactory.getLogger(KafkaBufferCustomProducer.class);
  protected Logger getLogger() {
    return LOG;
  }
}

This approach adds quite a bit of code complexity. And it will not allow control logging in the org.apache.kafka package.

Additional context

N/A

Tasks

  • Add MDC context for buffer plugin
  • Add MDC context for source plugin
@dlvenable dlvenable self-assigned this Feb 14, 2024
@dlvenable dlvenable added this to the v2.7 milestone Feb 14, 2024
@dlvenable dlvenable added enhancement New feature or request and removed untriaged labels Feb 14, 2024
@dlvenable dlvenable moved this from Unplanned to In progress in Data Prepper Tracking Board Feb 14, 2024
dlvenable added a commit to dlvenable/data-prepper that referenced this issue Feb 15, 2024
…a Buffer consumer threads with MDC. Name the consumer threads to help when tracking down thread dumps. First part of opensearch-project#4126

Signed-off-by: David Venable <[email protected]>
dlvenable added a commit that referenced this issue Feb 15, 2024
Uses logging MDC within the KafkaBuffer entry points. Create the Kafka Buffer consumer threads with MDC. Name the consumer threads to help when tracking down thread dumps. First part of #4126

Signed-off-by: David Venable <[email protected]>
@dlvenable dlvenable modified the milestones: v2.7, v2.8 Mar 12, 2024
@dlvenable dlvenable modified the milestones: v2.8, v2.9 May 16, 2024
dlvenable added a commit to dlvenable/data-prepper that referenced this issue Jun 25, 2024
…d names for Kafka source threads. Resolves opensearch-project#4126.

Signed-off-by: David Venable <[email protected]>
dlvenable added a commit that referenced this issue Jun 26, 2024
…d names for Kafka source threads. Resolves #4126. (#4663)

Signed-off-by: David Venable <[email protected]>
@github-project-automation github-project-automation bot moved this from In progress to Done in Data Prepper Tracking Board Jun 26, 2024
kkondaka pushed a commit to kkondaka/kk-data-prepper-f2 that referenced this issue Jul 23, 2024
…d names for Kafka source threads. Resolves opensearch-project#4126. (opensearch-project#4663)

Signed-off-by: David Venable <[email protected]>
Signed-off-by: Krishna Kondaka <[email protected]>
kkondaka pushed a commit to kkondaka/kk-data-prepper-f2 that referenced this issue Jul 23, 2024
…d names for Kafka source threads. Resolves opensearch-project#4126. (opensearch-project#4663)

Signed-off-by: David Venable <[email protected]>
Signed-off-by: Krishna Kondaka <[email protected]>
kkondaka pushed a commit to kkondaka/kk-data-prepper-f2 that referenced this issue Jul 30, 2024
…d names for Kafka source threads. Resolves opensearch-project#4126. (opensearch-project#4663)

Signed-off-by: David Venable <[email protected]>
Signed-off-by: Krishna Kondaka <[email protected]>
kkondaka pushed a commit to kkondaka/kk-data-prepper-f2 that referenced this issue Aug 8, 2024
…d names for Kafka source threads. Resolves opensearch-project#4126. (opensearch-project#4663)

Signed-off-by: David Venable <[email protected]>
Signed-off-by: Krishna Kondaka <[email protected]>
kkondaka pushed a commit to kkondaka/kk-data-prepper-f2 that referenced this issue Aug 12, 2024
…d names for Kafka source threads. Resolves opensearch-project#4126. (opensearch-project#4663)

Signed-off-by: David Venable <[email protected]>
Signed-off-by: Krishna Kondaka <[email protected]>
kkondaka pushed a commit to kkondaka/kk-data-prepper-f2 that referenced this issue Aug 14, 2024
…d names for Kafka source threads. Resolves opensearch-project#4126. (opensearch-project#4663)

Signed-off-by: David Venable <[email protected]>
Signed-off-by: Krishna Kondaka <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

1 participant