open-code-review/internal/telemetry
Abu Bakar Siddik d8b222a180
refactor(telemetry): replace PrintTraceSummary positional params with TraceSummary struct (#909)
* refactor(telemetry): replace PrintTraceSummary positional params with TraceSummary struct

PrintTraceSummary had grown to nine positional parameters after the
session ID landed in #870, making call sites hard to read and easy to
get wrong. Introduce a TraceSummary struct and pass it as a single
argument (Option A in the issue); printed output is unchanged.

Also add stdout.Swap, which swaps the package writer under the existing
mutex and returns a restore function, so tests can capture and assert
output written through stdout.Writer(). The PrintTraceSummary tests now
assert the exact summary, cache-token, and session lines instead of
only verifying the call does not panic.

Closes #906

* docs(stdout): clarify Swap concurrency doc comment

The mutex in Swap and its restore closure already guarantees memory
safety under concurrent access; the remaining hazard is semantic —
concurrent swaps produce non-deterministic restore ordering. Rephrase
the comment to state that distinction, as suggested in PR review.
2026-08-15 12:19:28 +08:00
..
config.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
config_test.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
events.go refactor(telemetry): replace PrintTraceSummary positional params with TraceSummary struct (#909) 2026-08-15 12:19:28 +08:00
events_test.go refactor(telemetry): replace PrintTraceSummary positional params with TraceSummary struct (#909) 2026-08-15 12:19:28 +08:00
exporter.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
exporter_test.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
metrics.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
metrics_test.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
provider.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
provider_test.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
shutdown.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
shutdown_test.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
span.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
span_test.go chore: add SPDX license headers and automated verification (#740) 2026-08-05 21:26:27 +08:00
traceid_test.go test: raise statement coverage to 90% and enforce it in CI (#747) 2026-08-06 12:55:44 +08:00