Skip to content

Commit

Permalink
metrics: Add basic API, agent and ova metrics
Browse files Browse the repository at this point in the history
Metrics for api, agent and ova are implemented.
For API (agent and api_server) a middleware for chi router is used
giving basic metrics.
Agent: count the agents by status
OVA: count the downloads by status (failed or success)

Basic grafana dashboard is added.

Signed-off-by: Cosmin Tupangiu <[email protected]>
  • Loading branch information
tupyy committed Jan 14, 2025
1 parent 3b204bc commit 17c8700
Show file tree
Hide file tree
Showing 14 changed files with 1,871 additions and 7 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ deploy-on-openshift:
oc create secret generic migration-planner-secret -n ${MIGRATION_PLANNER_NAMESPACE} --from-literal=config_server=http://$$config_server --from-literal=config_server_ui=https://$$config_server_ui/migrate/wizard || true
ls deploy/k8s | awk '! /secret|service|template/' | xargs -I {} oc apply -n ${MIGRATION_PLANNER_NAMESPACE} -f deploy/k8s/{}

deploy-local-obs:
@podman play kube --network host deploy/observability.yml

undeploy-local-obs:
@podman kube down deploy/observability.yml

undeploy-on-openshift:
oc delete route planner || true
oc delete route planner-agent || true
Expand Down
12 changes: 12 additions & 0 deletions cmd/planner-api/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ var runCmd = &cobra.Command{
}
}()

go func() {
defer cancel()
listener, err := newListener("0.0.0.0:8080")
if err != nil {
zap.S().Named("metrics_server").Fatalf("creating listener: %s", err)
}
metricsServer := apiserver.NewMetricServer("0.0.0.0:8080", listener)
if err := metricsServer.Run(ctx); err != nil {
zap.S().Named("metrics_server").Fatalf("failed to run metrics server: %s", err)
}
}()

<-ctx.Done()
_ = ep.Close()

Expand Down
Loading

0 comments on commit 17c8700

Please sign in to comment.