-
Notifications
You must be signed in to change notification settings - Fork 546
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
MetricReader is not bound to a MetricProducer #1014
Comments
Digging a bit, I think it relates to #983 |
Metrics API is still experimental and we are working to adopt the latest metrics spec changes towards GA. From @opentelemetry/sdk-metrics-base v0.28.0, you'll need to apply the following changes the get the example in the OP working: const exporter = new PrometheusExporter(
{
startServer: true
}, () => {
console.log('prometheus scrape endpoint: http://localhost:9464/metrics')
}
)
const meterProvider = new MeterProvider({
- exporter,
- interval: 2000
})
+ meterProvider.addMetricReader(exporter); And the @opentelemetry/host-metrics that are compatible with sdk-metrics-base v0.28.0 is pending release: #947 |
Applying your suggestion leads to:
My versions
Should I wait for @opentelemetry/host-metrics v0.28? |
yes |
Is there any release plan? |
I'm cutting a release today sorry. The release automation failed while we were at kubecon and i'm looking into it |
Is there any updates?, I still get the same error even with @opentelemetry/host-metrics v0.28 |
I will get the chance to test it by my side on the next days |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
@Eomm any update on if this is still an issue? |
Just tried the doc example but same error for me by using node v16.x: https://www.npmjs.com/package/@opentelemetry/host-metrics Switching to node.js v18.6.0 I get the same: I wonder if it is an OS issue (I'm using mac os) Deps:
|
Would you mind updating the dependency |
Sure, but.. the same result. I have
Here the code I'm running: Click to expand!
|
Sorry but you have to apply the patch mentioned at #1014 (comment) too. |
Yeah, I did it, but I keep getting the
|
Sorry, it's not const { MeterProvider } = require('@opentelemetry/sdk-metrics');
const { HostMetrics } = require('@opentelemetry/host-metrics');
const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus');
const exporter = new PrometheusExporter(
{
startServer: true
}, () => {
console.log('prometheus scrape endpoint: http://localhost:9464/metrics')
}
)
const meterProvider = new MeterProvider()
meterProvider.addMetricReader(exporter)
const hostMetrics = new HostMetrics({ meterProvider, name: 'example-host-metrics' })
hostMetrics.start() |
Thanks, it works! |
What version of OpenTelemetry are you using?
What version of Node are you using?
v16.13.0
What did you do?
What did you expect to see?
Host metrics
What did you see instead?
By reaching the URL: http://localhost:9464/metrics
I get:
Additional context
I was trying to add the HostMetrics to the opentelemetry.NodeSDK component, but unsuccessfully. So I tried the basic example, and I get the same error.
The text was updated successfully, but these errors were encountered: