opentelemetry-js-contrib
opentelemetry-js-contrib copied to clipboard
@opentelemetry/host-metrics doesn't work on arm64 machine, working fine on amd
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
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!
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
Node 14 doesn't support it, works fine on Node 16 and later versions on arm machines as well