Skip to content

otelcol/grpclog: suppress benign gRPC client-disconnect warnings#15024

Open
kruthiwusirika5 wants to merge 1 commit intoopen-telemetry:mainfrom
kruthiwusirika5:fix/zapgrpc-client-close-warning
Open

otelcol/grpclog: suppress benign gRPC client-disconnect warnings#15024
kruthiwusirika5 wants to merge 1 commit intoopen-telemetry:mainfrom
kruthiwusirika5:fix/zapgrpc-client-close-warning

Conversation

@kruthiwusirika5
Copy link
Copy Markdown

Fixes #5169

Problem

When a gRPC client disconnects normally (e.g., a .NET app shutting down its TracerProvider), the collector logs spurious WARN messages from the gRPC transport layer:

warn zapgrpc/zapgrpc.go:191 [transport] transport: http2Server.HandleStreams failed to read frame: read tcp [...]: connection reset by peer

These are expected during graceful client shutdown but appear alarming to operators and pollute production logs.

Solution

Add a benignFilterCore — a zapcore.Core wrapper — that intercepts warn-level log entries matching known client-disconnect patterns (HandleStreams failed to read frame, connection reset by peer) and drops them before they reach the output sink.

This approach:

  • Does not change the call stack depth, preserving caller info accuracy
  • Leaves all non-benign warnings unaffected
  • Has no impact on performance for non-matching messages (the check is a simple strings.Contains on the already-formatted message)

Testing

Added three new test cases:

  • TestBenignClientCloseWarningsSuppressed — verifies the known patterns are not logged at warn level
  • TestNonBenignWarningsPreserved — verifies unrelated warnings still pass through
  • TestIsBenignClientCloseMessage — unit tests for the pattern-matching helper

@kruthiwusirika5 kruthiwusirika5 requested a review from a team as a code owner March 29, 2026 18:41
@kruthiwusirika5 kruthiwusirika5 requested a review from axw March 29, 2026 18:41
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Mar 29, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: kruthiwusirika5 / name: kruthiwusirika5 (665e053)

@kruthiwusirika5
Copy link
Copy Markdown
Author

recheck

@kruthiwusirika5
Copy link
Copy Markdown
Author

/easycla

When a gRPC client closes normally, the transport layer emits warnings
like "HandleStreams failed to read frame: EOF" and "connection reset by
peer". These are expected during graceful shutdown and create noise for
operators monitoring production collector deployments.

Add a benignFilterCore zapcore.Core wrapper that intercepts warn-level
entries matching known client-disconnect patterns and drops them before
they reach the output sink. Non-benign warnings are unaffected.

Fixes open-telemetry#5169
@kruthiwusirika5 kruthiwusirika5 force-pushed the fix/zapgrpc-client-close-warning branch from 20d0b54 to 665e053 Compare March 29, 2026 18:49
@kruthiwusirika5
Copy link
Copy Markdown
Author

/easycla

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zapgrpc : Warning http2Server.HandleStreams failed to read frame - when client close

1 participant