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

TcpServerBinder: don't log "Failed to create a connection" twice #3113

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

idelpivnitskiy
Copy link
Member

@idelpivnitskiy idelpivnitskiy commented Nov 18, 2024

Motivation:

TcpServerBinder uses beforeOnError to log any failures to create a connection (to capture connection info) and then it goes to SimpleSingleSubscriber that logs it again.

Modifications:

  • Use new Single.subscribe(...) overload introduced in #3112 that takes errorConsumer to log "Failed to create a connection";
  • Log full Channel info instead of just remote address to keep a consistent pattern of starting all network-level logs with channel id;

Result:

Exception is logged only once.

Motivation:

`TcpServerBinder` uses `beforeOnError` to log any failures to create a
connection (to capture connection info) and then it goes to
`SimpleSingleSubscriber` that logs it again.

Modifications:

- Use new `Single.subscribe(...)` overload that takes `errorConsumer` to
log "Failed to create a connection";
- Log full `Channel` info instead of just remote address to keep
consistent patter of starting all network-level logs with channel id;

Result:

Exception is logged only once.
@idelpivnitskiy idelpivnitskiy self-assigned this Nov 18, 2024
@idelpivnitskiy idelpivnitskiy changed the title TcpServerBinder logs "Failed to create a connection" twice TcpServerBinder: don't log "Failed to create a connection" twice Nov 18, 2024
@idelpivnitskiy idelpivnitskiy merged commit c14e4aa into apple:main Nov 18, 2024
11 checks passed
@idelpivnitskiy idelpivnitskiy deleted the tcp-binder branch November 18, 2024 18:52
mgodave pushed a commit to mgodave/servicetalk that referenced this pull request Nov 19, 2024
)

Motivation:

`TcpServerBinder` uses `beforeOnError` to log any failures to create a
connection (to capture connection info) and then it goes to
`SimpleSingleSubscriber` that logs it again.

Modifications:

- Use new `Single.subscribe(...)` overload that takes `errorConsumer` to
log "Failed to create a connection";
- Log full `Channel` info instead of just remote address to keep
consistent patter of starting all network-level logs with channel id;

Result:

Exception is logged only once.
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.

3 participants