Skip to content

Commit 8214d92

Browse files
[8.19](backport #46308) Accomodate logger changes from tlscommon package (#46426)
* Accomodate logger changes from `tlscommon` package (#46308) This PR accommodates breaking changes made in elastic-agent-libs . It effectively uses local logger in place of global ones (cherry picked from commit 0788d61) # Conflicts: # x-pack/filebeat/input/awss3/decoding_parquet.go # x-pack/filebeat/input/awss3/s3_objects.go # x-pack/filebeat/input/azureblobstorage/decoding.go # x-pack/filebeat/input/azureblobstorage/job.go # x-pack/filebeat/input/gcs/job.go * fix conflict * fix ci --------- Co-authored-by: Khushi Jain <[email protected]>
1 parent c79e92a commit 8214d92

File tree

22 files changed

+54
-32
lines changed

22 files changed

+54
-32
lines changed

NOTICE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12317,11 +12317,11 @@ SOFTWARE
1231712317

1231812318
--------------------------------------------------------------------------------
1231912319
Dependency : github.com/elastic/elastic-agent-libs
12320-
Version: v0.23.0
12320+
Version: v0.24.0
1232112321
Licence type (autodetected): Apache-2.0
1232212322
--------------------------------------------------------------------------------
1232312323

12324-
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.23.0/LICENSE:
12324+
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.24.0/LICENSE:
1232512325

1232612326
Apache License
1232712327
Version 2.0, January 2004

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ require (
174174
github.com/elastic/bayeux v1.0.5
175175
github.com/elastic/ebpfevents v0.7.0
176176
github.com/elastic/elastic-agent-autodiscover v0.10.0
177-
github.com/elastic/elastic-agent-libs v0.23.0
177+
github.com/elastic/elastic-agent-libs v0.24.0
178178
github.com/elastic/elastic-agent-system-metrics v0.13.2
179179
github.com/elastic/go-elasticsearch/v8 v8.18.1
180180
github.com/elastic/go-freelru v0.16.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ github.com/elastic/elastic-agent-autodiscover v0.10.0 h1:WJ4zl9uSfk1kHmn2B/0byQB
362362
github.com/elastic/elastic-agent-autodiscover v0.10.0/go.mod h1:Nf3zh9FcJ9nTTswTwDTUAqXmvQllOrNliM6xmORSxwE=
363363
github.com/elastic/elastic-agent-client/v7 v7.15.0 h1:nDB7v8TBoNuD6IIzC3z7Q0y+7bMgXoT2DsHfolO2CHE=
364364
github.com/elastic/elastic-agent-client/v7 v7.15.0/go.mod h1:6h+f9QdIr3GO2ODC0Y8+aEXRwzbA5W4eV4dd/67z7nI=
365-
github.com/elastic/elastic-agent-libs v0.23.0 h1:xpMKkrw59QUYWUx/q2TMpJU+6vwB3Mw1VPhRPcGhBMo=
366-
github.com/elastic/elastic-agent-libs v0.23.0/go.mod h1:xSeIP3NtOIT4N2pPS4EyURmS1Q8mK0lWZ8Wd1Du6q3w=
365+
github.com/elastic/elastic-agent-libs v0.24.0 h1:8skd0le8Y/zAGVaj4m44ljiJMAp0xuJz07ngDTL/1kM=
366+
github.com/elastic/elastic-agent-libs v0.24.0/go.mod h1:xSeIP3NtOIT4N2pPS4EyURmS1Q8mK0lWZ8Wd1Du6q3w=
367367
github.com/elastic/elastic-agent-system-metrics v0.13.2 h1:R4ogKHESuWhWTtopnw/aHnBxxSZbxd7KHV4GefdwT2M=
368368
github.com/elastic/elastic-agent-system-metrics v0.13.2/go.mod h1:ezM1kzDUT+vWXFh5oK8QXB/AEB0UoLWqWA8rkRicFFo=
369369
github.com/elastic/elastic-transport-go/v8 v8.7.0 h1:OgTneVuXP2uip4BA658Xi6Hfw+PeIOod2rY3GVMGoVE=

heartbeat/monitors/active/dialchain/tls.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525

2626
"github.com/elastic/beats/v7/heartbeat/monitors/active/dialchain/tlsmeta"
2727
"github.com/elastic/beats/v7/libbeat/beat"
28+
"github.com/elastic/elastic-agent-libs/logp"
2829
"github.com/elastic/elastic-agent-libs/transport"
2930
"github.com/elastic/elastic-agent-libs/transport/tlscommon"
3031
)
@@ -40,7 +41,7 @@ func TLSLayer(cfg *tlscommon.TLSConfig, to time.Duration) Layer {
4041
// This gets us the timestamp for when the TLS layer will start the handshake.
4142
next = startTimerAfterDial(&timer, next)
4243

43-
dialer := transport.TLSDialer(next, cfg, to)
44+
dialer := transport.TLSDialer(next, cfg, to, logp.NewLogger(""))
4445
return afterDial(dialer, func(conn net.Conn) (net.Conn, error) {
4546
tlsConn, ok := conn.(*cryptoTLS.Conn)
4647
if !ok {

libbeat/autodiscover/providers/kubernetes/config.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,13 @@ func (c *Config) Validate() error {
113113
if c.Scope != "node" && c.Scope != "cluster" {
114114
return fmt.Errorf("invalid `scope` configured. supported values are `node` and `cluster`")
115115
}
116-
if c.Unique && c.Scope != "cluster" {
117-
logp.L().Warnf("can only set `unique` when scope is `cluster`")
118-
}
119116

120117
return nil
121118
}
119+
120+
// checkUnsupportedParams checks if unsupported/deprecated/discouraged paramaters are set and logs a warning
121+
func (c Config) checkUnsupportedParams(logger *logp.Logger) {
122+
if c.Unique && c.Scope != "cluster" {
123+
logger.Warn("can only set `unique` when scope is `cluster`")
124+
}
125+
}

libbeat/autodiscover/providers/kubernetes/kubernetes.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ func AutodiscoverBuilder(
110110
return nil, errWrap(err)
111111
}
112112

113+
// log warning about any unsupported params
114+
config.checkUnsupportedParams(logger)
115+
113116
client, err := kubernetes.GetKubernetesClient(config.KubeConfig, config.KubeClientOptions)
114117
if err != nil {
115118
return nil, errWrap(err)

libbeat/autodiscover/providers/kubernetes/node.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ func NewNodeEventer(
6363
return nil, err
6464
}
6565

66+
// log warning about any unsupported params
67+
config.checkUnsupportedParams(logger)
68+
6669
// Ensure that node is set correctly whenever the scope is set to "node". Make sure that node is empty
6770
// when cluster scope is enforced.
6871
if config.Scope == "node" {

libbeat/autodiscover/providers/kubernetes/pod.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ func NewPodEventer(
7575
return nil, err
7676
}
7777

78+
// log warning about any unsupported params
79+
config.checkUnsupportedParams(logger)
80+
7881
// Ensure that node is set correctly whenever the scope is set to "node". Make sure that node is empty
7982
// when cluster scope is enforced.
8083
if config.Scope == "node" {

libbeat/autodiscover/providers/kubernetes/service.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ func NewServiceEventer(
6363
return nil, err
6464
}
6565

66+
// log warning about any unsupported params
67+
config.checkUnsupportedParams(logger)
68+
6669
watcher, err := kubernetes.NewNamedWatcher("service", client, &kubernetes.Service{}, kubernetes.WatchOptions{
6770
SyncTimeout: config.SyncPeriod,
6871
Namespace: config.Namespace,

libbeat/common/transport/transptest/testing.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func connectTCP(timeout time.Duration) TransportFactory {
171171
Proxy: proxy,
172172
Timeout: timeout,
173173
}
174-
return transport.NewClient(cfg, "tcp", addr, 0)
174+
return transport.NewClient(cfg, "tcp", addr, 0, logp.NewNopLogger())
175175
}
176176
}
177177

@@ -189,7 +189,7 @@ func connectTLS(timeout time.Duration, certName string) TransportFactory {
189189
TLS: tlsConfig,
190190
Timeout: timeout,
191191
}
192-
return transport.NewClient(cfg, "tcp", addr, 0)
192+
return transport.NewClient(cfg, "tcp", addr, 0, logp.NewNopLogger())
193193
}
194194
}
195195

0 commit comments

Comments
 (0)