elastic / elastic-otel-node

https://github.com/elastic/elastic-otel-node/tree/main/packages/opentelemetry-node#readme
Apache License 2.0
6 stars 3 forks source link

flaky test: "system.cpu.utilization" data points have a value between 0-1 #73

Open trentm opened 9 months ago

trentm commented 9 months ago

Since, I think, #52 this test has been flaky. I've seen failures on two PRs now.

https://github.com/elastic/elastic-otel-node/actions/runs/7879432439/job/21499670394?pr=72

# host metrics
# host metrics default views
{"name":"mockotlpserver","level":30,"msg":"OTLP/HTTP listening at http://127.0.0.1:45709/","time":"2024-02-12T23:42:52.907Z"}
ok 7 exited successfully: err=null
ok 8 system.network.* metrics are dropped
ok 9 system.cpu.time metric is dropped
ok 10 data points are present in system.cpu.utilization metric
not ok 11 "system.cpu.utilization" data points have a value between 0-1
  ---
    operator: ok
    expected: true
    actual:   false
    at: <anonymous> (/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/host-metrics.test.js:47:19)
    stack: |-
      Error: "system.cpu.utilization" data points have a value between 0-1
          at Test.assert [as _assert] (/home/runner/work/elastic-otel-node/elastic-otel-node/node_modules/tape/lib/test.js:479:48)
          at Test.assert (/home/runner/work/elastic-otel-node/elastic-otel-node/node_modules/tape/lib/test.js:612:7)
          at /home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/host-metrics.test.js:47:19
          at Array.forEach (<anonymous>)
          at Object.checkTelemetry (/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/host-metrics.test.js:42:35)
          at done (/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/testutils.js:504:42)
          at ChildProcess.exithandler (node:child_process:414:7)
          at ChildProcess.emit (node:events:519:28)
          at maybeClose (node:internal/child_process:1105:16)
          at ChildProcess._handle.onexit (node:internal/child_process:305:5)
  ...
ok 12 data points have no "system.cpu.state" attribute
trentm commented 9 months ago

@david-luna I added a debug print for local runs of this test file, and while I haven't had a failure locally yet, I see negative values. Is that expected?

With this in host-metrics.test.js:

                console.log('XXX metric: ', metric.gauge.dataPoints);
                t.ok(
                    metric.gauge?.dataPoints.every((dp) => dp.asDouble < 1),
                    '"system.cpu.utilization" data points have a value between 0-1'
                );

I see:

