metrics
This commit is contained in:
@@ -98,6 +98,13 @@ func authSecret() []byte {
|
||||
var podIp = os.Getenv("POD_IP")
|
||||
var name = os.Getenv("POD_NAME")
|
||||
|
||||
// profileMetrics is the shared prometheus instrumentation for the
|
||||
// profile actor pool and event log. Built once at process start; the
|
||||
// actor package's touch sites are nil-safe so a test binary could pass
|
||||
// nil. Package-level so tests in this package can construct a pool
|
||||
// without re-registering (cart/checkout use the same pattern).
|
||||
var profileMetrics = actor.NewMetrics("profile")
|
||||
|
||||
// loadUCPProfileSigner loads the UCP ECDSA signing key from the path specified in
|
||||
// the UCP_SIGNING_KEY_PATH environment variable. Returns nil if unset or unreadable.
|
||||
func loadUCPProfileSigner() *ucp.SigningConfig {
|
||||
@@ -126,10 +133,12 @@ func main() {
|
||||
log.Printf("warning: could not create profile data directory %s: %v", profileDir, err)
|
||||
}
|
||||
diskStorage := actor.NewDiskStorage[profile.ProfileGrain](profileDir, reg)
|
||||
diskStorage.SetMetrics(profileMetrics)
|
||||
|
||||
poolConfig := actor.GrainPoolConfig[profile.ProfileGrain]{
|
||||
MutationRegistry: reg,
|
||||
Storage: diskStorage,
|
||||
Metrics: profileMetrics,
|
||||
Spawn: func(ctx context.Context, id uint64) (actor.Grain[profile.ProfileGrain], error) {
|
||||
ret := profile.NewProfileGrain(id, time.Now())
|
||||
err := diskStorage.LoadEvents(ctx, id, ret)
|
||||
|
||||
Reference in New Issue
Block a user