correct metrics name of cache size (#3805)

Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
This commit is contained in:
Zou Nengren 2020-04-04 00:30:06 +08:00 committed by GitHub
parent 7bb32dee7d
commit 4ccd55e95e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 7 deletions

View file

@ -94,7 +94,7 @@ Entries with 0 TTL will remain in the cache until randomly evicted when the shar
If monitoring is enabled (via the \fIprometheus\fP plugin) then the following metrics are exported: If monitoring is enabled (via the \fIprometheus\fP plugin) then the following metrics are exported:
.IP \(bu 4 .IP \(bu 4
\fB\fCcoredns_cache_size{server, type}\fR - Total elements in the cache by cache type. \fB\fCcoredns_cache_entries{server, type}\fR - Total elements in the cache by cache type.
.IP \(bu 4 .IP \(bu 4
\fB\fCcoredns_cache_hits_total{server, type}\fR - Counter of cache hits by cache type. \fB\fCcoredns_cache_hits_total{server, type}\fR - Counter of cache hits by cache type.
.IP \(bu 4 .IP \(bu 4

View file

@ -51,6 +51,8 @@ It's mostly dropping `count` from `_total` metrics names:
* `coredns_reload_failed_count_total` -\> `coredns_reload_failed_total` * `coredns_reload_failed_count_total` -\> `coredns_reload_failed_total`
* `coredns_cache_size` -\> `coredns_cache_entries`
And note that And note that
`coredns_dns_request_type_count_total` is now part of `coredns_dns_requests_total` . `coredns_dns_request_type_count_total` is now part of `coredns_dns_requests_total` .

View file

@ -70,7 +70,7 @@ Entries with 0 TTL will remain in the cache until randomly evicted when the shar
If monitoring is enabled (via the *prometheus* plugin) then the following metrics are exported: If monitoring is enabled (via the *prometheus* plugin) then the following metrics are exported:
* `coredns_cache_size{server, type}` - Total elements in the cache by cache type. * `coredns_cache_entries{server, type}` - Total elements in the cache by cache type.
* `coredns_cache_hits_total{server, type}` - Counter of cache hits by cache type. * `coredns_cache_hits_total{server, type}` - Counter of cache hits by cache type.
* `coredns_cache_misses_total{server}` - Counter of cache misses. * `coredns_cache_misses_total{server}` - Counter of cache misses.
* `coredns_cache_drops_total{server}` - Counter of responses excluded from the cache due to request/response question name mismatch. * `coredns_cache_drops_total{server}` - Counter of responses excluded from the cache due to request/response question name mismatch.

View file

@ -11,7 +11,7 @@ var (
cacheSize = prometheus.NewGaugeVec(prometheus.GaugeOpts{ cacheSize = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: plugin.Namespace, Namespace: plugin.Namespace,
Subsystem: "cache", Subsystem: "cache",
Name: "size", Name: "entries",
Help: "The number of elements in the cache.", Help: "The number of elements in the cache.",
}, []string{"server", "type"}) }, []string{"server", "type"})
// cacheHits is counter of cache hits by cache type. // cacheHits is counter of cache hits by cache type.

View file

@ -138,7 +138,7 @@ func TestMetricsAuto(t *testing.T) {
// Show that when 2 blocs share the same metric listener (they have a prometheus plugin on the same listening address), // Show that when 2 blocs share the same metric listener (they have a prometheus plugin on the same listening address),
// ALL the metrics of the second bloc in order are declared in prometheus, especially the plugins that are used ONLY in the second bloc // ALL the metrics of the second bloc in order are declared in prometheus, especially the plugins that are used ONLY in the second bloc
func TestMetricsSeveralBlocs(t *testing.T) { func TestMetricsSeveralBlocs(t *testing.T) {
cacheSizeMetricName := "coredns_cache_size" cacheSizeMetricName := "coredns_cache_entries"
addrMetrics := "localhost:9155" addrMetrics := "localhost:9155"
corefile := fmt.Sprintf(` corefile := fmt.Sprintf(`
@ -227,7 +227,7 @@ example.com:0 {
func TestMetricsAvailable(t *testing.T) { func TestMetricsAvailable(t *testing.T) {
procMetric := "coredns_build_info" procMetric := "coredns_build_info"
procCache := "coredns_cache_size" procCache := "coredns_cache_entries"
procCacheMiss := "coredns_cache_misses_total" procCacheMiss := "coredns_cache_misses_total"
procForward := "coredns_dns_request_duration_seconds" procForward := "coredns_dns_request_duration_seconds"
corefileWithMetrics := ` corefileWithMetrics := `

View file

@ -209,7 +209,7 @@ func TestMetricsAvailableAfterReload(t *testing.T) {
// that is not used in another test // that is not used in another test
promAddress := "127.0.0.1:53186" promAddress := "127.0.0.1:53186"
procMetric := "coredns_build_info" procMetric := "coredns_build_info"
procCache := "coredns_cache_size" procCache := "coredns_cache_entries"
procForward := "coredns_dns_request_duration_seconds" procForward := "coredns_dns_request_duration_seconds"
corefileWithMetrics := ` corefileWithMetrics := `
.:0 { .:0 {
@ -263,7 +263,7 @@ func TestMetricsAvailableAfterReloadAndFailedReload(t *testing.T) {
// that is not used in another test // that is not used in another test
promAddress := "127.0.0.1:53187" promAddress := "127.0.0.1:53187"
procMetric := "coredns_build_info" procMetric := "coredns_build_info"
procCache := "coredns_cache_size" procCache := "coredns_cache_entries"
procForward := "coredns_dns_request_duration_seconds" procForward := "coredns_dns_request_duration_seconds"
corefileWithMetrics := ` corefileWithMetrics := `
.:0 { .:0 {