% node test/host-metrics.test.js
TAP version 13
# host metrics
# host metrics default views
{"name":"mockotlpserver","level":30,"msg":"OTLP/HTTP listening at http://127.0.0.1:54634/","time":"2024-02-13T00:21:00.319Z"}
ok 1 exited successfully: err=null
ok 2 system.network.* metrics are dropped
ok 3 system.cpu.time metric is dropped
ok 4 data points are present in system.cpu.utilization metric
XXX metric:  [
  {
    startTimeUnixNano: '1707783660752000000',
    timeUnixNano: '1707783660752000000',
    asDouble: 0.4814814814814815,
    attributes: { 'system.cpu.logical_number': '0' }
  },
  {
    startTimeUnixNano: '1707783660752000000',
    timeUnixNano: '1707783660752000000',
    asDouble: 0.03703703703703709,
    attributes: { 'system.cpu.logical_number': '1' }
  },
  {
    startTimeUnixNano: '1707783660752000000',
    timeUnixNano: '1707783660752000000',
    asDouble: 0.18518518518518523,
    attributes: { 'system.cpu.logical_number': '2' }
  },
  {
    startTimeUnixNano: '1707783660752000000',
    timeUnixNano: '1707783660752000000',
    asDouble: -0.03703703703703698,
    attributes: { 'system.cpu.logical_number': '3' }
  },
  {
    startTimeUnixNano: '1707783660752000000',
    timeUnixNano: '1707783660752000000',
    asDouble: 0.18518518518518523,
    attributes: { 'system.cpu.logical_number': '4' }
  },
  {
    startTimeUnixNano: '1707783660752000000',
    timeUnixNano: '1707783660752000000',
    asDouble: -0.03703703703703698,
    attributes: { 'system.cpu.logical_number': '5' }
  },
  {
    startTimeUnixNano: '1707783660752000000',
    timeUnixNano: '1707783660752000000',
    asDouble: 0.11111111111111116,
    attributes: { 'system.cpu.logical_number': '6' }
  },
  {
    startTimeUnixNano: '1707783660752000000',
    timeUnixNano: '1707783660752000000',
    asDouble: 0.03703703703703709,
    attributes: { 'system.cpu.logical_number': '7' }
  },
  {
    startTimeUnixNano: '1707783660752000000',
    timeUnixNano: '1707783660752000000',
    asDouble: 0.11111111111111116,
    attributes: { 'system.cpu.logical_number': '8' }
  },
  {
    startTimeUnixNano: '1707783660752000000',
    timeUnixNano: '1707783660752000000',
    asDouble: 0.03703703703703709,
    attributes: { 'system.cpu.logical_number': '9' }
  },
  {
    startTimeUnixNano: '1707783660752000000',
    timeUnixNano: '1707783660752000000',
    asDouble: 0.03703703703703709,
    attributes: { 'system.cpu.logical_number': '10' }
  },
  {
    startTimeUnixNano: '1707783660752000000',
    timeUnixNano: '1707783660752000000',
    asDouble: -0.03703703703703698,
    attributes: { 'system.cpu.logical_number': '11' }
  },
  {
    startTimeUnixNano: '1707783660752000000',
    timeUnixNano: '1707783660752000000',
    asDouble: -0.03703703703703698,
    attributes: { 'system.cpu.logical_number': '12' }
  },
  {
    startTimeUnixNano: '1707783660752000000',
    timeUnixNano: '1707783660752000000',
    asDouble: 0.03703703703703709,
    attributes: { 'system.cpu.logical_number': '13' }
  },
  {
    startTimeUnixNano: '1707783660752000000',
    timeUnixNano: '1707783660752000000',
    asDouble: 0.03703703703703709,
    attributes: { 'system.cpu.logical_number': '14' }
  },
  {
    startTimeUnixNano: '1707783660752000000',
    timeUnixNano: '1707783660752000000',
    asDouble: -0.03703703703703698,
    attributes: { 'system.cpu.logical_number': '15' }
  }
]
ok 5 "system.cpu.utilization" data points have a value between 0-1
david-luna commented 9 months ago
  {
    "startTimeUnixNano": "1707783660752000000",
    "timeUnixNano": "1707783660752000000",
    "asDouble": -0.03703703703703698,
    "attributes": { "system.cpu.logical_number": "11" }
  }

the value comes from this calculation https://github.com/elastic/elastic-otel-node/blob/08d36971a4fc756eb0906eb039c74bb543d6dfd0/packages/opentelemetry-node/lib/metrics/host.js#L199

Since its based on "latest value accumulation" accumulation.toPointValue() should be a value within [0, 1] range unless the calculation in @opentelemetry/host-metrics reports a value bigger than 1. If so the root cause could be:

trentm commented 8 months ago

A few failures recently:

https://github.com/elastic/elastic-otel-node/actions/runs/8283520405/job/22666882953

 not ok 11 "system.cpu.utilization" data points have a value between 0-1
  ---
    operator: ok
    expected: true
    actual:   false
    at: <anonymous> (/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/host-metrics.test.js:50:19)
    stack: |-
      Error: "system.cpu.utilization" data points have a value between 0-1
          at Test.assert [as _assert] (/home/runner/work/elastic-otel-node/elastic-otel-node/node_modules/tape/lib/test.js:493:48)
          at Test.assert (/home/runner/work/elastic-otel-node/elastic-otel-node/node_modules/tape/lib/test.js:626:7)
          at /home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/host-metrics.test.js:50:19
          at Array.forEach (<anonymous>)
          at Object.checkTelemetry (/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/host-metrics.test.js:42:35)
          at done (/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/testutils.js:504:42)
          at ChildProcess.exithandler (child_process.js:374:7)
          at ChildProcess.emit (events.js:400:28)
          at maybeClose (internal/child_process.js:1088:16)
          at Process.ChildProcess._handle.onexit (internal/child_process.js:296:5)
  ...
