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 zap log bridge #5191

Closed
pellared opened this issue Mar 1, 2024 · 3 comments · Fixed by open-telemetry/opentelemetry.io#4845
Closed

Add zap log bridge #5191

pellared opened this issue Mar 1, 2024 · 3 comments · Fixed by open-telemetry/opentelemetry.io#4845
Labels
enhancement New feature or request

Comments

@pellared
Copy link
Member

pellared commented Mar 1, 2024

Add zapcore.Core log bridge.

@pellared
Copy link
Member Author

@khushijain21 is working on it.

@khushijain21
Copy link
Contributor

khushijain21 commented May 7, 2024

Outline of the approach

  • Skeleteon of zapcore and config for the bridge
  • Implement Enabled, Check method
  • Implement zapcore encoder
  • Implement With and Write method
  • Add Benchmarks

@pellared
Copy link
Member Author

pellared commented May 7, 2024

  1. We do not need to implement zapcore.Encoder as we are providing a zapcore.Core
  2. You can first implement Write and then With method as separate PRs
  3. You can handle https://pkg.go.dev/go.uber.org/zap/zapcore#NamespaceType as a separate PR
  4. You can handle trace correlation (handling context.Context) as a separate PR
  5. After benchmarks are in place we can add performance improvements. I suggests adding usage of sync.Pool and other improvements after benchmarks are in place and we have required functionality in place.
  6. Go doc comment should be updated after the implementation is done.
  7. A testable example should be added demonstrating how to setup otelzap.
  8. After the release the Go module should be added to https://opentelemetry.io/ecosystem/registry
  9. After the release we could document the bridge also in https://opentelemetry.io/docs/languages/go/

pellared pushed a commit that referenced this issue May 17, 2024
Part of #5191
---------
Co-authored-by: Robert Pająk <[email protected]>
pellared pushed a commit that referenced this issue May 17, 2024
Part of #5191
---------
Co-authored-by: Robert Pająk <[email protected]>
MrAlias added a commit that referenced this issue May 18, 2024
Part of
#5191
and #5586

Pre-work
#5279

---------

Co-authored-by: Tyler Yahn <[email protected]>
pellared added a commit that referenced this issue May 20, 2024
Part of #5191

---------

Co-authored-by: Robert Pająk <[email protected]>
zailic pushed a commit to zailic/opentelemetry-go-contrib that referenced this issue May 20, 2024
zailic pushed a commit to zailic/opentelemetry-go-contrib that referenced this issue May 20, 2024
zailic pushed a commit to zailic/opentelemetry-go-contrib that referenced this issue May 20, 2024
zailic pushed a commit to zailic/opentelemetry-go-contrib that referenced this issue May 20, 2024
pellared added a commit that referenced this issue May 21, 2024
Part of
#5191

Pre-work
#5279

This PR implements `uInt` methods `objectEncoder`

---------

Co-authored-by: Robert Pająk <[email protected]>
pellared pushed a commit that referenced this issue May 21, 2024
Part of
#5191

Pre-work
#5279

This PR adds skeleton for arrayEncoder
khushijain21 added a commit to khushijain21/opentelemetry-go-contrib that referenced this issue May 22, 2024
Part of
open-telemetry#5191

Pre-work
open-telemetry#5279

This PR implements `uInt` methods `objectEncoder`

---------

Co-authored-by: Robert Pająk <[email protected]>
thomasgouveia added a commit to thomasgouveia/opentelemetry-go-contrib that referenced this issue Jun 26, 2024
This commit adds a simple example to demonstrate how to use the OpenTelemetry Zap bridge to send logs emitted by Zap to an OTEL endpoint.

Signed-off-by: thomasgouveia <[email protected]>
thomasgouveia added a commit to thomasgouveia/opentelemetry-go-contrib that referenced this issue Jun 26, 2024
This commit adds a simple example to demonstrate how to use the OpenTelemetry Zap bridge to send logs emitted by Zap to an OTEL endpoint.

Signed-off-by: thomasgouveia <[email protected]>
thomasgouveia added a commit to thomasgouveia/opentelemetry-go-contrib that referenced this issue Jun 26, 2024
This commit adds a simple example to demonstrate how to use the OpenTelemetry Zap bridge to send logs emitted by Zap to an OTEL endpoint.

Signed-off-by: thomasgouveia <[email protected]>
thomasgouveia added a commit to thomasgouveia/opentelemetry-go-contrib that referenced this issue Jun 26, 2024
pellared added a commit that referenced this issue Jun 26, 2024
Part of #5191

Pre-work #5279

```
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/contrib/bridges/otelzap
cpu: 12th Gen Intel(R) Core(TM) i5-1245U
BenchmarkCoreWrite/10_fields-12         	 1000000	      1116 ns/op	     978 B/op	      13 allocs/op
BenchmarkCoreWrite/20_fields-12         	  407290	      2615 ns/op	    2180 B/op	      22 allocs/op
BenchmarkCoreWrite/Namespace-12         	  725268	      1671 ns/op	    1760 B/op	      16 allocs/op
BenchmarkCoreWrite/With10_fields-12     	 4964038	       260.2 ns/op	     208 B/op	       1 allocs/op
BenchmarkCoreWrite/With20_fields-12     	 2004085	       628.7 ns/op	     640 B/op	       1 allocs/op
BenchmarkCoreWrite/WithNamespace-12     	100000000	        16.95 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	go.opentelemetry.io/contrib/bridges/otelzap	8.619s
```

---------

