-
Notifications
You must be signed in to change notification settings - Fork 565
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
Logging bridge for logr #5357
base: main
Are you sure you want to change the base?
Logging bridge for logr #5357
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5357 +/- ##
=======================================
+ Coverage 65.3% 65.8% +0.4%
=======================================
Files 203 204 +1
Lines 12780 12962 +182
=======================================
+ Hits 8348 8529 +181
- Misses 4189 4190 +1
Partials 243 243
|
Co-authored-by: Damien Mathieu <[email protected]>
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 made a quick review.
bridges/otellogr/logsink.go
Outdated
// log sends a log record to the OpenTelemetry logger. | ||
func (l *LogSink) log(err error, msg string, serverity log.Severity, kvList ...any) { | ||
var record log.Record | ||
record.SetTimestamp(time.Now()) |
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.
record.SetTimestamp(time.Now()) |
As in #5918 (comment)
The API implementation will set the timestamp to time.Now()
already. So we can rely on that default.
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.
Maybe we should respect the following conventions https://pkg.go.dev/github.com/go-logr/logr#hdr-Key_Naming_Conventions?
"level": the log level
"logger": the name of the associated logger
"ts": the timestamp for a log line
Better as a separate PR.
ccbce1e
to
1f341c7
Compare
@scorpionknifes After chatting with @pellared we think it would be easier for us to review this PR if you split it into smaller ones, like we did for zap and zerolog. If you want an example, you can look at the various |
Changing this PR to draft per #5357 (comment). Use this PR as a reference for new PRs. |
@scorpionknifes, are you able to follow up with creating smaller PRs or can we use your PR to start creating them ourselves (we can still add you as code owner)? |
I apologize for being slow on this. I’ll look at it over the weekend. I’ll keep you posted! Thanks for your patience |
Towards #5192
Looking to do benchmarks in a different PR
Notes:
slog.Any
which is handled with fmt.Sprintf("%+v", v) by otelslog. This PR does not do the above and instead opts to useconvertValue
to get the convert based on type which maybe less performant 🤔convertValue
- follows how funcr handle interface{}convertValue
, is there a max depth for converted attributes?kvBuffer
- is used in otelslog, I propose to move kvBuffer to internal pkg and reused it here too?