# cpuUtilizationMetrics: [{"name":"system.cpu.utilization","description":"Cpu usage time 0-1","unit":"","gauge":{"dataPoints":[{"startTimeUnixNano":"1710430795147000000","timeUnixNano":"1710430795147000000","asDouble":0.5302013422818792,"attributes":{"system.cpu.logical_number":"0"}},{"startTimeUnixNano":"1710430795147000000","timeUnixNano":"1710430795147000000","asDouble":1,"attributes":{"system.cpu.logical_number":"1"}}]},"resource":{"attributes":{"service.name":"unknown_service:/opt/hostedtoolcache/node/14.21.3/x64/bin/node","telemetry.sdk.language":"nodejs","telemetry.sdk.name":"opentelemetry","telemetry.sdk.version":"1.21.0","telemetry.distro.name":"elastic","telemetry.distro.version":"0.1.0","process.pid":1748,"process.executable.name":"/opt/hostedtoolcache/node/14.21.3/x64/bin/node","process.executable.path":"/opt/hostedtoolcache/node/14.21.3/x64/bin/node","process.command_args":["/opt/hostedtoolcache/node/14.21.3/x64/bin/node","/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/fixtures/use-host-metrics.js"],"process.runtime.version":"14.21.3","process.runtime.name":"nodejs","process.runtime.description":"Node.js","process.command":"/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/fixtures/use-host-metrics.js","process.owner":"runner","host.name":"fv-az1544-337","host.arch":"amd64","host.id":"4032deb8fc5b44aea8eb43f74071a459"},"droppedAttributesCount":0},"scope":{"name":"@opentelemetry/host-metrics","version":"0.35.0"}}]

https://github.com/elastic/elastic-otel-node/actions/runs/8283520405/job/22666880323

 not ok 11 "system.cpu.utilization" data points have a value between 0-1
  ---
    operator: ok
    expected: true
    actual:   false
    at: <anonymous> (/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/host-metrics.test.js:50:19)
    stack: |-
      Error: "system.cpu.utilization" data points have a value between 0-1
          at Test.assert [as _assert] (/home/runner/work/elastic-otel-node/elastic-otel-node/node_modules/tape/lib/test.js:493:48)
          at Test.assert (/home/runner/work/elastic-otel-node/elastic-otel-node/node_modules/tape/lib/test.js:626:7)
          at /home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/host-metrics.test.js:50:19
          at Array.forEach (<anonymous>)
          at Object.checkTelemetry (/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/host-metrics.test.js:42:35)
          at done (/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/testutils.js:504:42)
          at ChildProcess.exithandler (node:child_process:414:7)
          at ChildProcess.emit (node:events:515:28)
          at maybeClose (node:internal/child_process:1105:16)
          at ChildProcess._handle.onexit (node:internal/child_process:305:5)
  ...
