Skip to content

Commit

Permalink
use go-sysinfo v1.14.1 and elastic-agent-system-metrics v0.10.6 (#5191)
Browse files Browse the repository at this point in the history
* use go-sysinfo v1.14.1 and elastic-agent-system-metrics v0.10.6

go-sysinfo was lower-casing FQDN by default, this new version does not. Not its user should do it if necessary. elastic-agent-system-metrics is also upgraded to a version that lowercase the FQDN when it's used as `host.name`.
  • Loading branch information
AndersonQ authored Jul 26, 2024
1 parent c58ca88 commit d40d505
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 16 deletions.
8 changes: 4 additions & 4 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1348,11 +1348,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-l

--------------------------------------------------------------------------------
Dependency : github.com/elastic/elastic-agent-system-metrics
Version: v0.10.4
Version: v0.10.6
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-system-metrics@v0.10.4/LICENSE.txt:
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-system-metrics@v0.10.6/LICENSE.txt:

Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -2193,11 +2193,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/go-licenser@v0.

--------------------------------------------------------------------------------
Dependency : github.com/elastic/go-sysinfo
Version: v1.14.0
Version: v1.14.1
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/go-sysinfo@v1.14.0/LICENSE.txt:
Contents of probable licence file $GOMODCACHE/github.com/elastic/go-sysinfo@v1.14.1/LICENSE.txt:


Apache License
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Kind can be one of:
# - breaking-change: a change to previously-documented behavior
# - deprecation: functionality that is being removed in a later release
# - bug-fix: fixes a problem in a previous version
# - enhancement: extends functionality but does not break or fix existing behavior
# - feature: new functionality
# - known-issue: problems that we are aware of in a given version
# - security: impacts on the security of a product or a user’s deployment.
# - upgrade: important information for someone upgrading from a prior version
# - other: does not fit into any of the other categories
kind: bug

# Change summary; a 80ish characters long description of the change.
summary: Fix FQDN being lower-cased for `host.hostname`

# Long description; in case the summary is not enough to describe the change
# this field accommodate a description without length limits.
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment.
#description:

# Affected component; a word indicating the component this changeset affects.
component: host metadata

# PR URL; optional; the PR number that added the changeset.
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
# Please provide it if you are adding a fragment for a different PR.
pr: https://github.com/elastic/elastic-agent/pull/5191

# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
# If not present is automatically filled by the tooling with the issue linked to the PR number.
issue: https://github.com/elastic/beats/issues/39993
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ require (
github.com/elastic/elastic-agent-autodiscover v0.8.0
github.com/elastic/elastic-agent-client/v7 v7.15.0
github.com/elastic/elastic-agent-libs v0.9.15
github.com/elastic/elastic-agent-system-metrics v0.10.4
github.com/elastic/elastic-agent-system-metrics v0.10.6
github.com/elastic/elastic-transport-go/v8 v8.6.0
github.com/elastic/go-elasticsearch/v8 v8.14.0
github.com/elastic/go-licenser v0.4.2
github.com/elastic/go-sysinfo v1.14.0
github.com/elastic/go-sysinfo v1.14.1
github.com/elastic/go-ucfg v0.8.8
github.com/elastic/mock-es v0.0.0-20240712014503-e5b47ece0015
github.com/elastic/opentelemetry-collector-components/processor/elasticinframetricsprocessor v0.7.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,8 @@ github.com/elastic/elastic-agent-client/v7 v7.15.0 h1:nDB7v8TBoNuD6IIzC3z7Q0y+7b
github.com/elastic/elastic-agent-client/v7 v7.15.0/go.mod h1:6h+f9QdIr3GO2ODC0Y8+aEXRwzbA5W4eV4dd/67z7nI=
github.com/elastic/elastic-agent-libs v0.9.15 h1:WCLtuErafUxczT/rXJa4Vr6mxwC8dgtqMbEq+qWGD4M=
github.com/elastic/elastic-agent-libs v0.9.15/go.mod h1:2VgYxHaeM+cCDBjiS2wbmTvzPGbnlXAtYrlcLefheS8=
github.com/elastic/elastic-agent-system-metrics v0.10.4 h1:Tmb1rPRDyVv9M453YlPyl/gwUm9s4nSiI2xH76GGEz4=
github.com/elastic/elastic-agent-system-metrics v0.10.4/go.mod h1:cd7YgcTEjBNeLGnH/C9cEvP/YexohwS6CpmN9Ju58Mw=
github.com/elastic/elastic-agent-system-metrics v0.10.6 h1:tY2LlqvZqguN4QcIOKtx57w/o9ZqmaeoJequwYC34mE=
github.com/elastic/elastic-agent-system-metrics v0.10.6/go.mod h1:tGOvE8Eunm0vZQ5Rh9T9GHYITLsZdywBr3CuvsPlycs=
github.com/elastic/elastic-transport-go/v8 v8.6.0 h1:Y2S/FBjx1LlCv5m6pWAF2kDJAHoSjSRSJCApolgfthA=
github.com/elastic/elastic-transport-go/v8 v8.6.0/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk=
github.com/elastic/go-docappender/v2 v2.2.0 h1:Pq6w+R0ZbWlqZHoqzoujR2ElKBfaPUf3M/cJvPVSrfA=
Expand All @@ -762,8 +762,8 @@ github.com/elastic/go-licenser v0.4.2 h1:bPbGm8bUd8rxzSswFOqvQh1dAkKGkgAmrPxbUi+
github.com/elastic/go-licenser v0.4.2/go.mod h1:W8eH6FaZDR8fQGm+7FnVa7MxI1b/6dAqxz+zPB8nm5c=
github.com/elastic/go-structform v0.0.10 h1:oy08o/Ih2hHTkNcRY/1HhaYvIp5z6t8si8gnCJPDo1w=
github.com/elastic/go-structform v0.0.10/go.mod h1:CZWf9aIRYY5SuKSmOhtXScE5uQiLZNqAFnwKR4OrIM4=
github.com/elastic/go-sysinfo v1.14.0 h1:dQRtiqLycoOOla7IflZg3aN213vqJmP0lpVpKQ9lUEY=
github.com/elastic/go-sysinfo v1.14.0/go.mod h1:FKUXnZWhnYI0ueO7jhsGV3uQJ5hiz8OqM5b3oGyaRr8=
github.com/elastic/go-sysinfo v1.14.1 h1:BpY/Utfz75oKSpsQnbAJmmlnT3gBV9WFsopBEYgjhZY=
github.com/elastic/go-sysinfo v1.14.1/go.mod h1:FKUXnZWhnYI0ueO7jhsGV3uQJ5hiz8OqM5b3oGyaRr8=
github.com/elastic/go-ucfg v0.8.8 h1:54KIF/2zFKfl0MzsSOCGOsZ3O2bnjFQJ0nDJcLhviyk=
github.com/elastic/go-ucfg v0.8.8/go.mod h1:4E8mPOLSUV9hQ7sgLEJ4bvt0KhMuDJa8joDT2QGAEKA=
github.com/elastic/go-windows v1.0.2 h1:yoLLsAsV5cfg9FLhZ9EXZ2n2sQFKeDYrHenkcivY4vI=
Expand Down
9 changes: 4 additions & 5 deletions internal/pkg/agent/application/info/agent_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ package info
import (
"context"
"fmt"

"github.com/elastic/elastic-agent/pkg/features"

"runtime"
"strings"

"github.com/elastic/elastic-agent/pkg/features"

"github.com/elastic/elastic-agent/internal/pkg/agent/application/paths"
"github.com/elastic/elastic-agent/internal/pkg/agent/errors"
"github.com/elastic/elastic-agent/internal/pkg/release"
Expand Down Expand Up @@ -173,7 +172,7 @@ func (i *AgentInfo) ECSMetadata(l *logger.Logger) (*ECSMeta, error) {
Host: &HostECSMeta{
Arch: info.Architecture,
Hostname: hostname,
Name: hostname,
Name: strings.ToLower(hostname),
ID: info.UniqueID,
IP: info.IPs,
MAC: info.MACs,
Expand Down Expand Up @@ -211,7 +210,7 @@ func (i *AgentInfo) ECSMetadataFlatMap(l *logger.Logger) (map[string]interface{}
// Host
meta[hostArchKey] = info.Architecture
meta[hostHostnameKey] = hostname
meta[hostNameKey] = hostname
meta[hostNameKey] = strings.ToLower(hostname)
meta[hostIDKey] = info.UniqueID
meta[hostIPKey] = fmt.Sprintf("[%s]", strings.Join(info.IPs, ","))
meta[hostMACKey] = fmt.Sprintf("[%s]", strings.Join(info.MACs, ","))
Expand Down
3 changes: 2 additions & 1 deletion internal/pkg/composable/providers/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"reflect"
"runtime"
"strings"
"time"

"github.com/elastic/elastic-agent/internal/pkg/agent/errors"
Expand Down Expand Up @@ -141,7 +142,7 @@ func getHostInfo(log *logger.Logger) func() (map[string]interface{}, error) {

return map[string]interface{}{
"id": info.UniqueID,
"name": name,
"name": strings.ToLower(name),
"platform": runtime.GOOS,
"architecture": info.Architecture,
"ip": info.IPs,
Expand Down

0 comments on commit d40d505

Please sign in to comment.