Skip to content

Commit c43f172

Browse files
cjihrigpichlermarc
andauthored
feat(instrumentation-grpc): monitor error events with events.errorMonitor (open-telemetry#5369)
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
1 parent bdc0e3a commit c43f172

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

experimental/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ All notable changes to experimental packages in this project will be documented
2323

2424
### :bug: (Bug Fix)
2525

26+
* fix(instrumentation-grpc): monitor error events with events.errorMonitor [#5369](https://github.com/open-telemetry/opentelemetry-js/pull/5369) @cjihrig
2627
* fix(exporter-metrics-otlp-http): browser OTLPMetricExporter was not passing config to OTLPMetricExporterBase super class [#5331](https://github.com/open-telemetry/opentelemetry-js/pull/5331) @trentm
2728

2829
### :books: (Refine Doc)

experimental/packages/opentelemetry-instrumentation-grpc/src/serverUtils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
* error event should be processed.
2121
*/
2222

23+
import { errorMonitor } from 'node:events';
24+
2325
import type {
2426
ClientReadableStream,
2527
handleBidiStreamingCall,
@@ -86,7 +88,7 @@ function serverStreamAndBidiHandler<RequestType, ResponseType>(
8688
endSpan();
8789
});
8890

89-
call.on('error', (err: ServiceError) => {
91+
call.on(errorMonitor, (err: ServiceError) => {
9092
if (call[CALL_SPAN_ENDED]) {
9193
return;
9294
}

experimental/packages/opentelemetry-instrumentation-grpc/test/helper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ export const runTests = (
395395
bidiStream.write(element);
396396
});
397397

398+
assert.strictEqual(bidiStream.listenerCount('error'), 0);
398399
bidiStream.on('error', (err: ServiceError) => {
399400
reject(err);
400401
});

0 commit comments

Comments
 (0)