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

Add OTEL (Open Telemetry) support #211

Merged
merged 4 commits into from
Nov 3, 2023
Merged

Add OTEL (Open Telemetry) support #211

merged 4 commits into from
Nov 3, 2023

Conversation

adamdecaf
Copy link
Member

No description provided.

Copy link

@nrbontha nrbontha left a comment

Choose a reason for hiding this comment

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

Sweet 💯

Copy link
Member

@InfernoJJ InfernoJJ left a 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 {

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?

Copy link
Member Author

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).

internal/incoming/odfi/corrections_test.go Outdated Show resolved Hide resolved
infos, err := os.ReadDir(path)
if err != nil {
return -1
}

_, span := telemetry.StartSpan(ctx, "odfi-delete-empty-dirs", trace.WithAttributes(

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?

Copy link
Member Author

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) {

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?

Copy link
Member Author

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.

@wadearnold
Copy link
Member

Awesome addition!

@codecov-commenter
Copy link

Codecov Report

Attention: 97 lines in your changes are missing coverage. Please review.

Comparison is base (ca87d7d) 47.22% compared to head (dd3fdfb) 48.65%.

❗ 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     
Files Coverage Δ
internal/audittrail/storage.go 100.00% <ø> (ø)
internal/audittrail/storage_blob.go 66.10% <100.00%> (+6.10%) ⬆️
internal/events/service_stream.go 23.07% <100.00%> (ø)
internal/events/service_webhook.go 61.53% <100.00%> (ø)
internal/incoming/odfi/audit.go 52.94% <100.00%> (ø)
internal/incoming/odfi/corrections.go 77.77% <100.00%> (+2.26%) ⬆️
internal/incoming/odfi/incoming.go 61.90% <100.00%> (+4.01%) ⬆️
internal/incoming/odfi/mock_processor.go 60.00% <100.00%> (ø)
internal/incoming/odfi/reconciliation.go 77.63% <100.00%> (+1.24%) ⬆️
internal/incoming/odfi/returns.go 77.35% <100.00%> (+1.84%) ⬆️
... and 21 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adamdecaf adamdecaf merged commit 77c8a30 into master Nov 3, 2023
7 checks passed
@adamdecaf adamdecaf deleted the add-otel-support branch November 3, 2023 19:49
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.

6 participants