This PR contains the following updates: | Package | Change | Age | Confidence | |---|---|---|---| | [dev.gaijin.team/go/golib](https://redirect.github.com/GaijinEntertainment/golib) | `v0.7.0` -> `v0.8.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>GaijinEntertainment/golib (dev.gaijin.team/go/golib)</summary> ### [`v0.8.0`](https://redirect.github.com/GaijinEntertainment/golib/releases/tag/v0.8.0) [Compare Source](https://redirect.github.com/GaijinEntertainment/golib/compare/v0.7.0...v0.8.0) **Major release with breaking changes to logger and stacktrace packages. Please review the Breaking Changes section carefully before upgrading.** This release focuses on improving the logger and stacktrace packages with better caller capture, thread safety, and a simplified adapter interface. *** ##### ⚠️ Breaking Changes - **Change `logger.New()` constructor signature** ([`a818939`](https://redirect.github.com/GaijinEntertainment/golib/commit/a818939), [`dbbf7a2`](https://redirect.github.com/GaijinEntertainment/golib/commit/dbbf7a2), [`ef40e6a`](https://redirect.github.com/GaijinEntertainment/golib/commit/ef40e6a)) Constructor changed from `New(adapter Adapter, maxLevel int)` to `New(adapter Adapter, opts ...Option)`. The `maxLevel` parameter is now passed via `WithLevel(level)` option. - **Rework `logger.Adapter` interface** ([`3e99e98`](https://redirect.github.com/GaijinEntertainment/golib/commit/3e99e98)) The Adapter interface has been simplified. Logger name and stacktrace functionality is now handled by the logger itself, with these values passed as fields. - **Remove `NopAdapter` and change nil adapter handling** ([`ac007a8`](https://redirect.github.com/GaijinEntertainment/golib/commit/ac007a8)) `NopAdapter` has been removed. All loggers with nil adapter are now treated as no-op loggers. No-op loggers can only be created with `logger.NewNop()`. `logger.New()` now panics if it receives a nil adapter. - **Change logger name and error passthrough mechanism** ([`dbbf7a2`](https://redirect.github.com/GaijinEntertainment/golib/commit/dbbf7a2)) Logger name and error are now passed to adapters as fields rather than handled in a special way. - **Rework `stacktrace` package API** ([`7d77230`](https://redirect.github.com/GaijinEntertainment/golib/commit/7d77230), [`e4d4715`](https://redirect.github.com/GaijinEntertainment/golib/commit/e4d4715)) `stacktrace.Capture()` renamed to `stacktrace.CaptureStack()`. `Stack` type is now read-only; modification methods have been removed. *** ##### Added - **New logger configuration options** ([`a818939`](https://redirect.github.com/GaijinEntertainment/golib/commit/a818939), [`dbbf7a2`](https://redirect.github.com/GaijinEntertainment/golib/commit/dbbf7a2), [`ef40e6a`](https://redirect.github.com/GaijinEntertainment/golib/commit/ef40e6a)) Added multiple new options for configuring logger behavior: - `WithLevel(level int)` - Set maximum log level - `WithCallerAtLevel(level int)` - Enable automatic caller capture at or below specified level - `WithCallerMapper(fn)` - Custom caller frame mapping with `DefaultCallerMapper` provided - `WithNameMapper(fn)` - Custom logger name field mapping - `WithNameFormatter(fn)` - Custom logger name formatting (hierarchical with `:` or replacement strategies) - `WithErrorMapper(fn)` - Custom error field mapping - `WithStackTraceMapper(fn)` - Custom stacktrace field mapping - **New `stacktrace.CaptureCaller()` function** ([`e4d4715`](https://redirect.github.com/GaijinEntertainment/golib/commit/e4d4715)) Captures a single stack frame with specified skip. More performant for cases when only the caller's frame is required. - **New `stacktrace.Frame` type** ([`6b86721`](https://redirect.github.com/GaijinEntertainment/golib/commit/6b86721)) Represents a single stack frame containing program counter, file path, line number, and function name. Simplified representation of `runtime.Frame` that is safe to store and use after stack trace capture. - **Logger comparison method** ([`ef40e6a`](https://redirect.github.com/GaijinEntertainment/golib/commit/ef40e6a)) New `logger.IsEqual()` method for comparing if two loggers are functionally the same. - **Thread-safe buffer adapter improvements** ([`bb3745f`](https://redirect.github.com/GaijinEntertainment/golib/commit/bb3745f)) `bufferadapter.LogEntries` type is now thread-safe. New `bufferadapter.NewWithBuffer()` method allows usage of pre-existing buffer. - **Stacktrace capture support** ([`dbbf7a2`](https://redirect.github.com/GaijinEntertainment/golib/commit/dbbf7a2)) Full stacktrace capture functionality integrated into logger package. *** ##### Changed - **Finalize logger documentation** ([`dbbf7a2`](https://redirect.github.com/GaijinEntertainment/golib/commit/dbbf7a2)) Comprehensive documentation added to the logger package. - **Improve adapter documentation** ([`3e99e98`](https://redirect.github.com/GaijinEntertainment/golib/commit/3e99e98)) Added detailed package documentation for `logrusadapter`, `slogadapter`, and `zapadapter`. - **Simplify `bufferadapter.New()`** ([`bb3745f`](https://redirect.github.com/GaijinEntertainment/golib/commit/bb3745f)) Now creates and returns both adapter and buffer together for convenience. - **Upgrade golangci-lint configuration** ([`17f1b9c`](https://redirect.github.com/GaijinEntertainment/golib/commit/17f1b9c)) Updated linter config to support golangci-lint v2.6 and fixed all lint issues. *** ##### Fixed - **Fix logger name carrying with multiple children** ([`ef40e6a`](https://redirect.github.com/GaijinEntertainment/golib/commit/ef40e6a)) Previously, when multiple child loggers changed names, it would result in multiple fields with the same name. The new approach allows for logger name rewrites and custom logger name generation strategies. *** #### Upgrade Guide ##### For Logger Users: **1. Updating logger.New() calls:** ```go // Before (v0.7.0) logger := logger.New(adapter, logger.LevelDebug) // After (v0.8.0) logger := logger.New(adapter, logger.WithLevel(logger.LevelDebug)) // Or use default level (LevelInfo) with no options logger := logger.New(adapter) ``` **2. Creating no-op loggers:** ```go // Before logger := logger.New(logger.NopAdapter{}, someLevel) // After logger := logger.NewNop() ``` **3. Calling stacktrace functions:** ```go // Before stack := stacktrace.Capture(skip) // After stack := stacktrace.CaptureStack(skip) // Or for single frame: frame := stacktrace.CaptureCaller(skip) ``` **4. Modifying Stack instances:** Remove any code that modifies Stack - it's now read-only. Capture the stack with the correct skip value instead. ##### For Adapter Implementers: The `Adapter` interface has been simplified. Logger name and stacktrace functionality is now handled by the logger itself, with these values passed as fields. Review the updated documentation in `logrusadapter`, `slogadapter`, and `zapadapter` packages for examples of the new implementation pattern. *** #### Contributors - a.zinoviev <a.zinoviev@gaijin.team> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/open-telemetry/opentelemetry-go). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4xNi4xIiwidXBkYXRlZEluVmVyIjoiNDIuMTYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiU2tpcCBDaGFuZ2Vsb2ciLCJkZXBlbmRlbmNpZXMiXX0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
OpenTelemetry-Go
OpenTelemetry-Go is the Go implementation of OpenTelemetry. It provides a set of APIs to directly measure performance and behavior of your software and send this data to observability platforms.
Project Status
| Signal | Status |
|---|---|
| Traces | Stable |
| Metrics | Stable |
| Logs | Beta1 |
Progress and status specific to this repository is tracked in our project boards and milestones.
Project versioning information and stability guarantees can be found in the versioning documentation.
Compatibility
OpenTelemetry-Go ensures compatibility with the current supported versions of the Go language:
Each major Go release is supported until there are two newer major releases. For example, Go 1.5 was supported until the Go 1.7 release, and Go 1.6 was supported until the Go 1.8 release.
For versions of Go that are no longer supported upstream, opentelemetry-go will stop ensuring compatibility with these versions in the following manner:
- A minor release of opentelemetry-go will be made to add support for the new supported release of Go.
- The following minor release of opentelemetry-go will remove compatibility testing for the oldest (now archived upstream) version of Go. This, and future, releases of opentelemetry-go may include features only supported by the currently supported versions of Go.
Currently, this project supports the following environments.
| OS | Go Version | Architecture |
|---|---|---|
| Ubuntu | 1.25 | amd64 |
| Ubuntu | 1.24 | amd64 |
| Ubuntu | 1.25 | 386 |
| Ubuntu | 1.24 | 386 |
| Ubuntu | 1.25 | arm64 |
| Ubuntu | 1.24 | arm64 |
| macOS | 1.25 | amd64 |
| macOS | 1.24 | amd64 |
| macOS | 1.25 | arm64 |
| macOS | 1.24 | arm64 |
| Windows | 1.25 | amd64 |
| Windows | 1.24 | amd64 |
| Windows | 1.25 | 386 |
| Windows | 1.24 | 386 |
While this project should work for other systems, no compatibility guarantees are made for those systems currently.
Getting Started
You can find a getting started guide on opentelemetry.io.
OpenTelemetry's goal is to provide a single set of APIs to capture distributed traces and metrics from your application and send them to an observability platform. This project allows you to do just that for applications written in Go. There are two steps to this process: instrument your application, and configure an exporter.
Instrumentation
To start capturing distributed traces and metric events from your application it first needs to be instrumented. The easiest way to do this is by using an instrumentation library for your code. Be sure to check out the officially supported instrumentation libraries.
If you need to extend the telemetry an instrumentation library provides or want to build your own instrumentation for your application directly you will need to use the Go otel package. The examples are a good way to see some practical uses of this process.
Export
Now that your application is instrumented to collect telemetry, it needs an export pipeline to send that telemetry to an observability platform.
All officially supported exporters for the OpenTelemetry project are contained in the exporters directory.
| Exporter | Logs | Metrics | Traces |
|---|---|---|---|
| OTLP | ✓ | ✓ | ✓ |
| Prometheus | ✓ | ||
| stdout | ✓ | ✓ | ✓ |
| Zipkin | ✓ |
Contributing
See the contributing documentation.