-
Notifications
You must be signed in to change notification settings - Fork 23
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 OTEL (Open Telemetry) support #211
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.
Sweet 💯
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.
Awesome!! Lets goooooo!
@@ -51,7 +52,7 @@ type MockEmitter struct { | |||
sent []models.Event | |||
} | |||
|
|||
func (e *MockEmitter) Send(evt models.Event) error { | |||
func (e *MockEmitter) Send(_ context.Context, evt models.Event) 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.
Have we considered putting the mock definitions in a test package?
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.
Yea. We don't have a set rule for where to put mocks (or even to use a mocking library vs Mock structs).
infos, err := os.ReadDir(path) | ||
if err != nil { | ||
return -1 | ||
} | ||
|
||
_, span := telemetry.StartSpan(ctx, "odfi-delete-empty-dirs", trace.WithAttributes( |
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.
Why don't we keep the context here?
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.
There's no further calls to pass the context into. We just need the span to record timing information for how long the function takes.
@@ -123,7 +134,7 @@ func (dl *downloaderImpl) setup(agent upload.Agent) (*downloadedFiles, error) { | |||
}, nil | |||
} | |||
|
|||
func (dl *downloaderImpl) CopyFilesFromRemote(agent upload.Agent, shard *service.Shard) (*downloadedFiles, error) { | |||
func (dl *downloaderImpl) CopyFilesFromRemote(ctx context.Context, agent upload.Agent, shard *service.Shard) (*downloadedFiles, 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.
Is it possible to avoid passing the context around so much?
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.
Not really. Contexts are created for each request/message through the system and store arbitrary information like tracing info.
If we had some sort of *Request
struct the context could be in there and hidden a bit better.
Awesome addition! |
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #211 +/- ##
==========================================
+ Coverage 47.22% 48.65% +1.43%
==========================================
Files 87 87
Lines 3867 4020 +153
==========================================
+ Hits 1826 1956 +130
- Misses 1721 1743 +22
- Partials 320 321 +1
☔ View full report in Codecov by Sentry. |
No description provided.