Replace external hclog-slog adapter with an in-tree one in the Go SDK - #70918
Merged
Conversation
The plugin-mode bundle server routes its slog default logger through hclog so the go-plugin host can parse the plugin's stderr. That bridge came from the external github.com/evanphx/go-hclog-slog module, which ships no license and no tagged release. Replace it with a small in-tree slog.Handler in pkg/logging/hclogslog (the inverse of the existing pkg/logging/shclog), keeping the plugin logging behaviour identical while removing the external module. The lang-SDK Go example module, which resolves the SDK via a replace directive, is re-tidied to drop the now-unused indirect entry.
An empty-keyed attribute bound with slog's With and an empty-keyed attribute on the record itself both fell back to a positional key that each scope numbered from zero. At the same group prefix they produced the same numeric key, so hclog emitted a duplicate JSON key and the plugin host's decoder silently kept only the last value, dropping the bound one. Carry the bound attributes' position count into the record so their synthesized keys no longer overlap.
jason810496
marked this pull request as ready for review
August 3, 2026 06:15
jason810496
requested review from
amoghrajesh,
ashb,
gopidesupavan and
potiuk
as code owners
August 3, 2026 06:15
potiuk
approved these changes
Aug 3, 2026
Member
|
good calls! |
Contributor
Backport failed to create: v3-3-test. View the failure log Run detailsNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
You can attempt to backport this manually by running: cherry_picker 3cfbbe6 v3-3-testThis should apply the commit to the v3-3-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continueIf you don't have cherry-picker installed, see the installation guide. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
In plugin mode,
bundlev1serverinstalls an slog default logger that forwards through anhclog.Loggerso the go-plugin host can parse the plugin's stderr. That bridge came from the externalgithub.com/evanphx/go-hclog-slogmodule, which ships no license file and no tagged release (it is pinned to a bare commit). That makes it awkward to depend on and to reason about.The adapter is small and we already maintain its mirror image in-tree —
pkg/logging/shclogpresents an slog Logger as an hclog. This adds the inverse and drops the external module.What
pkg/logging/hclogslog: a smallslog.Handlerthat forwards records to anhclog.Logger, translating levels and flattening grouped attributes with dotted keys (100% unit-test covered).bundlev1serverat the in-tree package (the call site —hclogslog.Adapt(hcLogger)— is unchanged).go mod tidydropsgithub.com/evanphx/go-hclog-slogfromgo-sdk/go.mod/go-sdk/go.sum; re-tidykubernetes-tests/lang_sdk/go_exampleto drop its stale indirect entry.Plugin logging behaviour is identical.
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 4.8) following the guidelines