# cpuUtilizationMetrics: [{"name":"system.cpu.utilization","description":"Cpu usage time 0-1","unit":"","gauge":{"dataPoints":[{"startTimeUnixNano":"1710430794273000000","timeUnixNano":"1710430794273000000","asDouble":0.7183098591549295,"attributes":{"system.cpu.logical_number":"0"}},{"startTimeUnixNano":"1710430794273000000","timeUnixNano":"1710430794273000000","asDouble":1,"attributes":{"system.cpu.logical_number":"1"}}]},"resource":{"attributes":{"service.name":"unknown_service:/opt/hostedtoolcache/node/21.0.0/x64/bin/node","telemetry.sdk.language":"nodejs","telemetry.sdk.name":"opentelemetry","telemetry.sdk.version":"1.21.0","telemetry.distro.name":"elastic","telemetry.distro.version":"0.1.0","process.pid":1966,"process.executable.name":"/opt/hostedtoolcache/node/21.0.0/x64/bin/node","process.executable.path":"/opt/hostedtoolcache/node/21.0.0/x64/bin/node","process.command_args":["/opt/hostedtoolcache/node/21.0.0/x64/bin/node","/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/fixtures/use-host-metrics.js"],"process.runtime.version":"21.0.0","process.runtime.name":"nodejs","process.runtime.description":"Node.js","process.command":"/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/fixtures/use-host-metrics.js","process.owner":"runner","host.name":"fv-az1499-753","host.arch":"amd64","host.id":"4032deb8fc5b44aea8eb43f74071a459"},"droppedAttributesCount":0},"scope":{"name":"@opentelemetry/host-metrics","version":"0.35.0"}}]

etc.

In all the failrues cases so far, I see asDouble: 1. So updating the test to <=1 should help there.

I don't know about the negative values I was seeing earlier.

trentm commented 7 months ago

As predicted (comment message includes The <=0 test might make this flaky again.) here is the first failure with a value less than zero:

https://github.com/elastic/elastic-otel-node/actions/runs/8367644696/job/22910407248?pr=92

 not ok 11 "system.cpu.utilization" data points are in the range [0,1]
  ---
    operator: ok
    expected: true
    actual:   false
    at: <anonymous> (/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/host-metrics.test.js:50:19)
    stack: |-
      Error: "system.cpu.utilization" data points are in the range [0,1]
          at Test.assert [as _assert] (/home/runner/work/elastic-otel-node/elastic-otel-node/node_modules/tape/lib/test.js:493:48)
          at Test.assert (/home/runner/work/elastic-otel-node/elastic-otel-node/node_modules/tape/lib/test.js:626:7)
          at /home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/host-metrics.test.js:50:19
          at Array.forEach (<anonymous>)
          at Object.checkTelemetry (/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/host-metrics.test.js:42:35)
          at done (/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/testutils.js:529:42)
          at ChildProcess.exithandler (node:child_process:379:7)
          at ChildProcess.emit (node:events:527:28)
          at maybeClose (node:internal/child_process:1090:16)
          at ChildProcess._handle.onexit (node:internal/child_process:302:5)
  ...
# cpuUtilizationMetrics: [{"name":"system.cpu.utilization","description":"Cpu usage time 0-1","unit":"","gauge":{"dataPoints":[{"startTimeUnixNano":"1710980320272000000","timeUnixNano":"1710980320272000000","asDouble":-0.021897810218978186,"attributes":{"system.cpu.logical_number":"0"}},{"startTimeUnixNano":"1710980320272000000","timeUnixNano":"1710980320272000000","asDouble":0.34306569343065696,"attributes":{"system.cpu.logical_number":"1"}}]},"resource":{"attributes":{"service.name":"unknown_service:/opt/hostedtoolcache/node/18.0.0/x64/bin/node","telemetry.sdk.language":"nodejs","telemetry.sdk.name":"opentelemetry","telemetry.sdk.version":"1.22.0","telemetry.distro.name":"elastic","telemetry.distro.version":"0.1.0","process.pid":1801,"process.executable.name":"/opt/hostedtoolcache/node/18.0.0/x64/bin/node","process.executable.path":"/opt/hostedtoolcache/node/18.0.0/x64/bin/node","process.command_args":["/opt/hostedtoolcache/node/18.0.0/x64/bin/node","/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/fixtures/use-host-metrics.js"],"process.runtime.version":"18.0.0","process.runtime.name":"nodejs","process.runtime.description":"Node.js","process.command":"/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/fixtures/use-host-metrics.js","process.owner":"runner","host.name":"fv-az561-3","host.arch":"amd64","host.id":"10b5fd95e1d84aa893af9c74a079a8cb"},"droppedAttributesCount":0},"scope":{"name":"@opentelemetry/host-metrics","version":"0.35.0"}}]

