Skip to content

Commit

Permalink
dashboard (#1361)
Browse files Browse the repository at this point in the history
Signed-off-by: Hiranmoy Das Chowdhury <[email protected]>
  • Loading branch information
HiranmoyChowdhury authored Nov 8, 2024
1 parent a3f70c9 commit 7211208
Show file tree
Hide file tree
Showing 3 changed files with 250 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: metrics.appscode.com/v1alpha1
kind: MetricsConfiguration
metadata:
name: catalog-kubedb-com-pgbouncerversion
spec:
targetRef:
apiVersion: catalog.kubedb.com/v1alpha1
kind: PgBouncerVersion
metrics:
- name: created
help: "Unix creation timestamp"
type: gauge
field:
path: .metadata.creationTimestamp
type: DateTime
metricValue:
valueFromPath: .metadata.creationTimestamp

- name: info
help: "PgBouncer versions info"
type: gauge
labels:
- key: db_image
valuePath: .spec.pgBouncer.image
- key: deprecated
valuePath: .spec.deprecated
- key: exporter_image
valuePath: .spec.exporter.image
metricValue:
value: 1
175 changes: 175 additions & 0 deletions charts/kubedb-metrics/templates/pgbouncer/kubedb-com-pgbouncer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
apiVersion: metrics.appscode.com/v1alpha1
kind: MetricsConfiguration
metadata:
name: kubedb-com-pgbouncer
spec:
targetRef:
apiVersion: kubedb.com/v1
kind: PgBouncer
commonLabels:
- key: app
valuePath: .metadata.name
- key: app_namespace
valuePath: .metadata.namespace
metrics:
- name: created
help: "Unix creation timestamp"
type: gauge
field:
path: .metadata.creationTimestamp
type: DateTime
metricValue:
valueFromPath: .metadata.creationTimestamp

- name: status_phase
help: "PgBouncer instance current phase"
type: gauge
field:
path: .status.phase
type: String
params:
- key: phase
valuePath: .status.phase
states:
labelKey: phase
values:
- labelValue: Ready
metricValue:
valueFromExpression: "int(phase == 'Ready')"
- labelValue: Halted
metricValue:
valueFromExpression: "int(phase == 'Halted')"
- labelValue: Provisioning
metricValue:
valueFromExpression: "int(phase == 'Provisioning')"
- labelValue: Critical
metricValue:
valueFromExpression: "int(phase == 'Critical')"
- labelValue: NotReady
metricValue:
valueFromExpression: "int(phase == 'NotReady')"
- labelValue: DataRestoring
metricValue:
valueFromExpression: "int(phase == 'DataRestoring')"

- name: info
help: "PgBouncer instance information"
type: gauge
labels:
- key: sslMode
valuePath: .spec.sslMode
- key: backend
valuePath: .spec.database.databaseName
- key: deletionPolicy
valuePath: .spec.deletionPolicy
- key: version
valuePath: .spec.version
metricValue:
value: 1

- name: status_conditions
help: "PgBouncer instance status condition"
type: gauge
field:
path: .status.conditions
type: Array
labels:
- key: type
valuePath: .status.conditions[*].type
- key: status
valuePath: .status.conditions[*].status
metricValue:
value: 1

- name: resource_request_cpu
help: "Requested CPU by PgBouncer in core"
type: gauge
labels:
- key: unit
value: core
params:
- key: obj
valuePath: .
- key: resourceType
value: cpu
metricValue:
valueFromExpression: total_resource_requests(obj, resourceType)

- name: resource_request_memory
help: "Requested memory by PgBouncer in byte"
type: gauge
labels:
- key: unit
value: byte
params:
- key: obj
valuePath: .
- key: resourceType
value: memory
metricValue:
valueFromExpression: total_resource_requests(obj, resourceType)

- name: resource_request_storage
help: "Requested storage by PgBouncer in byte"
type: gauge
labels:
- key: unit
value: byte
params:
- key: obj
valuePath: .
- key: resourceType
value: storage
metricValue:
valueFromExpression: total_resource_requests(obj, resourceType)

- name: resource_limit_cpu
help: "CPU limit for PgBouncer in core"
type: gauge
labels:
- key: unit
value: core
params:
- key: obj
valuePath: .
- key: resourceType
value: cpu
metricValue:
valueFromExpression: total_resource_limits(obj, resourceType)

- name: resource_limit_memory
help: "Memory limit for PgBouncer in byte"
type: gauge
labels:
- key: unit
value: byte
params:
- key: obj
valuePath: .
- key: resourceType
value: memory
metricValue:
valueFromExpression: total_resource_limits(obj, resourceType)

- name: resource_limit_storage
help: "Storage limit for PgBouncer in byte"
type: gauge
labels:
- key: unit
value: byte
params:
- key: obj
valuePath: .
- key: resourceType
value: storage
metricValue:
valueFromExpression: total_resource_limits(obj, resourceType)

- name: replicas
help: "Number of replicas in the PgBouncer"
type: gauge
field:
path: .spec.replicas
type: Integer
metricValue:
valueFromPath: .spec.replicas
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
apiVersion: metrics.appscode.com/v1alpha1
kind: MetricsConfiguration
metadata:
name: ops-kubedb-com-pgbounceropsrequest
spec:
targetRef:
apiVersion: ops.kubedb.com/v1alpha1
kind: PgBouncerOpsRequest
commonLabels:
- key: app
valuePath: .spec.serverRef.name
- key: app_namespace
valuePath: .metadata.namespace
- key: type
valuePath: .spec.type
metrics:
- name: type
help: "PgBouncer OpsRequest Type"
type: gauge
metricValue:
value: 1
- name: status_phase
help: "The current phase of PgBouncer OpsRequest."
type: gauge
field:
path: .status.phase
type: String
params:
- key: phase
valuePath: .status.phase
states:
labelKey: phase
values:
- labelValue: Progressing
metricValue:
valueFromExpression: "int(phase == 'Progressing')"
- labelValue: Failed
metricValue:
valueFromExpression: "int(phase == 'Failed')"
- labelValue: Pending
metricValue:
valueFromExpression: "int(phase == 'Pending')"
- labelValue: Successful
metricValue:
valueFromExpression: "int(phase == 'Successful')"

0 comments on commit 7211208

Please sign in to comment.