Co-authored-by: Robert Pająk <[email protected]>
thomasgouveia added a commit to thomasgouveia/opentelemetry-go-contrib that referenced this issue Jun 26, 2024
thomasgouveia added a commit to thomasgouveia/opentelemetry-go-contrib that referenced this issue Jun 26, 2024
thomasgouveia added a commit to thomasgouveia/opentelemetry-go-contrib that referenced this issue Jun 26, 2024
This commit adds a simple example to demonstrate how to use the OpenTelemetry Zap bridge to send logs emitted by Zap to an OTEL endpoint.

Signed-off-by: thomasgouveia <[email protected]>
thomasgouveia added a commit to thomasgouveia/opentelemetry-go-contrib that referenced this issue Jun 26, 2024
thomasgouveia added a commit to thomasgouveia/opentelemetry-go-contrib that referenced this issue Jun 26, 2024
This commit adds a simple example to demonstrate how to use the OpenTelemetry Zap bridge to send logs emitted by Zap to an OTEL endpoint.

Signed-off-by: thomasgouveia <[email protected]>
thomasgouveia added a commit to thomasgouveia/opentelemetry-go-contrib that referenced this issue Jun 26, 2024
thomasgouveia added a commit to thomasgouveia/opentelemetry-go-contrib that referenced this issue Jun 27, 2024
This commit adds a simple example to demonstrate how to use the OpenTelemetry Zap bridge to send logs emitted by Zap to an OTEL endpoint.

Signed-off-by: thomasgouveia <[email protected]>
thomasgouveia added a commit to thomasgouveia/opentelemetry-go-contrib that referenced this issue Jun 27, 2024
thomasgouveia added a commit to thomasgouveia/opentelemetry-go-contrib that referenced this issue Jun 27, 2024
This commit adds a simple example to demonstrate how to use the OpenTelemetry Zap bridge to send logs emitted by Zap to an OTEL endpoint.

Signed-off-by: thomasgouveia <[email protected]>
thomasgouveia added a commit to thomasgouveia/opentelemetry-go-contrib that referenced this issue Jun 27, 2024
pellared pushed a commit that referenced this issue Jul 12, 2024
pellared added a commit that referenced this issue Jul 12, 2024
Part of #5191

Pre-work #5279

---------

Co-authored-by: Robert Pająk <[email protected]>
dmathieu added a commit that referenced this issue Jul 15, 2024
Completes #5191 

Can we also request for a review from zap maintainers?

---------

Co-authored-by: Damien Mathieu <[email protected]>
luca-filipponi pushed a commit to luca-filipponi/opentelemetry-go-contrib that referenced this issue Aug 9, 2024
Completes open-telemetry#5191

Can we also request for a review from zap maintainers?

---------

Co-authored-by: Damien Mathieu <[email protected]>
luca-filipponi pushed a commit to luca-filipponi/opentelemetry-go-contrib that referenced this issue Aug 9, 2024
Completes open-telemetry#5191

Can we also request for a review from zap maintainers?

---------

Co-authored-by: Damien Mathieu <[email protected]>
luca-filipponi pushed a commit to luca-filipponi/opentelemetry-go-contrib that referenced this issue Aug 9, 2024
Completes open-telemetry#5191

Can we also request for a review from zap maintainers?

---------

Co-authored-by: Damien Mathieu <[email protected]>
luca-filipponi pushed a commit to luca-filipponi/opentelemetry-go-contrib that referenced this issue Aug 9, 2024
Completes open-telemetry#5191

Can we also request for a review from zap maintainers?

---------

Co-authored-by: Damien Mathieu <[email protected]>
MrAlias added a commit that referenced this issue Aug 23, 2024
This release is the last to support [Go 1.21]. The next release will
require at least [Go 1.22].

### Added

- Add the `WithSpanAttributes` and `WithMetricAttributes` methods to set
custom attributes to the stats handler in
`go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc`.
(#5133)
- The `go.opentelemetry.io/contrib/bridges/otelzap` module. This module
provides an OpenTelemetry logging bridge for `go.uber.org/zap`. (#5191)
- Support for the `OTEL_HTTP_CLIENT_COMPATIBILITY_MODE=http/dup`
environment variable in
`go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp` to emit
attributes for both the v1.20.0 and v1.26.0 semantic conventions.
(#5401)
- The `go.opentelemetry.io/contrib/bridges/otelzerolog` module. This
module provides an OpenTelemetry logging bridge for
`github.com/rs/zerolog`. (#5405)
- Add `WithGinFilter` filter parameter in
`go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin`
to allow filtering requests with `*gin.Context`. (#5743)
- Support for stdoutlog exporter in
`go.opentelemetry.io/contrib/config`. (#5850)
- Add macOS ARM64 platform to the compatibility testing suite. (#5868)
- Add new runtime metrics to
`go.opentelemetry.io/contrib/instrumentation/runtime`, which are still
disabled by default. (#5870)
- Add the `WithMetricsAttributesFn` option to allow setting dynamic,
per-request metric attributes in
`go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp`. (#5876)
- The `go.opentelemetry.io/contrib/config` package supports configuring
`with_resource_constant_labels` for the prometheus exporter. (#5890)
- Support [Go 1.23]. (#6017)

### Removed

- The deprecated `go.opentelemetry.io/contrib/processors/baggagecopy`
package is removed. (#5853)

### Fixed

- Race condition when reading the HTTP body and writing the response in
`go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp`. (#5916)

[Go 1.23]: https://go.dev/doc/go1.23
[Go 1.22]: https://go.dev/doc/go1.22
[Go 1.21]: https://go.dev/doc/go1.21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants