From 9f737ecb24daae7fdfcf890a9e42caf423768265 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Wed, 31 Jan 2024 18:34:16 -0800 Subject: [PATCH] Update method calls --- libbeat/cmd/instance/beat.go | 2 +- libbeat/processors/add_host_metadata/add_host_metadata.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libbeat/cmd/instance/beat.go b/libbeat/cmd/instance/beat.go index 05f738b459ee..88777d06a737 100644 --- a/libbeat/cmd/instance/beat.go +++ b/libbeat/cmd/instance/beat.go @@ -827,7 +827,7 @@ func (b *Beat) configure(settings Settings) error { fqdnLookupCtx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) defer cancel() - fqdn, err := h.FQDN(fqdnLookupCtx) + fqdn, err := h.FQDNWithContext(fqdnLookupCtx) if err != nil { // FQDN lookup is "best effort". We log the error, fallback to // the OS-reported hostname, and move on. diff --git a/libbeat/processors/add_host_metadata/add_host_metadata.go b/libbeat/processors/add_host_metadata/add_host_metadata.go index 1f8e2500b91e..3a383059fbe4 100644 --- a/libbeat/processors/add_host_metadata/add_host_metadata.go +++ b/libbeat/processors/add_host_metadata/add_host_metadata.go @@ -26,6 +26,7 @@ import ( "github.com/gofrs/uuid" "github.com/elastic/elastic-agent-libs/monitoring" + "github.com/elastic/go-sysinfo" "github.com/elastic/beats/v7/libbeat/beat" "github.com/elastic/beats/v7/libbeat/features" @@ -36,7 +37,6 @@ import ( "github.com/elastic/elastic-agent-libs/logp" "github.com/elastic/elastic-agent-libs/mapstr" "github.com/elastic/elastic-agent-system-metrics/metric/system/host" - "github.com/elastic/go-sysinfo" ) const processorName = "add_host_metadata" @@ -182,7 +182,7 @@ func (p *addHostMetadata) loadData(checkCache bool, useFQDN bool) error { ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) defer cancel() - fqdn, err := h.FQDN(ctx) + fqdn, err := h.FQDNWithContext(ctx) if err != nil { // FQDN lookup is "best effort". If it fails, we monitor the failure, fallback to // the OS-reported hostname, and move on.