Files
coder/coderd/pproflabel/pproflabel.go
T
Steven Masley 84de391f26 chore: add tallyman events for ai seat tracking (#22689)
AI seat tracking inserted as heartbeat into usage table.
2026-03-18 09:30:22 -05:00

45 lines
1.5 KiB
Go

package pproflabel
import (
"context"
"runtime/pprof"
)
// Go is just a convince wrapper to set off a labeled goroutine.
func Go(ctx context.Context, labels pprof.LabelSet, f func(context.Context)) {
go pprof.Do(ctx, labels, f)
}
func Do(ctx context.Context, labels pprof.LabelSet, f func(context.Context)) {
pprof.Do(ctx, labels, f)
}
const (
// ServiceTag should not collide with the pyroscope built-in tag "service".
// Use `coder_` to avoid collisions.
ServiceTag = "coder_service"
ServiceHTTPServer = "http-api"
ServiceLifecycles = "lifecycle-executor"
ServicePrebuildReconciler = "prebuilds-reconciler"
ServiceTerraformProvisioner = "terraform-provisioner"
ServiceDBPurge = "db-purge"
ServiceNotifications = "notifications"
ServiceReplicaSync = "replica-sync"
// ServiceMetricCollector collects metrics from insights in the database and
// exports them in a prometheus collector format.
ServiceMetricCollector = "metrics-collector"
// ServiceAgentMetricAggregator merges agent metrics and exports them in a
// prometheus collector format.
ServiceAgentMetricAggregator = "agent-metrics-aggregator"
// ServiceTallymanPublisher publishes usage events to coder/tallyman.
ServiceTallymanPublisher = "tallyman-publisher"
ServiceUsageEventCron = "usage-event-cron"
RequestTypeTag = "coder_request_type"
)
func Service(name string, pairs ...string) pprof.LabelSet {
return pprof.Labels(append([]string{ServiceTag, name}, pairs...)...)
}