From 57e4cf0c646b3186610fc6d4ceff8bed0e09fcd0 Mon Sep 17 00:00:00 2001 From: Tarun Date: Tue, 10 Dec 2024 00:08:18 +0530 Subject: [PATCH 1/9] Added Zap as the default Error log open-telemetry#11820 --- config/confighttp/confighttp.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/confighttp/confighttp.go b/config/confighttp/confighttp.go index 69ac3900fe5..9d0aad08d21 100644 --- a/config/confighttp/confighttp.go +++ b/config/confighttp/confighttp.go @@ -20,6 +20,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/noop" + "go.uber.org/zap" "golang.org/x/net/http2" "golang.org/x/net/publicsuffix" @@ -479,13 +480,14 @@ func (hss *ServerConfig) ToServer(_ context.Context, host component.Host, settin next: handler, includeMetadata: hss.IncludeMetadata, } - server := &http.Server{ Handler: handler, ReadTimeout: hss.ReadTimeout, ReadHeaderTimeout: hss.ReadHeaderTimeout, WriteTimeout: hss.WriteTimeout, IdleTimeout: hss.IdleTimeout, + // Setting the server error logger + ErrorLog: zap.NewStdLog(settings.Logger), } return server, nil From a9f3aeba3cdc0b1b85685a3fceee0bd0c3decbe9 Mon Sep 17 00:00:00 2001 From: Tarun Date: Tue, 10 Dec 2024 01:24:39 +0530 Subject: [PATCH 2/9] Added Zap as the default Error log open-telemetry#11820 --- config/confighttp/confighttp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/confighttp/confighttp.go b/config/confighttp/confighttp.go index 9d0aad08d21..8fa1a09b758 100644 --- a/config/confighttp/confighttp.go +++ b/config/confighttp/confighttp.go @@ -486,7 +486,7 @@ func (hss *ServerConfig) ToServer(_ context.Context, host component.Host, settin ReadHeaderTimeout: hss.ReadHeaderTimeout, WriteTimeout: hss.WriteTimeout, IdleTimeout: hss.IdleTimeout, - // Setting the server error logger + // Setting the Server error logger ErrorLog: zap.NewStdLog(settings.Logger), } From 6582f981c4b7d0abc33aa49f01f988c997754eb8 Mon Sep 17 00:00:00 2001 From: Tarun Date: Wed, 11 Dec 2024 19:16:44 +0530 Subject: [PATCH 3/9] Added Zap as the default Error log open-telemetry#11820 --- config/confighttp/confighttp.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/confighttp/confighttp.go b/config/confighttp/confighttp.go index 8fa1a09b758..d35f804dd39 100644 --- a/config/confighttp/confighttp.go +++ b/config/confighttp/confighttp.go @@ -21,6 +21,7 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/noop" "go.uber.org/zap" + "go.uber.org/zap/zapcore" "golang.org/x/net/http2" "golang.org/x/net/publicsuffix" @@ -480,14 +481,14 @@ func (hss *ServerConfig) ToServer(_ context.Context, host component.Host, settin next: handler, includeMetadata: hss.IncludeMetadata, } + errorLog, _ := zap.NewStdLogAt(settings.Logger, zapcore.ErrorLevel) server := &http.Server{ Handler: handler, ReadTimeout: hss.ReadTimeout, ReadHeaderTimeout: hss.ReadHeaderTimeout, WriteTimeout: hss.WriteTimeout, IdleTimeout: hss.IdleTimeout, - // Setting the Server error logger - ErrorLog: zap.NewStdLog(settings.Logger), + ErrorLog: errorLog, } return server, nil From 5460f8d70c54961fea5ba155a1d6dcc4e5910539 Mon Sep 17 00:00:00 2001 From: Tarun Date: Wed, 11 Dec 2024 19:50:10 +0530 Subject: [PATCH 4/9] change log --- .chloggen/zap-default-errorlog.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .chloggen/zap-default-errorlog.yaml diff --git a/.chloggen/zap-default-errorlog.yaml b/.chloggen/zap-default-errorlog.yaml new file mode 100644 index 00000000000..867477dd355 --- /dev/null +++ b/.chloggen/zap-default-errorlog.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: confighttp + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Added Zap as the default error log in confighttp " + +# One or more tracking issues or pull requests related to the change +issues: [1180] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] From f9c33758c3c2c0c9cb3d653b167c9eaa88d1eda6 Mon Sep 17 00:00:00 2001 From: Tarun Date: Wed, 11 Dec 2024 19:54:16 +0530 Subject: [PATCH 5/9] change log --- .chloggen/zap-default-errorlog.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/zap-default-errorlog.yaml b/.chloggen/zap-default-errorlog.yaml index 867477dd355..e09725aa275 100644 --- a/.chloggen/zap-default-errorlog.yaml +++ b/.chloggen/zap-default-errorlog.yaml @@ -10,7 +10,7 @@ component: confighttp note: "Added Zap as the default error log in confighttp " # One or more tracking issues or pull requests related to the change -issues: [1180] +issues: [11820] # (Optional) One or more lines of additional information to render under the primary note. # These lines will be padded with 2 spaces and then inserted directly into the document. From 71c16e0b293b4d6ed25146c4dd295093e672afd7 Mon Sep 17 00:00:00 2001 From: Tarun Date: Wed, 11 Dec 2024 21:39:41 +0530 Subject: [PATCH 6/9] Added Zap as the default Error log open-telemetry#11820 --- config/confighttp/confighttp.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/confighttp/confighttp.go b/config/confighttp/confighttp.go index d35f804dd39..687a1c1b95a 100644 --- a/config/confighttp/confighttp.go +++ b/config/confighttp/confighttp.go @@ -481,7 +481,10 @@ func (hss *ServerConfig) ToServer(_ context.Context, host component.Host, settin next: handler, includeMetadata: hss.IncludeMetadata, } - errorLog, _ := zap.NewStdLogAt(settings.Logger, zapcore.ErrorLevel) + errorLog, err := zap.NewStdLogAt(settings.Logger, zapcore.ErrorLevel) + if err != nil { + return nil, err + } server := &http.Server{ Handler: handler, ReadTimeout: hss.ReadTimeout, From e2b7c86f0deeaf21603d2525dad317f6576497aa Mon Sep 17 00:00:00 2001 From: Tarun Date: Wed, 11 Dec 2024 22:21:24 +0530 Subject: [PATCH 7/9] Added Zap as the default Error log open-telemetry#11820 --- config/confighttp/confighttp.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/config/confighttp/confighttp.go b/config/confighttp/confighttp.go index 687a1c1b95a..80df409a2d7 100644 --- a/config/confighttp/confighttp.go +++ b/config/confighttp/confighttp.go @@ -482,9 +482,7 @@ func (hss *ServerConfig) ToServer(_ context.Context, host component.Host, settin includeMetadata: hss.IncludeMetadata, } errorLog, err := zap.NewStdLogAt(settings.Logger, zapcore.ErrorLevel) - if err != nil { - return nil, err - } + server := &http.Server{ Handler: handler, ReadTimeout: hss.ReadTimeout, @@ -494,7 +492,7 @@ func (hss *ServerConfig) ToServer(_ context.Context, host component.Host, settin ErrorLog: errorLog, } - return server, nil + return server, err } func responseHeadersHandler(handler http.Handler, headers map[string]configopaque.String) http.Handler { From bc33333848fb9ac85f5f2b2689c5860ed4e433c3 Mon Sep 17 00:00:00 2001 From: Tarun Date: Thu, 12 Dec 2024 22:23:49 +0530 Subject: [PATCH 8/9] genotelcorecol done --- cmd/otelcorecol/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/otelcorecol/go.mod b/cmd/otelcorecol/go.mod index 4e7f799af6b..e9c2404a84a 100644 --- a/cmd/otelcorecol/go.mod +++ b/cmd/otelcorecol/go.mod @@ -4,7 +4,7 @@ module go.opentelemetry.io/collector/cmd/otelcorecol go 1.22.0 -toolchain go1.22.9 +toolchain go1.23.0 require ( go.opentelemetry.io/collector/component v0.115.0 From 9a4d63dfd0bedbde944c93199ea54e00efec575b Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Fri, 13 Dec 2024 08:48:56 -0800 Subject: [PATCH 9/9] Update cmd/otelcorecol/go.mod --- cmd/otelcorecol/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/otelcorecol/go.mod b/cmd/otelcorecol/go.mod index 52ac8f2ac3a..54c77922199 100644 --- a/cmd/otelcorecol/go.mod +++ b/cmd/otelcorecol/go.mod @@ -4,7 +4,7 @@ module go.opentelemetry.io/collector/cmd/otelcorecol go 1.22.0 -toolchain go1.23.0 +toolchain go1.22.9 require ( go.opentelemetry.io/collector/component v0.115.0