Skip to content

feat(protocol): TCP connection lifecycle spans - #956

Draft
Ladas wants to merge 1 commit into
praxis-proxy:mainfrom
Ladas:issue-313-tcp-lifecycle-spans
Draft

feat(protocol): TCP connection lifecycle spans#956
Ladas wants to merge 1 commit into
praxis-proxy:mainfrom
Ladas:issue-313-tcp-lifecycle-spans

Conversation

@Ladas

@Ladas Ladas commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add tcp_connection info span wrapping the full TCP connection lifecycle
  • Span attributes: client.address, network.transport, upstream.address
  • Structured events: connection_open, connection_error, connection_close (with bytes_in, bytes_out, duration_ms)
  • Preserves upstream metrics (overload rejection, connect duration, connect failure, active connection guard)

Closes #313

Dependencies

None — independent of HTTP tracing work.

Test plan

  • Verify TCP proxy starts with tracing enabled
  • Confirm span appears in collector with correct attributes
  • Verify metrics still recorded correctly

@Ladas
Ladas force-pushed the issue-313-tcp-lifecycle-spans branch from 9c4e60d to 2eb1a58 Compare August 12, 2026 10:46
@praxis-bot-app

Copy link
Copy Markdown

Unsigned commits: 2eb1a58. Please sign your commits.

@Ladas
Ladas force-pushed the issue-313-tcp-lifecycle-spans branch from 2eb1a58 to ad3d5e1 Compare August 12, 2026 10:51

@praxis-bot praxis-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TCP Connection Lifecycle Spans Review

1 Large, 2 Medium findings.

The span creation and .instrument(span) pattern is correct -- the span always closes properly regardless of exit path. The tracing capture test utilities are well-designed and the test coverage for span attributes and structured events is good.

Key concern: connection_close is only emitted on the happy path, creating telemetry lifecycle gaps when connections fail after acceptance. See inline comments.

Comment thread protocol/src/tcp/proxy.rs Outdated
Comment thread protocol/src/tcp/proxy.rs Outdated
Comment thread protocol/src/tcp/proxy.rs
@Ladas
Ladas force-pushed the issue-313-tcp-lifecycle-spans branch 4 times, most recently from 5f2c384 to 77d758d Compare August 13, 2026 11:28

@praxis-bot praxis-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review

Adds tcp_connection lifecycle span wrapping TCP proxy connections with structured connection_accepted, connection_error, and connection_close events.

The span/instrument pattern is correct and the tracing capture test utilities are well-built. The previous review's findings (lifecycle gap, error level escalation, shared message names) have been addressed or partially addressed. Two new issues found.

Severity Count
Medium 2

Comment thread protocol/src/tcp/proxy.rs Outdated
Comment thread protocol/src/tcp/proxy.rs Outdated
@Ladas
Ladas force-pushed the issue-313-tcp-lifecycle-spans branch 2 times, most recently from bc6b16a to 68855a1 Compare August 13, 2026 13:01
Add root tracing spans for TCP proxy connections covering the full
connection lifecycle from accept to close.

- Span per TCP connection with client.address, upstream.address,
  network.transport attributes
- Span events for connection open, close, and error
- Byte counts (sent/received) and duration recorded at close
- TLS handshake duration attribute when applicable
- Independent root spans (not children of HTTP spans)

Closes praxis-proxy#313

Signed-off-by: Ladislav Smola <lsmola@redhat.com>
@Ladas
Ladas force-pushed the issue-313-tcp-lifecycle-spans branch from 68855a1 to bf6d746 Compare August 14, 2026 14:56
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.

TCP connection lifecycle spans

2 participants