Skip to content

Commit

Permalink
fix: use globalErrorHandler
Browse files Browse the repository at this point in the history
Signed-off-by: naseemkullah <[email protected]>
  • Loading branch information
naseemkullah committed Apr 13, 2021
1 parent 71781ec commit d3306d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
15 changes: 9 additions & 6 deletions packages/opentelemetry-exporter-collector-grpc/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@
* limitations under the License.
*/

import { diag } from '@opentelemetry/api';
import * as grpc from '@grpc/grpc-js';
import * as protoLoader from '@grpc/proto-loader';
import { diag } from '@opentelemetry/api';
import { globalErrorHandler } from '@opentelemetry/core';
import { collectorTypes } from '@opentelemetry/exporter-collector';
import * as grpc from '@grpc/grpc-js';
import * as path from 'path';

import { CollectorExporterNodeBase } from './CollectorExporterNodeBase';
import {
CollectorExporterConfigNode,
GRPCQueueItem,
ServiceClientType,
ServiceClientType
} from './types';
import { CollectorExporterNodeBase } from './CollectorExporterNodeBase';


export function onInit<ExportItem, ServiceRequest>(
collector: CollectorExporterNodeBase<ExportItem, ServiceRequest>,
Expand All @@ -38,7 +39,6 @@ export function onInit<ExportItem, ServiceRequest>(

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

// eslint-disable-next-line @typescript-eslint/no-floating-promises
protoLoader
.load(collector.getServiceProtoPath(), {
keepCase: false,
Expand Down Expand Up @@ -69,6 +69,9 @@ export function onInit<ExportItem, ServiceRequest>(
collector.send(item.objects, item.onSuccess, item.onError);
});
}
})
.catch(err => {
globalErrorHandler(err);
});
}

Expand Down
3 changes: 1 addition & 2 deletions packages/opentelemetry-metrics/src/export/Controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ export class PushController extends Controller {
) {
super();
this._timer = setInterval(() => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this._collect();
this._collect().catch(err => {globalErrorHandler(err)});
}, interval);
unrefTimer(this._timer);
}
Expand Down

0 comments on commit d3306d6

Please sign in to comment.