-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: João Vilaça <[email protected]>
- Loading branch information
1 parent
4f1a32a
commit 393170b
Showing
21 changed files
with
138 additions
and
478 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package metrics | ||
|
||
import "github.com/machadovilaca/operator-observability/pkg/operatormetrics" | ||
|
||
var ( | ||
operatorMetrics = []operatormetrics.Metric{ | ||
sspOperatorReconcileSucceeded, | ||
} | ||
|
||
sspOperatorReconcileSucceeded = operatormetrics.NewGauge( | ||
operatormetrics.MetricOpts{ | ||
Name: "kubevirt_ssp_operator_reconcile_succeeded", | ||
Help: "Set to 1 if the reconcile process of all operands completes with no errors, and to 0 otherwise", | ||
}, | ||
) | ||
) | ||
|
||
func SetSspOperatorReconcileSucceeded(isSucceeded bool) { | ||
value := 0.0 | ||
if isSucceeded { | ||
value = 1.0 | ||
} | ||
sspOperatorReconcileSucceeded.Set(value) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package metrics | ||
|
||
import ( | ||
"github.com/machadovilaca/operator-observability/pkg/operatormetrics" | ||
ioprometheusclient "github.com/prometheus/client_model/go" | ||
) | ||
|
||
var ( | ||
templateMetrics = []operatormetrics.Metric{ | ||
commonTemplatesRestored, | ||
} | ||
|
||
commonTemplatesRestored = operatormetrics.NewCounter( | ||
operatormetrics.MetricOpts{ | ||
Name: "kubevirt_ssp_common_templates_restored_total", | ||
Help: "The total number of common templates restored by the operator back to their original state", | ||
}, | ||
) | ||
) | ||
|
||
func IncCommonTemplatesRestored() { | ||
commonTemplatesRestored.Inc() | ||
} | ||
|
||
func GetCommonTemplatesRestored() (float64, error) { | ||
dto := &ioprometheusclient.Metric{} | ||
err := commonTemplatesRestored.Write(dto) | ||
if err != nil { | ||
return 0, err | ||
} | ||
return dto.Counter.GetValue(), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package metrics | ||
|
||
import ( | ||
"github.com/machadovilaca/operator-observability/pkg/operatormetrics" | ||
) | ||
|
||
func SetupMetrics() { | ||
if err := operatormetrics.RegisterMetrics( | ||
templateMetrics, | ||
); err != nil { | ||
panic(err) | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
pkg/monitoring/metrics/template-validator/template_metrics.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package metrics | ||
|
||
import ( | ||
"github.com/machadovilaca/operator-observability/pkg/operatormetrics" | ||
) | ||
|
||
var ( | ||
templateMetrics = []operatormetrics.Metric{ | ||
templateValidatorRejected, | ||
} | ||
|
||
templateValidatorRejected = operatormetrics.NewCounter( | ||
operatormetrics.MetricOpts{ | ||
Name: "kubevirt_ssp_template_validator_rejected_total", | ||
Help: "The total number of rejected template validators", | ||
}, | ||
) | ||
) | ||
|
||
func IncTemplateValidatorRejected() { | ||
templateValidatorRejected.Inc() | ||
} |
Oops, something went wrong.