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

feat: kq commitinorder support trace #75

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

zhuud
Copy link

@zhuud zhuud commented Aug 27, 2024

Greptile Summary

Added OpenTelemetry tracing support to Kafka queue implementation, enabling distributed tracing across message processing with standardized context propagation.

  • Added kq/internal/trace.go implementing MessageCarrier interface for OpenTelemetry context handling
  • Added trace context injection in PushWithKey method using OpenTelemetry propagator
  • Added trace context extraction in extractCtxFromMsg function for consistent tracing
  • Enhanced error handling with context-aware logging in consumeOne method
  • Updated dependencies in go.mod to support OpenTelemetry integration

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Added tracing support to the CommitInOrder functionality in the Kafka queue implementation, enhancing message processing traceability.

  • Introduced extractCtxFromMsg function to consistently extract context from Kafka messages
  • Applied extractCtxFromMsg in both CommitInOrder and regular consumer cases
  • Improved traceability of message processing in the queue system
  • Ensured consistent context extraction across different consumption modes

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

if err := q.consumeOne(context.Background(), string(msg.Key), string(msg.Value)); err != nil {
ctx := extractCtxFromMsg(msg)

if err := q.consumeOne(ctx, string(msg.Key), string(msg.Value)); err != nil {
if q.errorHandler != nil {
q.errorHandler(context.Background(), msg, err)
Copy link

Choose a reason for hiding this comment

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

logic: using context.Background() here loses trace context - should use ctx instead

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

LGTM

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +213 to +217
defer func() {
if err := recover(); err != nil {
logc.Errorf(ctx, "consumeOne failed recover, error: %v", err)
}
}()
Copy link

Choose a reason for hiding this comment

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

style: recover handler should re-panic on system errors like out of memory that shouldn't be caught

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

go.mod Outdated
@@ -1,4 +1,4 @@
module github.com/zeromicro/go-queue
module github.com/zhuud/go-queue
Copy link

Choose a reason for hiding this comment

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

logic: Module path should remain 'github.com/zeromicro/go-queue' as this is a PR to the original repository. This change would break all existing imports.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

LGTM

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

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.

1 participant