diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bb099fe..31070523 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog ## [Unreleased] +### Changed +- Format New Relic and OpenTelemetry metadata values that implement the `fmt.Stringer` interface as strings. + +## [3.30.0] - 2025-09-17 ### Added - Add [IMGPROXY_GRACEFUL_STOP_TIMEOUT](https://docs.imgproxy.net/latest/configuration/options#IMGPROXY_GRACEFUL_STOP_TIMEOUT) config. - (pro) Add [color_profile](https://docs.imgproxy.net/latest/usage/processing#color-profile) processing option and [IMGPROXY_COLOR_PROFILES_DIR](https://docs.imgproxy.net/latest/configuration/options#IMGPROXY_COLOR_PROFILES_DIR) config. diff --git a/monitoring/newrelic/newrelic.go b/monitoring/newrelic/newrelic.go index cb717df9..61a80e89 100644 --- a/monitoring/newrelic/newrelic.go +++ b/monitoring/newrelic/newrelic.go @@ -146,6 +146,11 @@ func setMetadata(span attributable, key string, value interface{}) { return } + if stringer, ok := value.(fmt.Stringer); ok { + span.AddAttribute(key, stringer.String()) + return + } + rv := reflect.ValueOf(value) switch { case rv.Kind() == reflect.String || rv.Kind() == reflect.Bool: diff --git a/monitoring/otel/otel.go b/monitoring/otel/otel.go index f596e2fa..ac02de09 100644 --- a/monitoring/otel/otel.go +++ b/monitoring/otel/otel.go @@ -431,6 +431,11 @@ func setMetadata(span trace.Span, key string, value interface{}) { return } + if stringer, ok := value.(fmt.Stringer); ok { + span.SetAttributes(attribute.String(key, stringer.String())) + return + } + rv := reflect.ValueOf(value) switch { diff --git a/version/version.go b/version/version.go index deb7d144..fda2529d 100644 --- a/version/version.go +++ b/version/version.go @@ -1,3 +1,3 @@ package version -const Version = "3.29.1" +const Version = "3.30.0"