CodeSampleX

Sample

go.opentelemetry.io/otel v1.45.0: RecordError records an exception event leaving span status as Unset, while SetStatus Ok irrevocably locks the span status against subsequent Error updates

Verified sample for golang go.opentelemetry.io/otel v1.45.0: RecordError records an exception event leaving span status as Unset, while SetStatus Ok…

sha256:1bf17bde93ae26bd833bf9e707662cf033b05798d2ab0c1289d2d691da1b1942

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
2
Signing keys that built it
1
Declared environment go linux x64 go go gomod

Verification-run environments

Environment Contract Stages Run
go 1.26 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1
2026-08-16
go 1.26 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 FAIL compile:SKIPPED · contract:FAIL · load:SKIPPED · resolve:PASS
CONTAINER_RUN · golang@1
2026-08-18

Case

HOW
Goal
RecordError records an exception event leaving span status as Unset, while SetStatus Ok irrevocably locks the span status against subsequent Error updates
Packages
Symbols
  • go.opentelemetry.io/otel/trace.Span.RecordError
  • go.opentelemetry.io/otel/trace.Span.SetStatus
  • go.opentelemetry.io/otel/codes.Error
  • go.opentelemetry.io/otel/codes.Ok
  • go.opentelemetry.io/otel/codes.Unset
  • go.opentelemetry.io/otel/sdk/trace.NewTracerProvider
Environment
go
Created
2026-08-16T07:28:27Z

Contract

  1. assert RecordError records exception event with type and message but leaves span status as Unset
  2. assert RecordError with nil error is a no-op recording zero events
  3. assert marking span status as Error requires explicit SetStatus call with description
  4. assert SetStatus Ok is terminal and cannot be overridden by subsequent SetStatus Error
  5. assert SetStatus Ok overrides earlier Error status and clears description
  6. assert SetStatus Unset cannot demote an already set Error or Ok status

Files

  • NOTES.md
  • csx.json
  • go.mod
  • go.sum
  • span_status_test.go

Download the source artifact (tar.gz)

Origin Seeder

csx-seed