change prefix to make it consistent with kubernetes_build_info
Change-Id: Ia0f65bec6c0dc092c3db9b5b1c22059a0c8c9776
This commit is contained in:
parent
dc2c486059
commit
2f2b018a3e
@ -28,7 +28,7 @@ var (
|
|||||||
// featureInfo is a Prometheus Gauge metrics used for recording the enablement of a k8s feature.
|
// featureInfo is a Prometheus Gauge metrics used for recording the enablement of a k8s feature.
|
||||||
featureInfo = k8smetrics.NewGaugeVec(
|
featureInfo = k8smetrics.NewGaugeVec(
|
||||||
&k8smetrics.GaugeOpts{
|
&k8smetrics.GaugeOpts{
|
||||||
Namespace: "k8s",
|
Namespace: "kubernetes",
|
||||||
Name: "feature_info",
|
Name: "feature_info",
|
||||||
Help: "This metric records the data about the stage and enablement of a k8s feature.",
|
Help: "This metric records the data about the stage and enablement of a k8s feature.",
|
||||||
StabilityLevel: k8smetrics.ALPHA,
|
StabilityLevel: k8smetrics.ALPHA,
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
testedMetrics = []string{"k8s_feature_info"}
|
testedMetrics = []string{"kubernetes_feature_info"}
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestObserveHealthcheck(t *testing.T) {
|
func TestObserveHealthcheck(t *testing.T) {
|
||||||
@ -46,9 +46,9 @@ func TestObserveHealthcheck(t *testing.T) {
|
|||||||
stage: "ALPHA",
|
stage: "ALPHA",
|
||||||
enabled: true,
|
enabled: true,
|
||||||
want: `
|
want: `
|
||||||
# HELP k8s_feature_info [ALPHA] This metric records the data about the stage and enablement of a k8s feature.
|
# HELP kubernetes_feature_info [ALPHA] This metric records the data about the stage and enablement of a k8s feature.
|
||||||
# TYPE k8s_feature_info gauge
|
# TYPE kubernetes_feature_info gauge
|
||||||
k8s_feature_info{enabled="true",name="feature-a",stage="ALPHA"} 1
|
kubernetes_feature_info{enabled="true",name="feature-a",stage="ALPHA"} 1
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -57,9 +57,9 @@ func TestObserveHealthcheck(t *testing.T) {
|
|||||||
stage: "BETA",
|
stage: "BETA",
|
||||||
enabled: false,
|
enabled: false,
|
||||||
want: `
|
want: `
|
||||||
# HELP k8s_feature_info [ALPHA] This metric records the data about the stage and enablement of a k8s feature.
|
# HELP kubernetes_feature_info [ALPHA] This metric records the data about the stage and enablement of a k8s feature.
|
||||||
# TYPE k8s_feature_info gauge
|
# TYPE kubernetes_feature_info gauge
|
||||||
k8s_feature_info{enabled="false",name="feature-b",stage="BETA"} 1
|
kubernetes_feature_info{enabled="false",name="feature-b",stage="BETA"} 1
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ var (
|
|||||||
// healthcheck is a Prometheus Gauge metrics used for recording the results of a k8s healthcheck.
|
// healthcheck is a Prometheus Gauge metrics used for recording the results of a k8s healthcheck.
|
||||||
healthcheck = k8smetrics.NewGaugeVec(
|
healthcheck = k8smetrics.NewGaugeVec(
|
||||||
&k8smetrics.GaugeOpts{
|
&k8smetrics.GaugeOpts{
|
||||||
Namespace: "k8s",
|
Namespace: "kubernetes",
|
||||||
Name: "healthcheck",
|
Name: "healthcheck",
|
||||||
Help: "This metric records the result of a single healthcheck.",
|
Help: "This metric records the result of a single healthcheck.",
|
||||||
StabilityLevel: k8smetrics.ALPHA,
|
StabilityLevel: k8smetrics.ALPHA,
|
||||||
@ -55,7 +55,7 @@ var (
|
|||||||
// healthchecksTotal is a Prometheus Counter metrics used for counting the results of a k8s healthcheck.
|
// healthchecksTotal is a Prometheus Counter metrics used for counting the results of a k8s healthcheck.
|
||||||
healthchecksTotal = k8smetrics.NewCounterVec(
|
healthchecksTotal = k8smetrics.NewCounterVec(
|
||||||
&k8smetrics.CounterOpts{
|
&k8smetrics.CounterOpts{
|
||||||
Namespace: "k8s",
|
Namespace: "kubernetes",
|
||||||
Name: "healthchecks_total",
|
Name: "healthchecks_total",
|
||||||
Help: "This metric records the results of all healthcheck.",
|
Help: "This metric records the results of all healthcheck.",
|
||||||
StabilityLevel: k8smetrics.ALPHA,
|
StabilityLevel: k8smetrics.ALPHA,
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
testedMetrics = []string{"k8s_healthcheck", "k8s_healthchecks_total"}
|
testedMetrics = []string{"kubernetes_healthcheck", "kubernetes_healthchecks_total"}
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestObserveHealthcheck(t *testing.T) {
|
func TestObserveHealthcheck(t *testing.T) {
|
||||||
@ -35,14 +35,14 @@ func TestObserveHealthcheck(t *testing.T) {
|
|||||||
initialState := Error
|
initialState := Error
|
||||||
healthcheckName := "healthcheck-a"
|
healthcheckName := "healthcheck-a"
|
||||||
initialOutput := `
|
initialOutput := `
|
||||||
# HELP k8s_healthcheck [ALPHA] This metric records the result of a single healthcheck.
|
# HELP kubernetes_healthcheck [ALPHA] This metric records the result of a single healthcheck.
|
||||||
# TYPE k8s_healthcheck gauge
|
# TYPE kubernetes_healthcheck gauge
|
||||||
k8s_healthcheck{name="healthcheck-a",status="error",type="healthz"} 1
|
kubernetes_healthcheck{name="healthcheck-a",status="error",type="healthz"} 1
|
||||||
k8s_healthcheck{name="healthcheck-a",status="pending",type="healthz"} 0
|
kubernetes_healthcheck{name="healthcheck-a",status="pending",type="healthz"} 0
|
||||||
k8s_healthcheck{name="healthcheck-a",status="success",type="healthz"} 0
|
kubernetes_healthcheck{name="healthcheck-a",status="success",type="healthz"} 0
|
||||||
# HELP k8s_healthchecks_total [ALPHA] This metric records the results of all healthcheck.
|
# HELP kubernetes_healthchecks_total [ALPHA] This metric records the results of all healthcheck.
|
||||||
# TYPE k8s_healthchecks_total counter
|
# TYPE kubernetes_healthchecks_total counter
|
||||||
k8s_healthchecks_total{name="healthcheck-a",status="error",type="healthz"} 1
|
kubernetes_healthchecks_total{name="healthcheck-a",status="error",type="healthz"} 1
|
||||||
`
|
`
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
desc string
|
desc string
|
||||||
@ -57,15 +57,15 @@ func TestObserveHealthcheck(t *testing.T) {
|
|||||||
hcType: Healthz,
|
hcType: Healthz,
|
||||||
hcStatus: Pending,
|
hcStatus: Pending,
|
||||||
want: `
|
want: `
|
||||||
# HELP k8s_healthcheck [ALPHA] This metric records the result of a single healthcheck.
|
# HELP kubernetes_healthcheck [ALPHA] This metric records the result of a single healthcheck.
|
||||||
# TYPE k8s_healthcheck gauge
|
# TYPE kubernetes_healthcheck gauge
|
||||||
k8s_healthcheck{name="healthcheck-a",status="error",type="healthz"} 0
|
kubernetes_healthcheck{name="healthcheck-a",status="error",type="healthz"} 0
|
||||||
k8s_healthcheck{name="healthcheck-a",status="pending",type="healthz"} 1
|
kubernetes_healthcheck{name="healthcheck-a",status="pending",type="healthz"} 1
|
||||||
k8s_healthcheck{name="healthcheck-a",status="success",type="healthz"} 0
|
kubernetes_healthcheck{name="healthcheck-a",status="success",type="healthz"} 0
|
||||||
# HELP k8s_healthchecks_total [ALPHA] This metric records the results of all healthcheck.
|
# HELP kubernetes_healthchecks_total [ALPHA] This metric records the results of all healthcheck.
|
||||||
# TYPE k8s_healthchecks_total counter
|
# TYPE kubernetes_healthchecks_total counter
|
||||||
k8s_healthchecks_total{name="healthcheck-a",status="error",type="healthz"} 1
|
kubernetes_healthchecks_total{name="healthcheck-a",status="error",type="healthz"} 1
|
||||||
k8s_healthchecks_total{name="healthcheck-a",status="pending",type="healthz"} 1
|
kubernetes_healthchecks_total{name="healthcheck-a",status="pending",type="healthz"} 1
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -74,15 +74,15 @@ func TestObserveHealthcheck(t *testing.T) {
|
|||||||
hcType: Healthz,
|
hcType: Healthz,
|
||||||
hcStatus: Success,
|
hcStatus: Success,
|
||||||
want: `
|
want: `
|
||||||
# HELP k8s_healthcheck [ALPHA] This metric records the result of a single healthcheck.
|
# HELP kubernetes_healthcheck [ALPHA] This metric records the result of a single healthcheck.
|
||||||
# TYPE k8s_healthcheck gauge
|
# TYPE kubernetes_healthcheck gauge
|
||||||
k8s_healthcheck{name="healthcheck-a",status="error",type="healthz"} 0
|
kubernetes_healthcheck{name="healthcheck-a",status="error",type="healthz"} 0
|
||||||
k8s_healthcheck{name="healthcheck-a",status="pending",type="healthz"} 0
|
kubernetes_healthcheck{name="healthcheck-a",status="pending",type="healthz"} 0
|
||||||
k8s_healthcheck{name="healthcheck-a",status="success",type="healthz"} 1
|
kubernetes_healthcheck{name="healthcheck-a",status="success",type="healthz"} 1
|
||||||
# HELP k8s_healthchecks_total [ALPHA] This metric records the results of all healthcheck.
|
# HELP kubernetes_healthchecks_total [ALPHA] This metric records the results of all healthcheck.
|
||||||
# TYPE k8s_healthchecks_total counter
|
# TYPE kubernetes_healthchecks_total counter
|
||||||
k8s_healthchecks_total{name="healthcheck-a",status="error",type="healthz"} 1
|
kubernetes_healthchecks_total{name="healthcheck-a",status="error",type="healthz"} 1
|
||||||
k8s_healthchecks_total{name="healthcheck-a",status="success",type="healthz"} 1
|
kubernetes_healthchecks_total{name="healthcheck-a",status="success",type="healthz"} 1
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user