Description
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 below
TypeError: 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
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);
Below how the error looks like from terminal.
TypeError: timer.unref is not a function
97 |
98 | private provider = new WebTracerProvider(this.providerConfig);
> 99 | private meterProvider = new MeterProvider(this.providerConfig);
package.json
"@opentelemetry/exporter-metrics-otlp-http": "^0.49.1",
"@opentelemetry/sdk-metrics": "^1.22.0"
Relevant log output
TypeError: timer.unref is not a function
97 |
98 | private provider = new WebTracerProvider(this.providerConfig);
> 99 | private meterProvider = new MeterProvider(this.providerConfig);