Skip to content

Commit

Permalink
fix: Metrics update interval ticker
Browse files Browse the repository at this point in the history
  • Loading branch information
alperencelik committed Dec 9, 2024
1 parent 723c86f commit 76038ce
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func main() {

func startMetricsUpdater(ctx context.Context, kubeClient client.Client) {
go func() {
ticker := time.NewTicker(metricsUpdateInterval * time.Second)
ticker := time.NewTicker(metricsUpdateInterval)
defer ticker.Stop()
for range ticker.C {
// Update metrics here
Expand Down
56 changes: 56 additions & 0 deletions grafana/custom-metrics/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,62 @@ customMetrics:
type: gauge
unit: megabytes
expr: sum by (name, namespace) (kubemox_managed_virtual_machine_memory)
- name: container_count
type: gauge
unit: none
expr: sum by (name, namespace) (kubemox_container_count)
- name: container_cpu_cores
type: gauge
unit: none
expr: sum by (name, namespace) (kubemox_container_cpu_cores)
- name: container_memory
type: gauge
unit: megabytes
expr: sum by (name, namespace) (kubemox_container_memory)
- name: virtualmachinetemplate_count
type: gauge
unit: none
expr: sum by (name, namespace) (kubemox_virtual_machine_template_count)
- name: virtualmachinetemplate_cpu_cores
type: gauge
unit: none
expr: sum by (name, namespace) (kubemox_virtual_machine_template_cpu_cores)
- name: virtualmachinetemplate_memory
type: gauge
unit: megabytes
expr: sum by (name, namespace) (kubemox_virtual_machine_template_memory)
- name: virtualmachineset_count
type: gauge
unit: none
expr: sum by (name, namespace) (kubemox_virtual_machine_set_count)
- name: virtualmachineset_cpu_cores
type: gauge
unit: none
expr: sum by (name, namespace) (kubemox_virtual_machine_set_cpu_cores)
- name: virtualmachineset_memory
type: gauge
unit: megabytes
expr: sum by (name, namespace) (kubemox_virtual_machine_set_memory)
- name: virtualmachineset_replicas
type: gauge
unit: none
expr: sum by (name, namespace) (kubemox_virtual_machine_set_replicas)
- name: virtualmachinesnapshot_count
type: gauge
unit: none
expr: sum by (name, namespace) (kubemox_virtual_machine_snapshot_count)
- name: virtualmachinesnapshotpolicy_count
type: gauge
unit: none
expr: sum by (name, namespace) (kubemox_virtual_machine_snapshot_policy_count)
- name: storagedownloadurl_count
type: gauge
unit: none
expr: sum by (name, namespace) (kubemox_storage_download_url_count)
- name: customcertificate_count
type: gauge
unit: none
expr: sum by (name, namespace) (kubemox_custom_certificate_count)

# - metric: # Raw custom metric (required)
# type: # Metric type: counter/gauge/histogram (required)
Expand Down

0 comments on commit 76038ce

Please sign in to comment.