Skip to content

fix(telemetry): err nil check & bump deps - #302

Merged
franklinkim merged 4 commits into
mainfrom
fix/defer-span-end
Aug 7, 2026
Merged

fix(telemetry): err nil check & bump deps#302
franklinkim merged 4 commits into
mainfrom
fix/defer-span-end

Conversation

@franklinkim

Copy link
Copy Markdown
Member

Description

Rework the telemetry span helpers to operate on trace.Span instead of context.Context, fix DeferEndSpan to dereference the error pointer at defer-run time, and bump dependencies across all modules.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📝 Documentation
  • ♻️ Refactoring
  • 🏃‍➡️ Performance
  • ✅ Tests
  • 🔐 Security
  • 🔧 Build/CI

Changes

  • Breaking: package-level span helpers (AddSpanEvent, SetSpanAttributes, SetSpanName, IsSpanRecording, SetSpanDebug, SetSpanStatusOK, SetSpanStatusError, EndSpan, DeferEndSpan) now take a trace.Span instead of a context.Context
  • Breaking: Context.WithCancel, WithCancelCause, WithDeadline, WithTimeout, WithValue and WithoutCancel now return telemetry.Context instead of context.Context, so the fluent API chains
  • Fixed DeferEndSpan to pass opts through to EndSpan and to tolerate a nil error pointer instead of panicking
  • Exported startSpan as InternalStartSpan for use by other telemetry packages; it now returns a plain context.Context
  • Added AddSpanLink on both the package and Context
  • Dropped the IsRecording() guard from Context.RecordError / RecordSpanError — the SDK already no-ops on non-recording spans
  • Deprecated End no longer sets codes.Ok on success; EndSpan leaves the status Unset
  • Added telemetry/span_test.go covering the EndSpan vs DeferEndSpan deferred-error semantics
  • Bumped direct and indirect dependencies in all modules (root, examples, gotsrpc, nats, temporal, net/stream, mongo, postgres)
  • make outdated / make upgrade now use go-mod-upgrade; pinned goreleaser, go-mod-upgrade and govulncheck in .mise.toml instead of go install-ing govulncheck on every run

Checklist

  • My code adheres to the coding and style guidelines of the project.
  • I have performed a self-review of my own code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.

Notes

This is a source-breaking change for any consumer calling the span helpers with a context; migration is mechanical (telemetry.SetSpanName(ctx, n)telemetry.SetSpanName(telemetry.SpanFromContext(ctx), n)).

@franklinkim
franklinkim merged commit 97e2709 into main Aug 7, 2026
4 checks passed
@franklinkim
franklinkim deleted the fix/defer-span-end branch August 7, 2026 06:00
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.

1 participant