Skip to content

Commit 0d92152

Browse files
author
naseemkullah
committed
fix: use globalErrorHandler
Signed-off-by: naseemkullah <[email protected]>
1 parent 71781ec commit 0d92152

File tree

2 files changed

+12
-8
lines changed
  • packages

2 files changed

+12
-8
lines changed

packages/opentelemetry-exporter-collector-grpc/src/util.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,19 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { diag } from '@opentelemetry/api';
17+
import * as grpc from '@grpc/grpc-js';
1818
import * as protoLoader from '@grpc/proto-loader';
19+
import { diag } from '@opentelemetry/api';
20+
import { globalErrorHandler } from '@opentelemetry/core';
1921
import { collectorTypes } from '@opentelemetry/exporter-collector';
20-
import * as grpc from '@grpc/grpc-js';
2122
import * as path from 'path';
22-
23+
import { CollectorExporterNodeBase } from './CollectorExporterNodeBase';
2324
import {
2425
CollectorExporterConfigNode,
2526
GRPCQueueItem,
26-
ServiceClientType,
27+
ServiceClientType
2728
} from './types';
28-
import { CollectorExporterNodeBase } from './CollectorExporterNodeBase';
29+
2930

3031
export function onInit<ExportItem, ServiceRequest>(
3132
collector: CollectorExporterNodeBase<ExportItem, ServiceRequest>,
@@ -38,7 +39,6 @@ export function onInit<ExportItem, ServiceRequest>(
3839

3940
const includeDirs = [path.resolve(__dirname, '..', 'protos')];
4041

41-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
4242
protoLoader
4343
.load(collector.getServiceProtoPath(), {
4444
keepCase: false,
@@ -69,6 +69,9 @@ export function onInit<ExportItem, ServiceRequest>(
6969
collector.send(item.objects, item.onSuccess, item.onError);
7070
});
7171
}
72+
})
73+
.catch(err => {
74+
globalErrorHandler(err);
7275
});
7376
}
7477

packages/opentelemetry-metrics/src/export/Controller.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ export class PushController extends Controller {
3737
) {
3838
super();
3939
this._timer = setInterval(() => {
40-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
41-
this._collect();
40+
this._collect().catch(err => {
41+
globalErrorHandler(err);
42+
});
4243
}, interval);
4344
unrefTimer(this._timer);
4445
}

0 commit comments

Comments
 (0)