Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix(analytics): format segment logger messages before passing to slog (#12950)

Pandeyf2229a1064eb
diff --git a/pkg/analytics/segmentanalytics/logger.go b/pkg/analytics/segmentanalytics/logger.go
index 0be6282ca2..a291ada39c 100644
--- a/pkg/analytics/segmentanalytics/logger.go
+++ b/pkg/analytics/segmentanalytics/logger.go
@@ -2,6 +2,7 @@ package segmentanalytics
import (
"context"
+ "fmt"
"github.com/SigNoz/signoz/pkg/factory"
segment "github.com/segmentio/analytics-go/v3"
@@ -18,11 +19,11 @@ func newSegmentLogger(settings factory.ScopedProviderSettings) segment.Logger {
}
func (logger *logger) Logf(format string, args ...interface{}) {
- // the no lint directive is needed because the segmentlogger is not a slog.Logger
- logger.settings.Logger().InfoContext(context.TODO(), format, args...) //nolint:sloglint
+ // the no lint directive is needed because the segment logger is not a slog.Logger
+ logger.settings.Logger().InfoContext(context.TODO(), fmt.Sprintf(format, args...)) //nolint:sloglint
}
func (logger *logger) Errorf(format string, args ...interface{}) {
// the no lint directive is needed because the segment logger is not a slog.Logger
- logger.settings.Logger().ErrorContext(context.TODO(), format, args...) //nolint:sloglint
+ logger.settings.Logger().ErrorContext(context.TODO(), fmt.Sprintf(format, args...)) //nolint:sloglint
}