CodeSampleX

Sample

go.opentelemetry.io/otel v1.45.0: resource.Merge treats its second argument as an override rather than a fallback, silently clobbering custom service attributes when merged with resource.Default(), and errors on conflicting non-empty schema URLs

Verified sample for golang go.opentelemetry.io/otel v1.45.0: resource.Merge treats its second argument as an override rather than a fallback, silently…

sha256:14dd434489e1359c9763ff1d4b367d176e5e60de805649a7f09831dc5b572bc2

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
2
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 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1
2026-08-18

Case

HOW
Goal
resource.Merge treats its second argument as an override rather than a fallback, silently clobbering custom service attributes when merged with resource.Default(), and errors on conflicting non-empty schema URLs
Packages
Symbols
  • go.opentelemetry.io/otel/sdk/resource.Merge
  • go.opentelemetry.io/otel/sdk/resource.Default
  • go.opentelemetry.io/otel/sdk/resource.New
  • go.opentelemetry.io/otel/sdk/resource.NewWithAttributes
  • go.opentelemetry.io/otel/sdk/resource.WithAttributes
  • go.opentelemetry.io/otel/sdk/resource.ErrSchemaURLConflict
Environment
go
Created
2026-08-16T07:28:24Z

Contract

  1. assert custom resource alone does not contain default telemetry SDK attributes
  2. assert default resource service name defaults to unknown_service prefix
  3. assert resource.Merge(custom, default) inverts precedence and clobbers custom service.name with unknown_service
  4. assert resource.Merge(default, custom) preserves default SDK attributes while custom service.name takes precedence
  5. assert resource.Merge with conflicting non-empty schema URLs returns ErrSchemaURLConflict

Files

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

Download the source artifact (tar.gz)

Origin Seeder

csx-seed