Skip to content

Commit

Permalink
[8.11](backport #37171) upgrade elastic-agent-system-metrics to v0.8.2 (
Browse files Browse the repository at this point in the history
#37173)

* upgrade elastic-agent-system-metrics to v0.8.2 (#37171)

* upgrade elastic-agent-system-metrics to v0.8.2

- bugfix for memory leak
- backport system test changes, required by elastic-agent-system-metrics v0.8.1

(cherry picked from commit 15857a8)

Co-authored-by: Lee E Hinman <[email protected]>
Co-authored-by: Lee E. Hinman <[email protected]>
  • Loading branch information
3 people authored Nov 22, 2023
1 parent a590ba4 commit 1ac2770
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Fix EC2 host.cpu.usage {pull}35717[35717]
- Add option in SQL module to execute queries for all dbs. {pull}35688[35688]
- Add remaining dimensions for azure storage account to make them available for tsdb enablement. {pull}36331[36331]
- Fix memory leak on Windows {issue}37142[37142] {pull}37171[37171]

*Osquerybeat*

Expand Down
4 changes: 2 additions & 2 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13026,11 +13026,11 @@ these terms.

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

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

Apache License
Version 2.0, January 2004
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ require (
github.com/elastic/elastic-agent-autodiscover v0.6.4
github.com/elastic/elastic-agent-libs v0.6.2
github.com/elastic/elastic-agent-shipper-client v0.5.1-0.20230228231646-f04347b666f3
github.com/elastic/elastic-agent-system-metrics v0.7.0
github.com/elastic/elastic-agent-system-metrics v0.8.2
github.com/elastic/go-elasticsearch/v8 v8.10.0
github.com/elastic/mito v1.6.0
github.com/elastic/toutoumomoma v0.0.0-20221026030040-594ef30cb640
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,8 @@ github.com/elastic/elastic-agent-libs v0.6.2 h1:tE5pFK4y7xm1FtXm+r+63G7STjJAaWh3
github.com/elastic/elastic-agent-libs v0.6.2/go.mod h1:o+EySawBZGeYu49shJxerg2wRCimS1dhrD4As0MS700=
github.com/elastic/elastic-agent-shipper-client v0.5.1-0.20230228231646-f04347b666f3 h1:sb+25XJn/JcC9/VL8HX4r4QXSUq4uTNzGS2kxOE7u1U=
github.com/elastic/elastic-agent-shipper-client v0.5.1-0.20230228231646-f04347b666f3/go.mod h1:rWarFM7qYxJKsi9WcV6ONcFjH/NA3niDNpTxO+8/GVI=
github.com/elastic/elastic-agent-system-metrics v0.7.0 h1:qDLY30UDforSd/TfHfqUDiiHSL6Nu6qLXHsKSxz4OuQ=
github.com/elastic/elastic-agent-system-metrics v0.7.0/go.mod h1:9C1UEfj0P687HAzZepHszN6zXA+2tN2Lx3Osvq1zby8=
github.com/elastic/elastic-agent-system-metrics v0.8.2 h1:99H1o+WTD/g6jcQr1hUOZ+dsZkZF0SfNePmjGg7TnhU=
github.com/elastic/elastic-agent-system-metrics v0.8.2/go.mod h1:9C1UEfj0P687HAzZepHszN6zXA+2tN2Lx3Osvq1zby8=
github.com/elastic/elastic-transport-go/v8 v8.0.0-20230329154755-1a3c63de0db6/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI=
github.com/elastic/elastic-transport-go/v8 v8.3.0 h1:DJGxovyQLXGr62e9nDMPSxRyWION0Bh6d9eCFBriiHo=
github.com/elastic/elastic-transport-go/v8 v8.3.0/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI=
Expand Down
14 changes: 10 additions & 4 deletions metricbeat/module/system/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
# for some kernel level processes. fd is also part of the system process, but
# is not available on all OSes and requires root to read for all processes.
# cgroup is only available on linux.
SYSTEM_PROCESS_FIELDS = ["cpu", "memory", "state", "num_threads"]
SYSTEM_PROCESS_FIELDS = ["cpu", "memory", "state"]


class Test(metricbeat.BaseTest):
Expand Down Expand Up @@ -420,6 +420,9 @@ def test_process(self):
found_cmdline = False
for evt in output:
process = evt["system"]["process"]
# Not all process will have 'cmdline' due to permission issues,
# especially on Windows. Therefore we ensure at least some of
# them will have it.
found_cmdline |= "cmdline" in process

# Remove 'env' prior to checking documented fields because its keys are dynamic.
Expand All @@ -430,11 +433,13 @@ def test_process(self):
process.pop("cgroup", None)
process.pop("fd", None)
process.pop("cmdline", None)
process.pop("num_threads", None)

self.assertCountEqual(SYSTEM_PROCESS_FIELDS, process.keys())

self.assertTrue(
found_cmdline, "cmdline not found in any process events")
# After iterating over all process, make sure at least one of them had
# the 'cmdline' set.
self.assertTrue(
found_cmdline, "cmdline not found in any process events")

@unittest.skipUnless(re.match("(?i)linux|darwin|freebsd", sys.platform), "os")
def test_process_unix(self):
Expand Down Expand Up @@ -486,6 +491,7 @@ def test_process_unix(self):
process.pop("cgroup", None)
process.pop("cmdline", None)
process.pop("fd", None)
process.pop("num_threads", None)

self.assertCountEqual(SYSTEM_PROCESS_FIELDS, process.keys())

Expand Down

0 comments on commit 1ac2770

Please sign in to comment.