tokentrace is distributed as a Go module. There are no system dependencies, no pre-compiled binaries to download, and no background process to run.
go.mod) in your projectgo get github.com/greynewell/tokentrace
This adds tokentrace to your go.mod and downloads the module. The package has no external dependencies — go get will not pull in any third-party libraries.
Confirm the module is present:
go list -m github.com/greynewell/tokentrace
Expected output:
github.com/greynewell/tokentrace v0.x.y
Compile a minimal program to confirm the import works:
package main
import (
"fmt"
"github.com/greynewell/tokentrace"
)
func main() {
t := tokentrace.New(tokentrace.Config{
Transport: tokentrace.StdoutTransport(),
})
fmt.Println("tokentrace version:", t.Version())
}
To update to the latest release:
go get github.com/greynewell/tokentrace@latest
go mod tidy
tokentrace can serve a metrics and ingestion HTTP API from within your application process. Enable it by setting HTTPServer in the config:
tracer := tokentrace.New(tokentrace.Config{
Transport: tokentrace.FileTransport("./traces.jsonl"),
HTTPServer: &tokentrace.HTTPServerConfig{
Addr: ":9090",
MetricsPath: "/metrics",
PrometheusPath: "/metrics/prometheus",
IngestPath: "/spans",
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
},
})
The HTTP server starts in the background when tokentrace.New is called. It does not block the main goroutine. Shut it down cleanly by calling tracer.Shutdown(ctx).
If you prefer to run the HTTP server as a separate process (for example, as a sidecar that receives spans from multiple application instances), see the HTTP API reference.
tokentrace.yml schema reference.