Specifically that first data point:

{"startTimeUnixNano":"1710980320272000000","timeUnixNano":"1710980320272000000","asDouble":-0.021897810218978186,"attributes":{"system.cpu.logical_number":"0"}}
trentm commented 7 months ago

Failure again today:

https://github.com/elastic/elastic-otel-node/actions/runs/8381995568/job/22954809284?pr=93

 not ok 11 "system.cpu.utilization" data points are in the range [0,1]
  ---
    operator: ok
    expected: true
    actual:   false
    at: <anonymous> (/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/host-metrics.test.js:50:19)
    stack: |-
      Error: "system.cpu.utilization" data points are in the range [0,1]
          at Test.assert [as _assert] (/home/runner/work/elastic-otel-node/elastic-otel-node/node_modules/tape/lib/test.js:493:48)
          at Test.assert (/home/runner/work/elastic-otel-node/elastic-otel-node/node_modules/tape/lib/test.js:626:7)
          at /home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/host-metrics.test.js:50:19
          at Array.forEach (<anonymous>)
          at Object.checkTelemetry (/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/host-metrics.test.js:42:35)
          at done (/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/testutils.js:530:42)
          at ChildProcess.exithandler (node:child_process:414:7)
          at ChildProcess.emit (node:events:517:28)
          at maybeClose (node:internal/child_process:1098:16)
          at ChildProcess._handle.onexit (node:internal/child_process:303:5)
  ...
# cpuUtilizationMetrics: [{"name":"system.cpu.utilization","description":"Cpu usage time 0-1","unit":"","gauge":{"dataPoints":[{"startTimeUnixNano":"1711056577349000000","timeUnixNano":"1711056577349000000","asDouble":-0.007194244604316502,"attributes":{"system.cpu.logical_number":"0"}},{"startTimeUnixNano":"1711056577349000000","timeUnixNano":"1711056577349000000","asDouble":0.3525179856115108,"attributes":{"system.cpu.logical_number":"1"}}]},"resource":{"attributes":{"service.name":"unknown_service:/opt/hostedtoolcache/node/18.18.2/x64/bin/node","telemetry.sdk.language":"nodejs","telemetry.sdk.name":"opentelemetry","telemetry.sdk.version":"1.22.0","telemetry.distro.name":"elastic","telemetry.distro.version":"0.1.0","process.pid":1795,"process.executable.name":"/opt/hostedtoolcache/node/18.18.2/x64/bin/node","process.executable.path":"/opt/hostedtoolcache/node/18.18.2/x64/bin/node","process.command_args":["/opt/hostedtoolcache/node/18.18.2/x64/bin/node","/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/fixtures/use-host-metrics.js"],"process.runtime.version":"18.18.2","process.runtime.name":"nodejs","process.runtime.description":"Node.js","process.command":"/home/runner/work/elastic-otel-node/elastic-otel-node/packages/opentelemetry-node/test/fixtures/use-host-metrics.js","process.owner":"runner","host.name":"fv-az593-813","host.arch":"amd64","host.id":"10b5fd95e1d84aa893af9c74a079a8cb"},"droppedAttributesCount":0},"scope":{"name":"@opentelemetry/host-metrics","version":"0.35.0"}}]
trentm commented 7 months ago

FWIW, I hit this different failure in host-metrics.test.js running locally:

% npm test

> @elastic/opentelemetry-node@0.1.0 test
> tape test/**/*.test.js

