generated from cybozu-go/neco-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from cybozu-go/add-custom-metrics
Add custom metrics
- Loading branch information
Showing
5 changed files
with
190 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package metrics | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
k8smetrics "sigs.k8s.io/controller-runtime/pkg/metrics" | ||
) | ||
|
||
const ( | ||
metricsNameSpace = "cattage" | ||
tenantSubsystem = "tenant" | ||
) | ||
|
||
var ( | ||
HealthyVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ | ||
Namespace: metricsNameSpace, | ||
Subsystem: tenantSubsystem, | ||
Name: "healthy", | ||
Help: "The tenant status about healthy condition", | ||
}, []string{"name", "namespace"}) | ||
|
||
UnhealthyVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ | ||
Namespace: metricsNameSpace, | ||
Subsystem: tenantSubsystem, | ||
Name: "unhealthy", | ||
Help: "The tenant status about unhealthy condition", | ||
}, []string{"name", "namespace"}) | ||
) | ||
|
||
func init() { | ||
k8smetrics.Registry.MustRegister(HealthyVec, UnhealthyVec) | ||
} |