Skip to content

Go

pyroscope-go is Grafana’s official Go SDK for continuous profiling. It samples CPU on-CPU time and, optionally, heap allocations, then pushes them straight to KloudMate’s ingest endpoint.

  • The ingest endpoint: https://otel.kloudmate.com/v1/profiles/pyroscope
  • An API key — go to Settings → API Keys, click Add New, and create an Ingest Key – Backend. Copy it immediately; KloudMate shows it only once.
go get github.com/grafana/pyroscope-go

Call pyroscope.Start once, as early as possible in main():

package main

import "github.com/grafana/pyroscope-go"

func main() {
	pyroscope.Start(pyroscope.Config{
		ApplicationName:   "my-service",
		ServerAddress:     "https://otel.kloudmate.com/v1/profiles/pyroscope",
		BasicAuthUser:     "KloudMate",
		BasicAuthPassword: "YOUR_API_KEY",
		ProfileTypes: []pyroscope.ProfileType{
			pyroscope.ProfileCPU,
			pyroscope.ProfileAllocObjects,
			pyroscope.ProfileAllocSpace,
			pyroscope.ProfileInuseObjects,
			pyroscope.ProfileInuseSpace,
		},
	})

	// the rest of your application
}

Swap my-service for a name that identifies this deployment, and YOUR_API_KEY for the key you copied above. Drop any ProfileType you don’t want reported — CPU alone is enough to get started.

Open Profiling → All Services, select cpu from the profile type dropdown, and give it a minute. Your service’s card appears with a live chart as soon as the first samples land.

If nothing shows up, check that BasicAuthUser is set to the literal string KloudMate — a missing username is the most common cause of a silent 401.