TAP version 13
# agent metadata
# agent metadata default case
{"name":"mockotlpserver","level":30,"msg":"OTLP/HTTP listening at http://127.0.0.1:49948/","time":"2024-03-21T22:13:16.100Z"}
ok 1 exited successfully: err=null
ok 2 should be strictly equal
ok 3 should be strictly equal
ok 4 should be truthy
ok 5 should be strictly equal
ok 6 should be strictly equal
# host metrics
# host metrics default views
{"name":"mockotlpserver","level":30,"msg":"OTLP/HTTP listening at http://127.0.0.1:49951/","time":"2024-03-21T22:13:16.833Z"}
ok 7 exited successfully: err=null
/Users/trentm/el/elastic-otel-node3/packages/opentelemetry-node/test/testutils.js:300
                resourceMetric.scopeMetrics.forEach((scopeMetric) => {
                                            ^

TypeError: Cannot read properties of undefined (reading 'forEach')
    at /Users/trentm/el/elastic-otel-node3/packages/opentelemetry-node/test/testutils.js:300:45
    at Array.forEach (<anonymous>)
    at /Users/trentm/el/elastic-otel-node3/packages/opentelemetry-node/test/testutils.js:299:40
    at Array.forEach (<anonymous>)
    at get metrics [as metrics] (/Users/trentm/el/elastic-otel-node3/packages/opentelemetry-node/test/testutils.js:297:25)
    at Object.checkTelemetry (/Users/trentm/el/elastic-otel-node3/packages/opentelemetry-node/test/host-metrics.test.js:23:39)
    at done (/Users/trentm/el/elastic-otel-node3/packages/opentelemetry-node/test/testutils.js:504:42)
    at ChildProcess.exithandler (node:child_process:414:7)
    at ChildProcess.emit (node:events:517:28)
    at maybeClose (node:internal/child_process:1098:16)

Node.js v18.18.2
npm ERR! Lifecycle script `test` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: @elastic/opentelemetry-node@0.1.0
npm ERR!   at location: /Users/trentm/el/elastic-otel-node3/packages/opentelemetry-node
trentm commented 7 months ago

And running locally I'm reproducing this error frequently (almost every run):

not ok 11 "system.cpu.utilization" data points are in the range [0,1]
  ---
    operator: ok
    expected: true
    actual:   false
    at: <anonymous> (/Users/trentm/el/elastic-otel-node3/packages/opentelemetry-node/test/host-metrics.test.js:50:19)
    stack: |-
      Error: "system.cpu.utilization" data points are in the range [0,1]
          at Test.assert [as _assert] (/Users/trentm/el/elastic-otel-node3/node_modules/tape/lib/test.js:493:48)
          at Test.assert (/Users/trentm/el/elastic-otel-node3/node_modules/tape/lib/test.js:626:7)
          at /Users/trentm/el/elastic-otel-node3/packages/opentelemetry-node/test/host-metrics.test.js:50:19
          at Array.forEach (<anonymous>)
          at Object.checkTelemetry (/Users/trentm/el/elastic-otel-node3/packages/opentelemetry-node/test/host-metrics.test.js:42:35)
          at done (/Users/trentm/el/elastic-otel-node3/packages/opentelemetry-node/test/testutils.js:504:42)
          at ChildProcess.exithandler (node:child_process:414:7)
          at ChildProcess.emit (node:events:517:28)
          at maybeClose (node:internal/child_process:1098:16)
          at Socket.<anonymous> (node:internal/child_process:450:11)
  ...
# cpuUtilizationMetrics: [{"name":"system.cpu.utilization","description":"Cpu usage time 0-1","unit":"","gauge":{"dataPoints":[{"startTimeUnixNano":"1711059318830000000","timeUnixNano":"1711059318830000000","asDouble":0.2753623188405797,"attributes":{"system.cpu.logical_number":"0"}},{"startTimeUnixNano":"1711059318830000000","timeUnixNano":"1711059318830000000","asDouble":-0.01449275362318847,"attributes":{"system.cpu.logical_number":"1"}},{"startTimeUnixNano":"1711059318830000000","timeUnixNano":"1711059318830000000","asDouble":0.42028985507246375,"attributes":{"system.cpu.logical_number":"2"}},{"startTimeUnixNano":"1711059318830000000","timeUnixNano":"1711059318830000000","asDouble":0.05797101449275366,"attributes":{"system.cpu.logical_number":"3"}},{"startTimeUnixNano":"1711059318830000000","timeUnixNano":"1711059318830000000","asDouble":0.2028985507246377,"attributes":{"system.cpu.logical_number":"4"}},{"startTimeUnixNano":"1711059318830000000","timeUnixNano":"1711059318830000000","asDouble":-0.01449275362318847,"attributes":{"system.cpu.logical_number":"5"}},{"startTimeUnixNano":"1711059318830000000","timeUnixNano":"1711059318830000000","asDouble":0.05797101449275366,"attributes":{"system.cpu.logical_number":"6"}},{"startTimeUnixNano":"1711059318830000000","timeUnixNano":"1711059318830000000","asDouble":-0.01449275362318847,"attributes":{"system.cpu.logical_number":"7"}},{"startTimeUnixNano":"1711059318830000000","timeUnixNano":"1711059318830000000","asDouble":0.2753623188405797,"attributes":{"system.cpu.logical_number":"8"}},{"startTimeUnixNano":"1711059318830000000","timeUnixNano":"1711059318830000000","asDouble":-0.01449275362318847,"attributes":{"system.cpu.logical_number":"9"}},{"startTimeUnixNano":"1711059318830000000","timeUnixNano":"1711059318830000000","asDouble":-0.01449275362318847,"attributes":{"system.cpu.logical_number":"10"}},{"startTimeUnixNano":"1711059318830000000","timeUnixNano":"1711059318830000000","asDouble":0.05797101449275366,"attributes":{"system.cpu.logical_number":"11"}},{"startTimeUnixNano":"1711059318830000000","timeUnixNano":"1711059318830000000","asDouble":0.05797101449275366,"attributes":{"system.cpu.logical_number":"12"}},{"startTimeUnixNano":"1711059318830000000","timeUnixNano":"1711059318830000000","asDouble":-0.01449275362318847,"attributes":{"system.cpu.logical_number":"13"}},{"startTimeUnixNano":"1711059318830000000","timeUnixNano":"1711059318830000000","asDouble":0.05797101449275366,"attributes":{"system.cpu.logical_number":"14"}},{"startTimeUnixNano":"1711059318830000000","timeUnixNano":"1711059318830000000","asDouble":-0.01449275362318847,"attributes":{"system.cpu.logical_number":"15"}}]},"resource":{"attributes":{"service.name":"unknown_service:/Users/trentm/.nvm/versions/node/v18.18.2/bin/node","telemetry.sdk.language":"nodejs","telemetry.sdk.name":"opentelemetry","telemetry.sdk.version":"1.22.0","telemetry.distro.name":"elastic","telemetry.distro.version":"0.1.0","process.pid":96204,"process.executable.name":"/Users/trentm/.nvm/versions/node/v18.18.2/bin/node","process.executable.path":"/Users/trentm/.nvm/versions/node/v18.18.2/bin/node","process.command_args":["/Users/trentm/.nvm/versions/node/v18.18.2/bin/node","/Users/trentm/el/elastic-otel-node3/packages/opentelemetry-node/test/fixtures/use-host-metrics.js"],"process.runtime.version":"18.18.2","process.runtime.name":"nodejs","process.runtime.description":"Node.js","process.command":"/Users/trentm/el/elastic-otel-node3/packages/opentelemetry-node/test/fixtures/use-host-metrics.js","process.owner":"trentm","host.name":"pink.local","host.arch":"amd64","host.id":"DF529BD4-274A-53F1-A84E-7F85AFD59258"},"droppedAttributesCount":0},"scope":{"name":"@opentelemetry/host-metrics","version":"0.35.0"}}]

This is unusable locally.

david-luna commented 6 months ago

Update: the aggregation on system.cpu.utilization metric has been removed in https://github.com/elastic/elastic-otel-node/pull/139 but we still get this test failing.

This happened because @opentelemetry/host-metrics package reported utilisation values above 1 which shouldn't happen. We should fix it there.