-
Notifications
You must be signed in to change notification settings - Fork 814
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
TypeError: timer.unref is not a function #4535
Comments
Do you call |
@pichlermarc Do you call MeterProvider.shutdown() when the tests are done? >>> NO |
@pichlermarc can you please help in identify this issue. As i could not make out if this issue coming from metrics library or is there something wrong i am doing it. |
The reason is that we currently don't set the browser overrides in a way that jest can deal with them, it only works for webpack and some other bundlers. See
So it's not something you're doing wrong, but testing in jest like this is a case we currently don't support. That being said #4543 is now up-for-grabs in case someone has cycles to work on it. |
thank you so much for help @pichlermarc BTW in the future upcoming versions, can this error go away without mocking metrics library. |
I believe this can be closed in favor of #4543 |
@iemjitendra, yes we hope to address this with #4543, which should take care of that. I'll close this issue as duplicate for now as the other one is more explicit about what we need to do. |
What happened?
Steps to Reproduce
As per latest open telemetry metrics version, they mentioned to access addMetricReader through constructor. i tried to did the same with below example.
private metricsCollectorOptions = {
url: xx,
headers: {},
};
private metricExporter = new OTLPMetricExporter(this.metricsCollectorOptions);
private providerConfig = {
resource: new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: xx,
[SemanticResourceAttributes.SERVICE_NAMESPACE]: xx,
[SemanticResourceAttributes.SERVICE_INSTANCE_ID]: xx,
[SemanticResourceAttributes.SERVICE_VERSION]: xx,
[SemanticResourceAttributes.DEVICE_MODEL_IDENTIFIER]:xx,
}),
readers: [
new PeriodicExportingMetricReader({exporter: this.metricExporter}),
],
};
private meterProvider = new MeterProvider(this.providerConfig);
BUT i am facing error while running existing specific test file by writing
yarn test xx.test.js
even though i did not write any specific test cases for metrics. the error is appeared as belowTypeError: timer.unref is not a function >>> this error is referring to above line
new MeterProvider(this.providerConfig)
i am using below versions
"@opentelemetry/exporter-metrics-otlp-http": "^0.49.1",
"@opentelemetry/sdk-metrics": "^1.22.0"
Please let me know how can i fix it.
PS: the implementation of metric feature is working as expected with latest changes. but the yarn test is blocker for me.
Expected Result
The existing test cases should continue to pass as i still didn't mention or write new test cases for metrics.
Actual Result
i am getting TypeError: timer.unref is not a function for new MeterProvider() when i am using readers config with in it.
Additional Details
OpenTelemetry Setup Code
package.json
Relevant log output
The text was updated successfully, but these errors were encountered: