Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
architgarg95 opened this issue Apr 17, 2024 · 2 comments
Labels
bug Something isn't working pkg:host-metrics priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect

Comments

@architgarg95
Copy link

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 architgarg95 added the bug Something isn't working label Apr 17, 2024
@david-luna
Copy link
Contributor

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!

@pichlermarc pichlermarc added priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect pkg:host-metrics labels Apr 17, 2024
@architgarg95
Copy link
Author

architgarg95 commented Apr 18, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg:host-metrics priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect
Projects
None yet
Development

No branches or pull requests

3 participants