Last updated Nov 8, 2025

Go SDK

Integrate event tracking with Go microservices and workers.

Installation

Install straight from this repo and pin a tag or commit for deterministic builds.

go get github.com/fumi-ops/fumi/packages/sdk-go@<tag-or-commit>

Emit an event

package main

import (
	"context"
	"os"
)

func main() {
	client := NewClient(
		"https://your-worker.workers.dev",
		os.Getenv("FUMI_API_KEY"),
	)

	resp, err := client.Track(
		context.Background(),
		TrackEventPayload{Name: "app.start"},
	)
	if err != nil {
		panic(err)
	}
	_ = resp
}
  • Reuse a single client per process to avoid reconnect overhead.
  • Attach middleware to inject contextual metadata (release SHA, cluster ID).
  • Use Go’s context.Context deadlines to guard against slow network conditions.
  • Pass ContextID when you need to correlate events from the same deployment or tenant.