Remove NAT behavior telemetry + remove fmt.Sprint wrapping in slog.#368
Merged
Conversation
Remove NAT behavior telemetry: delete the otel package and the otel.CollectAndSendNATBehaviorTelemetry calls (and the supporting STUN cohort discovery block) from the consumer and producer. Replace fmt.Sprintf/fmt.Sprint-wrapped slog messages with structured key/value attributes across clientcore, egress, cmd, freddie, netstated, and the private-swarm examples. Error values use the "error" key; other values get concise snake_case keys. Drop now-unused fmt imports.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes NAT behavior telemetry (previously implemented via a dedicated otel package and go-nats-backed STUN discovery) and performs a repo-wide structured logging cleanup by converting fmt.Sprint/fmt.Sprintf-wrapped slog calls into key/value attributes.
Changes:
- Delete the
otelNAT-telemetry implementation and remove the corresponding call sites in the WebRTC consumer. - Convert many debug logs across
clientcore,egress,cmd,freddie,netstated, and examples to structuredslogattributes and drop now-unusedfmtimports. - Minor log message cleanup aligned with the structured logging approach.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| otel/otel_wasm_impl.go | Deletes wasm-specific no-op NAT telemetry implementation. |
| otel/otel_default_impl.go | Deletes default NAT telemetry implementation that used go-nats + OTEL tracing. |
| netstate/d/netstated.go | Converts several debug logs to structured slog key/value attributes. |
| freddie/freddie.go | Converts Freddie server listen logs to structured attributes. |
| examples/private-swarm/egress-server/main.go | Converts startup log to structured slog. |
| examples/private-swarm/censored-client/main.go | Converts error/startup logs to structured slog attributes. |
| egress/websocket.go | Removes fmt usage and converts websocket logs to structured attributes. |
| egress/quic.go | Converts QUIC lifecycle logs to structured attributes. |
| egress/egresslib.go | Converts websocket accept/migration logs to structured attributes. |
| egress/cmd/socks5/egress_socks5.go | Converts startup log to structured slog. |
| egress/cmd/sing-box/uot.go | Converts UoT logs to structured attributes. |
| egress/cmd/sing-box/egress_sing_box.go | Converts startup log to structured slog. |
| egress/cmd/http/egress_http.go | Converts startup/request logs to structured slog attributes. |
| cmd/proxy.go | Converts local proxy (SOCKS/HTTP) logs to structured attributes. |
| cmd/client_wasm_impl.go | Removes fmt dependency and converts wasm client logs to structured attributes. |
| cmd/client_default_impl.go | Removes fmt dependency and converts client startup logs to structured attributes. |
| clientcore/user.go | Converts periodic stats and FSM logs to structured attributes. |
| clientcore/ui.go | Converts netstate exec error logging to structured attributes. |
| clientcore/ui_wasm_impl.go | Converts startup log to structured attributes. |
| clientcore/socks5.go | Converts malformed SOCKS logging to structured slog. |
| clientcore/quic.go | Converts QUIC listener error logging to structured attributes. |
| clientcore/protocol.go | Converts FSM start/stop logs to structured slog. |
| clientcore/producer.go | Converts producer FSM logs to structured attributes. |
| clientcore/jit_egress_consumer.go | Converts JIT egress consumer logs to structured attributes. |
| clientcore/egress_consumer.go | Converts egress consumer logs to structured attributes. |
| clientcore/consumer.go | Removes NAT telemetry call site and converts consumer FSM logs to structured attributes. |
| clientcore/broflake.go | Converts engine lifecycle logs to structured attributes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
noahlevenson
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes NAT behavior telemetry from the consumer and producer. The
telemetry path relied on go-nats, which has a memory leak and does not
support in-flight cancellation, so it is being pulled out entirely:
otelpackage (otel_default_impl.go,otel_wasm_impl.go).otel.CollectAndSendNATBehaviorTelemetrycalls and thesupporting STUN cohort discovery block from the consumer and producer.
Also included
A structured-logging cleanup:
fmt.Sprintf/fmt.Sprint-wrappedslogcalls are converted to structured key/value attributes across
clientcore,egress,cmd,freddie,netstated, and theprivate-swarm examples. Error values use the
"error"key; now-unusedfmtimports are dropped.