Skip to content

Remove NAT behavior telemetry + remove fmt.Sprint wrapping in slog.#368

Merged
garmr-ulfr merged 3 commits into
mainfrom
garmr/remove-nat-telemetry
Jun 12, 2026
Merged

Remove NAT behavior telemetry + remove fmt.Sprint wrapping in slog.#368
garmr-ulfr merged 3 commits into
mainfrom
garmr/remove-nat-telemetry

Conversation

@garmr-ulfr

Copy link
Copy Markdown
Contributor

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:

  • Delete the otel package (otel_default_impl.go, otel_wasm_impl.go).
  • Remove the otel.CollectAndSendNATBehaviorTelemetry calls and the
    supporting STUN cohort discovery block from the consumer and producer.

Also included

A structured-logging cleanup: fmt.Sprintf/fmt.Sprint-wrapped slog
calls are converted to structured key/value attributes across
clientcore, egress, cmd, freddie, netstated, and the
private-swarm examples. Error values use the "error" key; now-unused
fmt imports are dropped.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 otel NAT-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 structured slog attributes and drop now-unused fmt imports.
  • 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.

Comment thread clientcore/consumer.go Outdated
Comment thread clientcore/consumer.go Outdated
Comment thread clientcore/consumer.go Outdated
Comment thread clientcore/producer.go Outdated
Comment thread clientcore/producer.go Outdated
Comment thread clientcore/consumer.go
Comment thread clientcore/broflake.go Outdated
garmr-ulfr and others added 2 commits June 12, 2026 13:24
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@garmr-ulfr garmr-ulfr changed the title Remove NAT behavior telemetry Remove NAT behavior telemetry + remove fmt.Sprint wrapping in slog. Jun 12, 2026
@garmr-ulfr garmr-ulfr marked this pull request as ready for review June 12, 2026 20:27
@garmr-ulfr garmr-ulfr merged commit c4d1516 into main Jun 12, 2026
@garmr-ulfr garmr-ulfr deleted the garmr/remove-nat-telemetry branch June 12, 2026 20:38
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