opentelemetry-js-contrib icon indicating copy to clipboard operation
opentelemetry-js-contrib copied to clipboard

@opentelemetry/host-metrics doesn't work on arm64 machine, working fine on amd

Open architgarg95 opened this issue 10 months ago • 2 comments

What version of OpenTelemetry are you using?

0.50.0

What version of Node are you using?

14.17.6

What did you do?

added auto-instrumentation-node with http and express enabled added host-metrics instrumentation as provided in the docs

What did you expect to see?

expected to see the host metrics like system_cpu_utilisation etc. in prometheus

What did you see instead?

can't see any host metrics at all, only available metrics are http ones

Additional context

This is happening on an arm64 machine, on the amd machine its working fine I can see the metrics of that machine in prometheus

architgarg95 avatar Apr 17 '24 13:04 architgarg95

Hi @architgarg95

would you mind to share

  • the instrumentation code
  • how do you start the SDK (code inlined in the main file, using --require, ...)
  • if you're using any kind of bundler

Thanks!

david-luna avatar Apr 17 '24 14:04 david-luna

Hi @david-luna ,

I have the instrumentation code inlined in the main file, please find below the code:


const { NodeSDK } = require('@opentelemetry/sdk-node');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const { ExpressLayerType } = require('@opentelemetry/instrumentation-express');
const instrumentations = getNodeAutoInstrumentations({
  '@opentelemetry/instrumentation-fs': {enabled: false},
  '@opentelemetry/instrumentation-http': {
    enabled: true,
    responseHook: (span, info) => {
      span.updateName(`${info.req.method} ${info.req.path || ''}`);
    }
  },
  '@opentelemetry/instrumentation-express': {
    enabled: true,
    ignoreLayersType: [ExpressLayerType.MIDDLEWARE, ExpressLayerType.ROUTER, ExpressLayerType.REQUEST_HANDLER],
    spanNameHook: ({request}) => {
      return `${request.method} ${request.path || ''}`
    }
  },
  '@opentelemetry/instrumentation-aws-sdk': {enabled: true},
  '@opentelemetry/instrumentation-winston': {enabled: true}
});

const { PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');
const { Resource } = require('@opentelemetry/resources');
const { SEMRESATTRS_SERVICE_NAME, SEMRESATTRS_DEPLOYMENT_ENVIRONMENT } = require('@opentelemetry/semantic-conventions');
const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin');
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-grpc');
const { RuntimeNodeInstrumentation } = require('@opentelemetry/instrumentation-runtime-node');

const resource = new Resource({
  [SEMRESATTRS_SERVICE_NAME]: {app_name},
  [SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: process.env.NODE_ENV,
});

const metricProvider = new PeriodicExportingMetricReader({
  exporter: new OTLPMetricExporter({
    url: ""
  })
});

const sdk = new NodeSDK({
  resource: resource,
  traceExporter: new ZipkinExporter({
    url: ""
  }),
  metricReader: metricProvider,
  instrumentations: [instrumentations
    new RuntimeNodeInstrumentation({
      eventLoopUtilizationMeasurementInterval: 5000,
    })
  ]
});


sdk.start();

const { HostMetrics } = require('@opentelemetry/host-metrics');
const hostMetrics = new HostMetrics({ metricProvider, name: {app_name} });
hostMetrics.start();

Note: Not using any bundler

architgarg95 avatar Apr 18 '24 12:04 architgarg95

Node 14 doesn't support it, works fine on Node 16 and later versions on arm machines as well

architgarg95 avatar May 27 '24 12:05 architgarg95