Skip to content

deps: bump otel-go to v1.47.0 (OpenTelemetry 1.47) - #15261

Merged
sipsma merged 13 commits into
mainfrom
bump-otel-go-v1.47.0
Nov 25, 2026
Merged

sipsma merged 13 commits into
mainfrom
bump-otel-go-v1.47.0

Conversation

@vito

@vito vito commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Bumps github.com/dagger/otel-go from v1.43.1-0.20261102220336-aa07da582c21 to the tagged v1.47.0 (diff), and with it OpenTelemetry Go from 1.43–1.46 to 1.47.0.

What changed in otel-go that mattered

  • OpenTelemetry's 1.45 log API (Move to the OpenTelemetry 1.45 log API otel-go#34): otel/log dropped log.KeyValue, log.Value and log.Kind for attribute.KeyValue, attribute.Value and attribute.Type. otel-go's SpanStdio, NewWriter, GlobalWriter and Writer.Emit now take attribute values, and LogValueFromPB/LogValueToPB speak attribute.Value.
  • ReexportLogsFromPB takes []*ResourceLogs rather than the whole ExportLogsServiceRequest.
  • No gRPC by default (Link no gRPC unless a program asks for it otel-go#33): Configured*Exporter speak http/protobuf only; programs that want OpenTelemetry's own exporters (grpc, TLS, compression, retries) import github.com/dagger/otel-go/otlp.
  • Empty values are sent as OpenTelemetry does: an empty attribute value is an empty AnyValue, no longer the string "INVALID".
  • OpenTelemetry v1.47 itself: otel/internal/global imports otel/log, so the replace … otel/log => … v0.16.0 pins we carried are now an import cycle; and the log SDK's LoggerProvider.Shutdown now waits for in-flight emits, and skips its processors entirely once its context has ended. A zero sdklog.Record's attribute count limit of 0 now keeps no attributes.

What this PR does

deps: bump otel-go to v1.47.0

  • Root, sdk/go, cli-dev and engine-dev go.mods move to otel-go v1.47.0 / otel v1.47.0 and lose the v0.16.0 replace pins (viztest stays behind for now; see Temporary below). sdk/go no longer requires gRPC at all.
  • Every otel/log value use moves to attribute (~90 files, an AST rewrite plus hand fixes): Kind()→Type(), AsBytes()→AsByteSlice(), KeyValue.Key is an attribute.Key, Equal became ==, Empty() is Type() == attribute.EMPTY.
  • The CLI and the engine import otel-go/otlp, so a user's OTEL_EXPORTER_OTLP_* collector keeps working over grpc as before.
  • The CLI's resource moves to semconv v1.43.0: with v1.40.0, the SDK's v1.47 detectors made every command warn conflicting Schema URL.
  • clientdb's hand-rolled attribute encoder (which must match otel-go byte for byte) encodes empty values as otel-go now does, and falls back to otel-go's conversion for byte slices, slices and maps.
  • validUTF8LogValue also repairs string slices, now a possible log value type.
  • google.golang.org/api moves to v0.264.0 with gRPC (it can't stay at v0.257.0 without downgrading otel); it deprecates option.WithCredentialsFile, so the GCP secret provider leaves GOOGLE_APPLICATION_CREDENTIALS to ADC, which reads it first anyway.

engine: end the event drain when its stop runs out and engine: shut log processors down past the deadline
With Cloud unreachable, the engine event drain blocked forever in BlockingLogProcessor.OnEmit, and LoggerProvider.Shutdown then waited for that emit until its deadline and never shut the processor down (caught by TestEngineEventsShutdownWithinBudget). The drain now emits under a context that Close cancels when its budget runs out, and the new enginetel.ShutdownLoggerProvider shuts processors down itself when the provider ran out of time; the engine event export and the session's logger provider use it.

codegen: drop the otel log replaces old SDKs wrote
Go codegen used to copy sdk/go's replaces into every generated module's go.mod/go.work; that copying (and engine-dev's seed-module copy of it) is gone. Migration: modules generated by older engines still carry replace go.opentelemetry.io/otel/log => go.opentelemetry.io/otel/log v0.16.0 (and sdk/log, otlploggrpc, otlploghttp), which would now be an import cycle. Codegen drops exactly those — a same-path replace of one of the four modules by a v0 release — from the module's go.mod and the go.work; local-path or other-module replaces stay. Since Go applies every workspace module's replaces, if a sibling module in the go.work still pins otel/log or sdk/log, the go.work instead replaces them with sdk/go's version until that sibling is regenerated. (Codegen parses go.mod with ParseLax, which leaves replaces out of File.Replace, so this edits the syntax tree.)

codegen: import semconv v1.43.0 in module mains
Generated module mains imported semconv/v1.40.0, which otel-go v1.47 and sdk/resource no longer pull in (v1.39.0 / v1.43.0). The Go SDK prebuilds export archives for what the bootstrapped module imports, so they lacked it, and codegen prepare-go-runtime (modules with +collection types) failed with "the export driver declined … the listing or the archives lack packages the roots import" — the 45 test-base failures. v1.43.0 is sdk/resource's, so it is always in the archives, and its schema URL matches resource.Default's.

telemetry: unify on semconv v1.43.0
Every hand-written semconv import moves to v1.43.0, the version OpenTelemetry v1.47's SDK uses (engine, clientdb, dagui, core, spanfootprint, tests, and buildkit's v1.17.0). The emitted attribute keys don't change: service.*, test.* and exception.stacktrace are spelled the same in v1.43.0. v1.43.0 no longer defines the gen_ai.* attributes, so gen_ai.agent.id and gen_ai.agent.name are now telemetryattrs constants with the same keys, and the tests assert the literal keys. The custom-span idtui golden now also checks that the CLI resource's schema URL is semconv v1.43.0's.

CI cache note: Go's package index caches a directory's imports keyed on its files' names, sizes and mtimes, and CI's checkouts give every file the same mtime. So same-size v1.40.0→v1.43.0 edits left CI's warm cache serving the old imports ("could not import …/semconv/v1.43.0" in lint and go generate). The follow-up commits (tracing: use semconv's ExceptionStacktrace helper, telemetry: let CI's Go cache see the semconv move) make a behavior-neutral change in each affected directory. Any future same-size import edit can hit the same thing; a lasting fix is GODEBUG=goindex=0 (or real mtimes) in the CI Go toolchains.

Generated files still import semconv v1.40.0 because they come from the dagger/go-sdk templates (being moved to v1.43.0 separately). They change when they're regenerated:

  • the dagger.dispatch.gen.go of .dagger/modules/* and modules/git-releaser
  • the dagger.gen.go of modules/ruff, sdk/{elixir,java,php,python,typescript}/runtime, dagql/idtui/viztest{,/dep,/dep/nested-dep}
  • the dagger.gen.go / dagger.dispatch.gen.go of the core/integration/testdata fixtures

changes: … — a .changes/unreleased entry.

Temporary

viztest: stay on released engines' otel-go — go-sdk/generate/stale regenerates dagql/idtui/viztest (a legacy runtime = "go" module) with CI's engine, the released v1.0.0-beta.27, whose codegen still copies replace go.opentelemetry.io/otel/log => … v0.16.0 (and sdk/log, otlplog*) into it. With otel v1.47 that is the import cycle, so the check can't pass with viztest on otel-go v1.47. viztest builds from its committed sources in the goldens, so its go.mod, go.sum and main.go stay exactly as on main (otel-go aa07da582c21, the old log.KeyValue API), with a TEMPORARY comment in its go.mod. Move it to otel-go v1.47 once CI's engine includes this PR. (Versioned self-replaces can't work around it: beta.27's go mod edit -replace path=… removes every replace of that path, versioned ones included.)

Testing

  • go vet ./... (root, sdk/go, cli-dev, engine-dev, viztest) and golangci-lint/lint-all pass.
  • Unit tests: engine/{telemetry,server,clientdb,agentcontrol,slog,snapshots}, dagql/{dagui,idtui}, core, core/schema, cmd/engine, cmd/codegen/.... New: TestSyncModReplaceAndTidyDropsStaleOTelLogReplaces, TestSyncModReplaceAndTidyFixesStaleOTelLogGoWorkReplaces, TestShutdownLoggerProviderShutsProcessorsDownPastDeadline; TestMarshalKeyValueList/TestValidUTF8LogValue* cover the new value types.
  • dagql/idtui TestTelemetry/TestGolden against a dev engine passes (goldens unchanged).
  • New integration test TestGo/TestStaleOTelLogReplaces: a Go module whose go.mod has the old pins builds and runs on a dev engine. Before the codegen fix, the same module failed with import cycle not allowed (otel/internal/global ↔ otel/log).
  • internal/cmd/dagger's TestInitConsoleShowsCommands and TestDaggerCMD/TestAgentWorkspace* fail in my sandbox, identically on main.

Not changed / follow-ups

  • Go modules that resolve otel-go through the published dagger.io/dagger (the go-sdk-generated testdata modules, most of .dagger/modules/*) still pin otel-go aa07da582c21 / otel 1.46, as dagger.io/dagger v1.0.0-beta.26 requires; they move on their next regeneration against a new SDK. Fixtures and SDK runtimes pinned at older fixed versions (otel-go v1.41.0) are left alone.
  • dagger.toml pins github.com/dagger/go@79a92beb…; gobuild: bump otel-go to v1.47.0 go#110 bumps its otelgotest runner pin to otel-go v1.47.0, so a follow-up can bump that pin once it merges. (engine-dev's own otelgotest build follows the root go.mod already.)

@vito
vito requested a review from a team as a code owner November 24, 2026 04:51
@vito
vito force-pushed the bump-otel-go-v1.47.0 branch from 70b1299 to b713a2b Compare November 24, 2026 06:00
vito added a commit to dagger/go-sdk that referenced this pull request Nov 24, 2026
Generated modules require otel-go v1.47.0, while an engine seeds its
pre-warmed builds from dagger.io/dagger at defaultTarget, which still
resolves an older otel-go: those builds match only once the engine's seed
resolves the pinned otel-go too (dagger/dagger#15261 moves sdk/go there).

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the bump-otel-go-v1.47.0 branch from b6dfdce to e850e1b Compare November 25, 2026 16:17
vito and others added 13 commits November 25, 2026 20:01
otel-go v1.47.0 moves to OpenTelemetry v1.47, whose log API (since v1.45)
drops log.KeyValue, log.Value and log.Kind for attribute.KeyValue,
attribute.Value and attribute.Type. otel-go's SpanStdio, NewWriter and
GlobalWriter now take attribute.KeyValues, and ReexportLogsFromPB takes
a request's []*ResourceLogs rather than the request.

- Drop the replaces pinning otel/log, sdk/log and the otlplog exporters
  to v0.16.0 from the root module and sdk/go: otel v1.47's
  internal/global imports otel/log, and otel-go needs the new log API.
  sdk/go no longer requires gRPC: otel-go now links it only for programs
  that import github.com/dagger/otel-go/otlp.
- Move every otel/log value to its attribute equivalent: Kind() is
  Type(), AsBytes() is AsByteSlice(), KeyValue.Key is an attribute.Key,
  and the values compare with ==.
- The CLI and the engine import otel-go/otlp, so OTEL_EXPORTER_OTLP_*
  collectors keep OpenTelemetry's own exporters, grpc included.
- The CLI's resource uses semconv v1.43.0, the schema of the SDK's
  detectors: with v1.40.0 every command warned of a schema URL conflict.
- clientdb's attribute encoder matches otel-go's again: an empty value
  is an empty AnyValue, not "INVALID", and byte slices, slices and maps,
  new attribute types, take otel-go's conversion.
- validUTF8LogValue also repairs string slices, a log value type now.
- A test that built a zero sdklog.Record takes one from a provider: a
  zero record's attribute count limit of 0 now keeps no attributes.
- google.golang.org/api moves to v0.264.0 with gRPC, which deprecates
  option.WithCredentialsFile: the GCP secret provider leaves
  GOOGLE_APPLICATION_CREDENTIALS to Application Default Credentials,
  which read it first already.

cli-dev, engine-dev and viztest require the same otel-go, as before.

Signed-off-by: Alex Suraci <[email protected]>
OpenTelemetry v1.47's LoggerProvider.Shutdown waits for every emit in
flight before it shuts its processors down. The engine event emitter's
drain emits into a BlockingLogProcessor, whose OnEmit waits for queue
space until the processor shuts down: with Cloud unreachable and the
queue full, the provider's shutdown waited out its deadline without
shutting the processor down, and the drain stayed blocked for good.

The drain now emits under a context Close cancels when its own context
ends: the waiting emit gives up, and the events not handed over yet are
counted as dropped. TestEngineEventsShutdownWithinBudget covers it.

Signed-off-by: Alex Suraci <[email protected]>
Go module codegen copied sdk/go's replace directives into every module's
go.mod and go.work, to pin the then-unstable OpenTelemetry log modules
(otel/log, sdk/log and the otlplog exporters) to v0.16.0. sdk/go has no
replaces now: the log modules are stable, at v1.47.0. Remove the
copying, and engine-dev's seed module's copy of it.

Modules generated before still carry the pins, and with otel v1.47,
whose internal/global imports otel/log, they make an import cycle. So
codegen now drops a replace of one of those modules by a v0 release of
itself, from the module's go.mod and from the go.work. A replace by a
local path or another module is the user's, and stays. It edits go.mod's
syntax: codegen parses go.mod with modfile.ParseLax, which leaves
replaces out of File.Replace.

Go applies every workspace module's replaces, so while another module of
the go.work still pins otel/log or sdk/log, the go.work replaces it with
sdk/go's version instead, overriding the module's pin until that module
is generated again.

TestGo/TestStaleOTelLogReplaces builds a module whose go.mod has the
pins; it failed with the import cycle before.

Signed-off-by: Alex Suraci <[email protected]>
OpenTelemetry v1.47's LoggerProvider.Shutdown returns once its context
ends without shutting its processors down: a processor whose emits were
still waiting, such as the engine event export's BlockingLogProcessor
against an unreachable Cloud, kept retrying its exports after the
engine's stop, and its exporter was never shut down.

enginetel.ShutdownLoggerProvider shuts the processors down itself when
the provider ran out of time. The engine event export and the session's
logger provider shut down through it.

Close of the engine event emitter also waits, briefly, for its drain to
count the events it gave up on, so the shutdown's warning reports them.

Signed-off-by: Alex Suraci <[email protected]>
Go modules' go.mod changes on their next codegen: say why, and what
module code using the OpenTelemetry log API must change.

Signed-off-by: Alex Suraci <[email protected]>
The PR number exists now.

Signed-off-by: Alex Suraci <[email protected]>
Generated module mains imported semconv v1.40.0, which otel-go v1.47 and
sdk/resource no longer import (they use v1.39.0 and v1.43.0). The Go SDK
prebuilds archives for what the bootstrapped module imports, so they lacked
it, and prepare-go-runtime's export driver declined to load collection
modules. v1.43.0 is sdk/resource's, so it is always in the archives, and
its schema URL matches resource.Default's.

Signed-off-by: Alex Suraci <[email protected]>
CI's go-sdk/generate/stale regenerates viztest with the released engine
(v1.0.0-beta.27), whose codegen still pins otel/log to v0.16.0: with the
otel v1.47 that otel-go v1.47 requires, that is an import cycle. viztest
builds from its committed sources, so its go.mod, go.sum and main.go go
back to what that engine generates, as on main, until CI's engine has the
codegen that drops the pins. A comment in go.mod says so.

Signed-off-by: Alex Suraci <[email protected]>
OpenTelemetry v1.47's SDK (resource, trace, log) uses semconv v1.43.0, and
the CLI and generated modules already moved to it; every hand-written
import follows, buildkit's v1.17.0 included, so one semconv version is
in the graph.

Every attribute key and value used keeps its spelling (service.*,
test.*, exception.stacktrace), except that v1.43.0 no longer defines the
gen_ai attributes: gen_ai.agent.id and gen_ai.agent.name are now
telemetryattrs constants with the same keys, which the UI and Dagger
Cloud match on. The tests check the literal keys.

Signed-off-by: Alex Suraci <[email protected]>
semconv v1.43.0 has ExceptionStacktrace, which sets the same
exception.stacktrace key the hand-built attribute did.

It also changes tracing.go's size. Go caches what a source file imports
by its size and modification time, and CI's checkouts give every file
the same time, so with the size unchanged CI's warm Go cache still read
the old semconv v1.17.0 import and failed to compile the package.

Signed-off-by: Alex Suraci <[email protected]>
Go caches the imports of a package directory under a hash of its files'
names, sizes and modification times. CI's checkouts give every file the
same time, so the same-size v1.40.0 -> v1.43.0 import edits left CI's
warm cache serving the old import lists: lint and go generate then failed
with "could not import go.opentelemetry.io/otel/semconv/v1.43.0".

Each affected directory gets a change, with no change in behavior: the
engine names its service with semconv's helpers, tests use semconv's test
status values, and TestSessionSpansNameEngine checks the engine resource
as a whole. The idtui golden for the CLI resource now also checks the
schema URL, which an older semconv would make conflict with the SDK's
detectors.

Signed-off-by: Alex Suraci <[email protected]>
The otel-go v1.47.0 tag predates otel-go's move to semconv v1.43.0, so its
fallback resource still uses semconv v1.39.0 and conflicts with OpenTelemetry
1.47's resource.Default ("conflicting Schema URL"). Tags are immutable, so per
the otel-bump policy pin the fix commit's pseudo-version instead
(e79f0e10530f) in the root, sdk/go, cli-dev and engine-dev modules. viztest
keeps its deliberate lag.

Signed-off-by: Alex Suraci <[email protected]>
go-sdk moves from v1.7.0 to v1.8.0. Its generated module mains import
semconv v1.43.0, the version OpenTelemetry v1.47.0's resources use, and
its generated modules require otel-go on OpenTelemetry v1.47.0. Its
daggerGo is dagger/go v0.5.0, so the built-in Go SDK's dagger/go pin in
sdk/go/runtime moves from 79a92be to the same commit (262b66d), as the
engine image's build requires: the gobuild the image ships is then on
OpenTelemetry v1.47.0 too.

Every other dagger/go pin moves from c40d1b4 to v0.5.0, which holds
c40d1b4's linker quoting and moves gobuild to OpenTelemetry v1.47.0.
Both alpine pins move to dagger/alpine's f1e5587, the merge of its
OpenTelemetry v1.47.0 bump.

Regenerated with `dagger generate --go-sdk --dang-sdk` on
v1.0.0-beta.27; nothing is edited by hand but dagger.toml and
sdk/go/runtime/dagger-module.toml.

Signed-off-by: Erik Sipsma <[email protected]>
@sipsma
sipsma force-pushed the bump-otel-go-v1.47.0 branch from e850e1b to cb14fd5 Compare November 25, 2026 20:03
@sipsma
sipsma merged commit 7a85bee into main Nov 25, 2026
77 checks passed
@sipsma
sipsma deleted the bump-otel-go-v1.47.0 branch November 25, 2026 20:32
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.

2 participants