-
Notifications
You must be signed in to change notification settings - Fork 53
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: OpenTelemetry [DO NOT REVIEW] #3404
base: develop
Are you sure you want to change the base?
Conversation
internal/db/db.go
Outdated
@@ -39,7 +39,8 @@ import ( | |||
) | |||
|
|||
var ( | |||
log = corelog.NewLogger("db") | |||
log = corelog.NewLogger("db") | |||
tracer = otel.Tracer("github.com/sourcenetwork/defradb/internal/db") |
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.
thought: I think I agree with John's suggestion of extracting this out to a thin package so we can avoid scattering references throughout the code base to the same 3rd party package.
If we ever swap it out we'll probably still need to change the func signatures (I wouldn't put much thought into designing them), but at least everything will be in the same place, and it makes adding/standardising any middleware much easier.
internal/db/db.go
Outdated
@@ -212,6 +213,9 @@ func (db *DB) AddPolicy( | |||
ctx context.Context, | |||
policy string, | |||
) (client.AddPolicyResult, error) { | |||
ctx, span := tracer.Start(ctx, "AddPolicy") |
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.
suggestion: I do not know about performance/C-GO, but we can probably avoid having to manually specify "AddPolicy"
by using the runtime package and stuff like runtime.CallersFrames instead.
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.
I can look into that.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3404 +/- ##
===========================================
+ Coverage 78.11% 78.23% +0.12%
===========================================
Files 392 394 +2
Lines 36045 36209 +164
===========================================
+ Hits 28155 28326 +171
- Misses 6208 6218 +10
+ Partials 1682 1665 -17
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 16 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Relevant issue(s)
Resolves #293
Resolves #74
Description
This PR adds OpenTelemetry metrics and tracing.
Tasks
How has this been tested?
Manually testing with Jaeger
Specify the platform(s) on which this was tested: