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.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
chore: remove otlp zap encoder (#7408)
Vibhu Pandey089f1280208e
diff --git a/ee/query-service/main.go b/ee/query-service/main.goindex 06c5695bca..7c48778383 100644--- a/ee/query-service/main.go+++ b/ee/query-service/main.go@@ -3,10 +3,7 @@ package mainimport ("context""flag"- "log""os"- "os/signal"- "strconv""time""github.com/SigNoz/signoz/ee/query-service/app"@@ -18,67 +15,19 @@ import ("github.com/SigNoz/signoz/pkg/query-service/version""github.com/SigNoz/signoz/pkg/signoz""github.com/SigNoz/signoz/pkg/types/authtypes"- "go.opentelemetry.io/otel/sdk/resource"- semconv "go.opentelemetry.io/otel/semconv/v1.4.0"- "google.golang.org/grpc"- "google.golang.org/grpc/credentials/insecure"prommodel "github.com/prometheus/common/model"- zapotlpencoder "github.com/SigNoz/zap_otlp/zap_otlp_encoder"- zapotlpsync "github.com/SigNoz/zap_otlp/zap_otlp_sync"-"go.uber.org/zap""go.uber.org/zap/zapcore")-func initZapLog(enableQueryServiceLogOTLPExport bool) *zap.Logger {+func initZapLog() *zap.Logger {config := zap.NewProductionConfig()- ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)- defer stop()-- config.EncoderConfig.EncodeDuration = zapcore.MillisDurationEncoder- config.EncoderConfig.EncodeLevel = zapcore.CapitalLevelEncoder+ config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoderconfig.EncoderConfig.TimeKey = "timestamp"config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder-- otlpEncoder := zapotlpencoder.NewOTLPEncoder(config.EncoderConfig)- consoleEncoder := zapcore.NewJSONEncoder(config.EncoderConfig)- defaultLogLevel := zapcore.InfoLevel-- res := resource.NewWithAttributes(- semconv.SchemaURL,- semconv.ServiceNameKey.String("query-service"),- )-- core := zapcore.NewTee(- zapcore.NewCore(consoleEncoder, os.Stdout, defaultLogLevel),- )-- if enableQueryServiceLogOTLPExport {- ctx, cancel := context.WithTimeout(ctx, time.Second*30)- defer cancel()- conn, err := grpc.DialContext(ctx, baseconst.OTLPTarget, grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()))- if err != nil {- log.Fatalf("failed to establish connection: %v", err)- } else {- logExportBatchSizeInt, err := strconv.Atoi(baseconst.LogExportBatchSize)- if err != nil {- logExportBatchSizeInt = 512- }- ws := zapcore.AddSync(zapotlpsync.NewOtlpSyncer(conn, zapotlpsync.Options{- BatchSize: logExportBatchSizeInt,- ResourceSchema: semconv.SchemaURL,- Resource: res,- }))- core = zapcore.NewTee(- zapcore.NewCore(consoleEncoder, os.Stdout, defaultLogLevel),- zapcore.NewCore(otlpEncoder, zapcore.NewMultiWriteSyncer(ws), defaultLogLevel),- )- }- }- logger := zap.New(core, zap.AddCaller(), zap.AddStacktrace(zapcore.ErrorLevel))-+ logger, _ := config.Build()return logger}@@ -99,7 +48,6 @@ func main() {var useLogsNewSchema boolvar useTraceNewSchema boolvar cacheConfigPath, fluxInterval, fluxIntervalForTraceDetail string- var enableQueryServiceLogOTLPExport boolvar preferSpanMetrics boolvar maxIdleConns int@@ -121,14 +69,12 @@ func main() {flag.StringVar(&cacheConfigPath, "experimental.cache-config", "", "(cache config to use)")flag.StringVar(&fluxInterval, "flux-interval", "5m", "(the interval to exclude data from being cached to avoid incorrect cache for data in motion)")flag.StringVar(&fluxIntervalForTraceDetail, "flux-interval-trace-detail", "2m", "(the interval to exclude data from being cached to avoid incorrect cache for trace data in motion)")- flag.BoolVar(&enableQueryServiceLogOTLPExport, "enable.query.service.log.otlp.export", false, "(enable query service log otlp export)")flag.StringVar(&cluster, "cluster", "cluster", "(cluster name - defaults to 'cluster')")flag.StringVar(&gatewayUrl, "gateway-url", "", "(url to the gateway)")flag.BoolVar(&useLicensesV3, "use-licenses-v3", false, "use licenses_v3 schema for licenses")flag.Parse()- loggerMgr := initZapLog(enableQueryServiceLogOTLPExport)-+ loggerMgr := initZapLog()zap.ReplaceGlobals(loggerMgr)defer loggerMgr.Sync() // flushes buffer, if anydiff --git a/go.mod b/go.modindex 3d456796f7..8a76654d7c 100644--- a/go.mod+++ b/go.mod@@ -10,8 +10,6 @@ require (github.com/DATA-DOG/go-sqlmock v1.5.2github.com/SigNoz/govaluate v0.0.0-20240203125216-988004ccc7fdgithub.com/SigNoz/signoz-otel-collector v0.111.16- github.com/SigNoz/zap_otlp/zap_otlp_encoder v0.0.0-20230822164844-1b861a431974- github.com/SigNoz/zap_otlp/zap_otlp_sync v0.0.0-20230822164844-1b861a431974github.com/antonmedv/expr v1.15.3github.com/cespare/xxhash/v2 v2.3.0github.com/coreos/go-oidc/v3 v3.11.0@@ -74,7 +72,6 @@ require (golang.org/x/oauth2 v0.24.0golang.org/x/sync v0.10.0golang.org/x/text v0.21.0- google.golang.org/grpc v1.67.1google.golang.org/protobuf v1.35.2gopkg.in/segmentio/analytics-go.v3 v3.1.0gopkg.in/yaml.v2 v2.4.0@@ -274,6 +271,7 @@ require (google.golang.org/api v0.199.0 // indirectgoogle.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirectgoogle.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect+ google.golang.org/grpc v1.67.1 // indirectgopkg.in/telebot.v3 v3.3.8 // indirectk8s.io/client-go v0.31.1 // indirectk8s.io/klog/v2 v2.130.1 // indirectdiff --git a/go.sum b/go.sumindex 0101b4d456..ec5f976957 100644--- a/go.sum+++ b/go.sum@@ -97,12 +97,6 @@ github.com/SigNoz/prometheus v1.13.0 h1:hsUql1zd83ifXtswO9Qk1rpCgVjE/ItQvgdNocBSgithub.com/SigNoz/prometheus v1.13.0/go.mod h1:4PC0dxmx6y3kNI2d9oOTvEFTPkH6QnxDxERyqeL1hvI=github.com/SigNoz/signoz-otel-collector v0.111.16 h1:535uKH5Oux+35EsI+L3C6pnAP/Ye0PTCbVizXoL+VqE=github.com/SigNoz/signoz-otel-collector v0.111.16/go.mod h1:HJ4m0LY1MPsuZmuRF7Ixb+bY8rxgRzI0VXzOedESsjg=-github.com/SigNoz/zap_otlp v0.1.0 h1:T7rRcFN87GavY8lDGZj0Z3Xv6OhJA6Pj3I9dNPmqvRc=-github.com/SigNoz/zap_otlp v0.1.0/go.mod h1:lcHvbDbRgvDnPxo9lDlaL1JK2PyOyouP/C3ynnYIvyo=-github.com/SigNoz/zap_otlp/zap_otlp_encoder v0.0.0-20230822164844-1b861a431974 h1:PKVgdf83Yw+lZJbFtNGBgqXiXNf3+kOXW2qZ7Ms7OaY=-github.com/SigNoz/zap_otlp/zap_otlp_encoder v0.0.0-20230822164844-1b861a431974/go.mod h1:fpiHtiboLJpIE5TtkQfiWx6xtnlA+uWmv+N9opETqKY=-github.com/SigNoz/zap_otlp/zap_otlp_sync v0.0.0-20230822164844-1b861a431974 h1:G2JzCrqdeOTtAn4tDFZEg5gCAEYVRXcddG3ZlrFMumo=-github.com/SigNoz/zap_otlp/zap_otlp_sync v0.0.0-20230822164844-1b861a431974/go.mod h1:YtDal1xBRQfPRNo7iSU3W37RGT0jMW7Rnzk6EON3a4M=github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=