Files
coder/coderd/pproflabel/pproflabel.go
T
George K 6af0f4d698 feat: add workspace restart functionality to API (#25757)
This models restart as durable orchestration of existing stop and
start workspace builds instead of adding a new restart transition.
Keeping restart as two existing transitions preserves the current
build/provisioner model.

The child start build is created only after the parent stop build
succeeds, rather than being inserted immediately in a pending
state. That keeps `workspace_builds` aligned with actual
provisioner-ready work and avoids introducing a second
pending-build lifecycle that the provisioner and build acquisition
paths would need to understand.

Refs: https://linear.app/codercom/issue/PLAT-143
2026-07-07 09:18:30 -07:00

48 lines
1.7 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"
// ServiceWorkspaceBuildOrchestrator fulfills workspace build
// orchestrations once their parent build reaches a terminal state.
ServiceWorkspaceBuildOrchestrator = "workspace-build-orchestrator"
RequestTypeTag = "coder_request_type"
)
func Service(name string, pairs ...string) pprof.LabelSet {
return pprof.Labels(append([]string{ServiceTag, name}, pairs...)...)
}