Repository navigation
T-20356 Make slog-betterstack the official Better Stack Go client - #1
Merged
Merged
Conversation
Better Stack takes over samber/slog-betterstack as its official Go client. The package name slogbetterstack and the API stay as they are, so upgrading is a change of the import path. - logger.name in every record and the User-Agent now say BetterStackHQ/slog-betterstack. - version.go carries the latest released version instead of a placeholder the release pipeline used to rewrite; the Release workflow bumps it. It says 1.4.4, samber's last release, until the first release from here. - example/ becomes example-project/ like in the other clients and reads the source token and ingesting host from the environment. - handler.go is gofmt-ed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Applications and Better Stack rely on the shape of the records this handler sends: the dt, level, message, logger.name, logger.version and extra keys, errors expanded under extra as kind/error/stack, the call site under extra.runtime, and the request headers. The tests pin all of that and what every Option field and package setting does, looking only at what reaches the server so the transport can change underneath them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
main.yml builds, vets and runs the tests with the race detector on every Go from 1.21 to stable, on pushes, pull requests, weekly and on demand, and checks gofmt, go mod tidy and golangci-lint. release.yml is the Ruby and Python clients' Release workflow ported to a Go module: patch, minor and retry runs plus dry runs, the version bump in version.go, the version commit and annotated tag pushed by the workflow, a GitHub release with generated notes, and a go list -m through proxy.golang.org so the new version is cached and indexed right away. Every push that touches the file is a dry run. samber's test, lint and Dependabot automerge workflows and FUNDING.yml go; Dependabot itself stays on its monthly schedule. The Makefile keeps the targets the workflows use. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The README follows the other Better Stack clients: install, usage, the record shape, the upgrade path from samber/slog-betterstack and credits to Samuel Berthe. The sponsor banners and the catalogue of unrelated handlers are gone. LICENSE keeps Samuel's MIT copyright line and adds Better Stack's. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Usage documentation lives at betterstack.com/docs/logs/go like for the other clients, so the README keeps the house layout plus the credits to Samuel Berthe. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
PetrHeinz
marked this pull request as ready for review
October 6, 2026 13:07
Go's semantic import versioning puts the major version into the module path from v2 on, so a major release rewrites go.mod, the imports of this repository and the README's pkg.go.dev links to "<path>/vN" in the same version commit, and the publish job fetches that path through the proxy. Rehearsed on a clone: major gives 2.0.0 with a building /v2 module, minor and patch leave the path alone, retry reads the path from the tag. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Statement coverage goes from 92% to 100%. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The version badge reads the latest GitHub release and links to pkg.go.dev, the Go equivalent of the package registry pages the other clients link to. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Makes
github.com/BetterStackHQ/slog-betterstackthe official Better Stack client for Go'slog/slog. The code is samber/slog-betterstack as of its main branch (v1.4.4 plus dependency bumps) with its full git history, taken as-is: this PR changes the module path, the project files and the repository setup so that the library looks and releases like our other clients. The behaviour fixes (batching, flush on close, retries, surfacing delivery errors) come in a follow-up PR.github.com/BetterStackHQ/slog-betterstack, package nameslogbetterstackand the API unchanged, so upgrading is an import path change.logger.namein every record and the User-Agent now sayBetterStackHQ/slog-betterstack.logger.versioncomes fromversion.go, which the Release workflow bumps. It says 1.4.4, and that is the version this lands as, the same code at its new path: tag the merge commitv1.4.4by hand, push the tag and dispatchretryfrom main, which creates the GitHub release and primes the Go module proxy. The fixes PR then releases as 1.5.0.main.ymlbuilds, vets and runs the tests with the race detector on Go 1.21 through 1.25 and stable, on every push and PR, weekly and on demand, plus gofmt,go mod tidyand golangci-lint checks.release.ymlis the Ruby and Python clients' workflow ported to a Go module: patch, minor, major and retry runs plus dry runs, the version bump inversion.go, the version commit and annotated tag pushed by the workflow, a GitHub release with generated notes, and ago list -mthrough proxy.golang.org so the version is cached and indexed immediately. A major release also moves the module path to/vNin go.mod, the example import and the README's pkg.go.dev links in the same version commit, as Go's semantic import versioning requires. Every push touching the file is a dry run, so this PR's checks include one. samber's test, lint and automerge workflows and FUNDING.yml are removed; Dependabot stays monthly.handler_test.gopins what applications rely on: the record keys (dt,level,message,logger.name,logger.version,extra), the error andruntimeshapes, the request headers, the defaults and every option. The tests look only at what reaches the server, so the follow-up can change the transport underneath them. goleak's TestMain finally has tests to guard. Statement coverage is 100%.example/becameexample-project/like in the other clients and reads the token and ingesting host from the environment.handler.gois gofmt-ed. No other code change.Verified locally:
go test -racegreen on Go 1.25, golangci-lint clean, actionlint clean. The example sent three records to a test source on the clanker team and they arrived with the newlogger.name. The Release bump step was rehearsed on a clone: 1.4.4 → 1.5.0 forminor, 2.0.0 with the module moved to/v2and a passing build formajor,retryrefuses without a tag, a tagged HEAD refusespatch, andretryon a tagged HEAD checks the tag out and reads the module path from it.Repository setting this relies on: main is unprotected today and the Release workflow's version push needs it to stay that way, or the GitHub Actions app must be allowed to bypass the pull request requirement as in the Ruby repos.
🤖 Generated with Claude Code