Skip to content
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

fix(otlp-grpc-exporter-base): avoid TypeError on exporter shutdown #4612

Prev Previous commit
Next Next commit
fix: use gRPC Client type over any
pichlermarc committed Apr 11, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit b4dbd9301696f67967797222452b8d51438cb2bf
Original file line number Diff line number Diff line change
@@ -16,7 +16,12 @@

// NOTE: do not change these type imports to actual imports. Doing so WILL break `@opentelemetry/instrumentation-http`,
// as they'd be imported before the http/https modules can be wrapped.
import type { Metadata, ServiceError, ChannelCredentials } from '@grpc/grpc-js';
import type {
Metadata,
ServiceError,
ChannelCredentials,
Client,
} from '@grpc/grpc-js';
import { ExportResponse } from './export-response';
import { IExporterTransport } from './exporter-transport';

@@ -85,7 +90,7 @@ export interface GrpcExporterTransportParameters {
}

export class GrpcExporterTransport implements IExporterTransport {
private _client?: any;
private _client?: Client;
private _metadata?: Metadata;

constructor(private _parameters: GrpcExporterTransportParameters) {}
@@ -150,7 +155,8 @@ export class GrpcExporterTransport implements IExporterTransport {
});
}

this._client.export(
// Using `any` as the gRPC client constructor is created on runtime, so we don't have any types for it.
(this._client as any).export(
buffer,
this._metadata,
{ deadline: deadline },