-
Notifications
You must be signed in to change notification settings - Fork 441
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 franz-go #3113
base: main
Are you sure you want to change the base?
Add franz-go #3113
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution! I have left a few comments and questions. Let's also add some more tests in franz_test.go
for some more coverage. We'd like to test the functions you created in option.go
and franz.go
, especially the more complex functions like Produce()
or PollFetches()
.
|
||
func init() { | ||
telemetry.LoadIntegration(componentName) | ||
tracer.MarkIntegrationImported("github.com/twmb/franz-go") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also come with a matching line in ddtrace/tracer/option.go
so that it can be properly marked as imported.
carrier := NewRecordHeadersCarrier(r.Headers) | ||
if err := tracer.Inject(span.Context(), carrier); err != nil { | ||
// We still want to continue even if injection failed | ||
span.SetTag("error.msg", err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you would only like to save the error message, you can use ext.ErrorMsg
as the key. But why not use span.SetTag(ext.Error, err)
? Setting ext.Error
will also set ext.ErrorMsg
and other things. Using ext.Error
is also typically our preferred method as well.
} | ||
carrier := NewRecordHeadersCarrier(headers) | ||
|
||
// Test ForeachKey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For testing individual scenarios, use t.Run()
to separate them out. This will make it easier to pinpoint what is going wrong if one of them were to fail.
} = (*RecordHeadersCarrier)(nil) | ||
|
||
// ForeachKey iterates over every header. | ||
func (c RecordHeadersCarrier) ForeachKey(handler func(key, val string) error) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why ForeachKey
is called on RecordHeadersCarrier
instead of a pointer to it (*RecordHeadersCarrier
)?
2b7cb9e
to
b6d4ec6
Compare
What does this PR do?
Motivation
Reviewer's Checklist
v2-dev
branch and reviewed by @DataDog/apm-go.Unsure? Have a question? Request a review!