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: experimental metrics middleware should use the grpc message constructor name in emitted metrics instead of MiddlewareMessage #993

Merged
merged 6 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export abstract class ExperimentalMetricsMiddlewareRequestHandler

onRequestBody(request: MiddlewareMessage): Promise<MiddlewareMessage> {
this.requestSize = request.messageLength();
this.requestType = request.constructor.name;
this.requestType = request._grpcMessage.constructor.name;
this.requestBodyTime = new Date().getTime();
return Promise.resolve(request);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export class MiddlewareMessage {
}

messageLength(): number {
return this._grpcMessage.serializeBinary().length;
if (this._grpcMessage !== null && this._grpcMessage !== undefined) {
return this._grpcMessage.serializeBinary().length;
}
return 0;
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/client-sdk-nodejs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export {

export {ExperimentalRequestLoggingMiddleware} from './config/middleware/experimental-request-logging-middleware';
export {ExperimentalMetricsCsvMiddleware} from './config/middleware/experimental-metrics-csv-middleware';
export {ExperimentalMetricsLoggingMiddleware} from './config/middleware/experimental-metrics-logging-middleware';
export {ExampleAsyncMiddleware} from './config/middleware/example-async-middleware';

export {
Expand Down
Loading