Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ logger.Info("service started")
Upgrading from `log` v1.4.x or earlier, where `otel` was part of the root module, raise both together:

```sh
go get github.com/jgolang/log@v1.7.4 github.com/jgolang/log/otel@v1.8.0
go get github.com/jgolang/log@v1.7.5 github.com/jgolang/log/otel@v1.8.1
```

Raising only `log` makes Go report that no required module provides `github.com/jgolang/log/otel`; `log/otel` v1.5.0 and later require `log` v1.5.0 or later, so adding it raises `log` too. New users run `go get github.com/jgolang/log@v1.7.4 github.com/jgolang/log/otel@v1.8.0`. `SetHandlerWrapper` and `WithHandlerWrapper`, used below, need `log` v1.6.0.
Raising only `log` makes Go report that no required module provides `github.com/jgolang/log/otel`; `log/otel` v1.5.0 and later require `log` v1.5.0 or later, so adding it raises `log` too. New users run `go get github.com/jgolang/log@v1.7.5 github.com/jgolang/log/otel@v1.8.1`. `SetHandlerWrapper` and `WithHandlerWrapper`, used below, need `log` v1.6.0.

Wrap the logger's handler with `otel.NewOtelHandler` so records logged with a context carry its `trace_id` and `span_id` and are added to the span as events:

Expand Down
7 changes: 2 additions & 5 deletions otel/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ module github.com/jgolang/log/otel
go 1.26.2

require (
github.com/jgolang/log v1.7.1
github.com/jgolang/log v1.7.5
go.opentelemetry.io/otel v1.28.0
go.opentelemetry.io/otel/trace v1.28.0
)

require (
github.com/go-errors/errors v1.5.1 // indirect
github.com/jgolang/errors v0.6.1 // indirect
)
require github.com/jgolang/errors v0.8.0 // indirect
10 changes: 4 additions & 6 deletions otel/go.sum
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk=
github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/jgolang/errors v0.6.1 h1:D8LRvoIj2w4vrRo7cY0t4OuL0xrMxcioSMeYmgoTxLc=
github.com/jgolang/errors v0.6.1/go.mod h1:7jzxJ5Ox468U7Jk0R+JWI3sfPfLGSwPOie7ISDYlVhY=
github.com/jgolang/log v1.7.1 h1:uXl+LJsIdT6VyfkqpAcHXnFnX6tkQjmw3mstAapQFuw=
github.com/jgolang/log v1.7.1/go.mod h1:bZgWMYRyX1aKU2HcsO8QWW4aAGVde6GVaKHN8OL38SM=
github.com/jgolang/errors v0.8.0 h1:7VGykxmM5ARsoGNV6v+w0hqSUmTojZ302/RVybDgxSQ=
github.com/jgolang/errors v0.8.0/go.mod h1:JjsTZeVVZMBDhzQ/13gpKoOCnpZNXrmiPZV4etIL2n8=
github.com/jgolang/log v1.7.5 h1:WTRFsLRQIzwy7bUkgXBD1PspBcpmyPryg1FWXvzh2j8=
github.com/jgolang/log v1.7.5/go.mod h1:CR4Jc7i3bRVdMlYp0b5jAL5V8My3d54U2IBHK+oxDZk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
Expand Down
2 changes: 1 addition & 1 deletion otel/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// do not depend on OpenTelemetry; it has been since log v1.5.0. Upgrading from
// log v1.4.x or earlier, raise both modules together:
//
// go get github.com/jgolang/log@v1.6.0 github.com/jgolang/log/otel@v1.6.0
// go get github.com/jgolang/log@latest github.com/jgolang/log/otel@latest
//
// Attach the handler to a jgolang logger with log.SetHandlerWrapper or the
// log.WithHandlerWrapper option (log v1.6.0 or later):
Expand Down
Loading