Skip to content

feat!: split trace/contrib integrations into individual Go modules #49

Open
Abhijeet Prasad (AbhiPrasad) wants to merge 2 commits intomainfrom
abhi-chore-release-scripts-multi-module
Open

feat!: split trace/contrib integrations into individual Go modules #49
Abhijeet Prasad (AbhiPrasad) wants to merge 2 commits intomainfrom
abhi-chore-release-scripts-multi-module

Conversation

@AbhiPrasad
Copy link
Copy Markdown
Member

AI Summary

Split every trace/contrib integration into its own Go module (mirroring the architecture of DataDog/dd-trace-go) and overhaul the release pipeline to correctly handle an arbitrary number of nested modules.


⚠️ Breaking Change: Integration imports

Integration provider SDKs are no longer transitive dependencies of the root module. Users must now explicitly depend on the specific integration modules they use.

Before

go get github.com/braintrustdata/braintrust-sdk-go

This single dependency transitively pulled in every integration provider SDK
(OpenAI, Anthropic, Google GenAI, etc.), even if you only used one.

After

# Root SDK (required)
go get github.com/braintrustdata/braintrust-sdk-go

# Add only the integrations you need
go get github.com/braintrustdata/braintrust-sdk-go/trace/contrib/openai
go get github.com/braintrustdata/braintrust-sdk-go/trace/contrib/anthropic
go get github.com/braintrustdata/braintrust-sdk-go/trace/contrib/genai
# ... etc.

If you want every integration at once (previous behavior), use the trace/contrib/all convenience module:

go get github.com/braintrustdata/braintrust-sdk-go/trace/contrib/all

Available integration modules

Module path Provider
trace/contrib/openai OpenAI (official Go SDK)
trace/contrib/anthropic Anthropic
trace/contrib/genai Google GenAI
trace/contrib/genkit Firebase Genkit
trace/contrib/adk Google ADK
trace/contrib/langchaingo LangChain Go
trace/contrib/cloudwego/eino CloudWeGo Eino
trace/contrib/github.com/sashabaranov/go-openai sashabaranov/go-openai
trace/contrib/all Meta-module (imports all of the above)

New release process

Releases are now fully automated via GitHub Actions across three stages.
Full details in docs/PUBLISHING.md.

How it works

  1. Prepare (manual trigger) — run the "Prepare Release" workflow with a
    version like v1.2.3. It creates a release/vX.Y.Z branch, pins the root
    module version and any nested-module interdependencies in every nested
    go.mod, and opens a PR.

  2. Review & merge — the PR should only contain go.mod / go.sum
    version-pin updates. Merge through the normal protected-branch process.

  3. Tag & publish (automatic) — merging triggers:

    • Tag Release — runs make ci on the merge commit, then creates tags
      for the root module (vX.Y.Z) and every nested module
      (<module-path>/vX.Y.Z).
    • Release — triggered by the root tag push, runs goreleaser and warms
      the Go module proxy cache.

Key improvements in the release pipeline

  • Dependency-ordered tagging — a new internal Go tool (internal/nestedmodules)
    topologically sorts nested modules so that a module is always tagged after any
    other nested modules it depends on (e.g., trace/contrib/all depends on
    trace/contrib/openai, so openai is tagged first).
  • Atomic tag push — all tags are pushed in a single git push --atomic,
    ensuring the publish workflow only fires after every tag exists on the remote.
    This prevents partial-release races.
  • Merge-commit checkout — the Tag Release workflow now checks out the actual
    merge commit SHA (github.event.pull_request.merge_commit_sha) instead of
    main, avoiding a race where a later commit lands between merge and tag.
  • Resilient proxy indexing — Go proxy cache warming now retries up to 10
    times with backoff instead of a fire-and-forget curl.

Adding a new integration

  1. Add the module path to scripts/nested_modules.txt.
  2. Add a replace directive in its go.mod pointing to the repo root.
  3. The check-nested-modules Make target will catch any manifest drift.

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) force-pushed the abhi-chore-release-scripts-multi-module branch from e14849a to 23bd30d Compare March 27, 2026 02:18

[hooks]
postinstall = "mise generate git-pre-commit --write --task=verify-fmt"
postinstall = "mise generate git-pre-commit --write"
Copy link
Copy Markdown
Contributor

@clutchski Matt Perpick (clutchski) Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this fast and quiet :) pre-commit hooks must be fast and silent if everything is fine

Copy link
Copy Markdown
Contributor

@clutchski Matt Perpick (clutchski) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think i support this. we should also verify that we now depend on the lowest version of things we possibly can.

mise.toml Outdated
run = "./scripts/check_nested_modules.sh"

[tasks.pre-commit]
silent = true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note! This should only be silent if everything is fine. It can print output if it fails see verify-fmt

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) force-pushed the abhi-chore-release-scripts-multi-module branch 4 times, most recently from 6f87506 to bf2972e Compare March 31, 2026 17:56
- split trace and contrib integrations into individual Go modules
- harden the multi-module release pipeline
- apply review/test/version pin follow-ups from PR feedback
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) force-pushed the abhi-chore-release-scripts-multi-module branch from bf2972e to b15d66f Compare March 31, 2026 18:34
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) marked this pull request as ready for review March 31, 2026 18:34
@AbhiPrasad
Copy link
Copy Markdown
Member Author

okay this should be ready for review and merge now! Cleaned up a bunch from the initial implementation. I've also updated all the integrations to be pinned to the minimum possible version that needs to be supported.

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) changed the title feat: split trace/contrib integrations into individual Go modules feat!: split trace/contrib integrations into individual Go modules Apr 2, 2026
@clutchski
Copy link
Copy Markdown
Contributor

Approved. Just make sure it's a clear upgrade path for users.

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