-
Notifications
You must be signed in to change notification settings - Fork 584
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 slog log bridge #5138
Comments
Recommended reading: https://github.com/golang/example/blob/master/slog-handler-guide/README.md And perhaps before that, I'd also recommend getting familiar with OpenTelemetry, if you aren't already: It might also help to understand what OpenTelemetry is by taking a look at the demo: |
I would like to start working over this to get the better and in depth understanding of open-telemetry/community#1865 Till now what I've understood is that too configure a logging handler for slog logging library in go. The flow goes like this
Am I on the correct path? |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
SIG meeting notes: plan is to add this bridge to contrib. |
I've added this to the scope of a few internships, such as LFX and Outreachy. Please, talk to me before working on this one. |
@jpkrohling I updated the description to make the issue more open for new contributors. However, we may want to start working on it sooner to be able to showcase it at KubeCon EU 2024. |
I think the LFX announcement happens today, and we'll start working on that right away. |
We are already starting working on it 🚀 |
@jba, we have an initial version of You can simply create a new GitHub issue with your feedback or even add some comments here. You can also review and add comments here: #5314 as this is the PR that introduced most of the implementation. |
Thanks for including me. I made a couple of performance-related comments on the PR, not really important. |
I am combing through the current version of the In
While in Did I overlook some API? |
The current log level is set here and cannot be set manually
It's designed to map the following opentelemetry-go-contrib/bridges/otelslog/handler.go Lines 19 to 25 in 00786cc
What's your use case that the above mapping doesn't work for you? |
@scorpionknifes The mapping is fine, my question was how to control the minimum log level. I usually disable the
|
There is a similar conversation about a different bridge, this should help: #6283 (comment) |
@Nikola-Milovic, PTAL at https://pkg.go.dev/go.opentelemetry.io/contrib/processors/minsev You can also make your own slog.Handler wrapper if you do not want to make the filtering on the SDK level. |
Add
slog.Handler
log bridgego.opentelemetry.io/contrib/bridges/sloghandler
) and its version as instrumentation scopeWithGroup
should result in nesting the attributes in a https://pkg.go.dev/go.opentelemetry.io/otel/log#Map so that it has similar behavior toslog.JSONHandler
. See: https://go.dev/play/p/bjJp7A-56bfAdditional resources:
slog.Handler
: https://github.com/golang/example/blob/master/slog-handler-guide/README.mdThe text was updated successfully, but these errors were encountered: