Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add metrics for cli idling events #24

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions handlers/idler/cli-kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func (h *Idler) kubernetesCLI(ctx context.Context, opLog logr.Logger, namespace
} else {
opLog.Info(fmt.Sprintf("Deployment %s scaled to 0", deployment.ObjectMeta.Name))
}
cliIdleEvents.Inc()
} else {
opLog.Info(fmt.Sprintf("Deployment %s would be scaled to 0", deployment.ObjectMeta.Name))
}
Expand Down
8 changes: 6 additions & 2 deletions handlers/idler/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import (
)

var (
idleEvents = promauto.NewCounter(prometheus.CounterOpts{
serviceIdleEvents = promauto.NewCounter(prometheus.CounterOpts{
Name: "aergia_idling_events",
Help: "The total number of events that aergia has processed to idle environments",
Help: "The total number of service idling events that aergia has processed to idle environments",
})
cliIdleEvents = promauto.NewCounter(prometheus.CounterOpts{
Name: "aergia_cli_idling_events",
Help: "The total number of cli idling events that aergia has processed to idle environments",
})
)
2 changes: 1 addition & 1 deletion handlers/idler/service-kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func (h *Idler) patchIngress(ctx context.Context, opLog logr.Logger, namespace c
},
},
})
idleEvents.Inc()
serviceIdleEvents.Inc()
if err := h.Client.Patch(ctx, namespaceCopy, client.RawPatch(types.MergePatchType, mergePatch)); err != nil {
return fmt.Errorf(fmt.Sprintf("Error patching namespace %s", namespace.Name))
}
Expand Down
Loading