diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f3818a79bc..1c5d1a37850 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `go.opentelemetry.io/contrib/config` package supports configuring `with_resource_constant_labels` for the prometheus exporter. (#5890) - Add new runtime metrics to `go.opentelemetry.io/contrib/instrumentation/runtime`, which are still disabled by default. (#5870) - 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) ### Removed diff --git a/bridges/otelzerolog/hook.go b/bridges/otelzerolog/hook.go index 5f8327f1f01..f9b2b5cb2c4 100644 --- a/bridges/otelzerolog/hook.go +++ b/bridges/otelzerolog/hook.go @@ -3,6 +3,27 @@ // Package otelzerolog provides a [Hook], a [zerolog.Hook] implementation that // can be used to bridge between the [zerolog] API and [OpenTelemetry]. +// +// # Record Conversion +// +// The [zerolog.Event] records are converted to OpenTelemetry [log.Record] in +// the following way: +// +// - Message is set as the Body using a [log.StringValue]. +// - Level is transformed and set as the Severity. The SeverityText is also +// set. +// +// The Level is transformed to the OpenTelemetry Severity types in the following way. +// +// - [zerolog.DebugLevel] is transformed to [log.SeverityDebug] +// - [zerolog.InfoLevel] is transformed to [log.SeverityInfo] +// - [zerolog.WarnLevel] is transformed to [log.SeverityWarn] +// - [zerolog.ErrorLevel] is transformed to [log.SeverityError] +// - [zerolog.PanicLevel] is transformed to [log.SeverityFatal1] +// - [zerolog.FatalLevel] is transformed to [log.SeverityFatal2] +// +// NOTE: Fields are not transformed because of https://github.com/rs/zerolog/issues/493. +// // [OpenTelemetry]: https://opentelemetry.io/docs/concepts/signals/logs/ package otelzerolog // import "go.opentelemetry.io/contrib/bridges/otelzerolog" diff --git a/versions.yaml b/versions.yaml index a66ee6e247c..0013dc4fa17 100644 --- a/versions.yaml +++ b/versions.yaml @@ -89,7 +89,6 @@ module-sets: modules: - go.opentelemetry.io/contrib/detectors/azure/azurevm excluded-modules: - - go.opentelemetry.io/contrib/bridges/otelzerolog - go.opentelemetry.io/contrib/instrgen - go.opentelemetry.io/contrib/instrgen/driver - go.opentelemetry.io/contrib/instrgen/testdata/interface