coredns/test
Miek Gieben 6953ab2b4f
Metrics: expand coredns_dns_responses_total with plugin label (#4914)
* Metrics: expand coredns_dns_responses_total with plugin label

This adds (somewhat hacky?) code to add a plugin label to the
coredns_dns_responses_total metric. It's completely obvlious to the
plugin as we just check who called the *recorder.WriteMsg method. We use
runtime.Caller( 1 2 3) to get multiple levels of callers, this should be
deep enough, but it depends on the dns.ResponseWriter wrapping that's
occuring.

README.md of metrics updates and test added in test/metrics_test.go to
check for the label being set.

I went through the plugin to see what metrics could be removed, but
actually didn't find any, the plugin push out metrics that make sense.

Due to the path fiddling to figure out the plugin name I doubt this
works (out-of-the-box) for external plugins, but I haven't tested that.

Signed-off-by: Miek Gieben <miek@miek.nl>

* better comment

Signed-off-by: Miek Gieben <miek@miek.nl>

* Metrics: expand coredns_dns_responses_total with plugin label

This adds (somewhat hacky?) code to add a plugin label to the
coredns_dns_responses_total metric. It's completely obvlious to the
plugin as we just check who called the *recorder.WriteMsg method. We use
runtime.Caller( 1 2 3) to get multiple levels of callers, this should be
deep enough, but it depends on the dns.ResponseWriter wrapping that's
occuring.

README.md of metrics updates and test added in test/metrics_test.go to
check for the label being set.

I went through the plugin to see what metrics could be removed, but
actually didn't find any, the plugin push out metrics that make sense.

Due to the path fiddling to figure out the plugin name I doubt this
works (out-of-the-box) for external plugins, but I haven't tested that.

Signed-off-by: Miek Gieben <miek@miek.nl>

* Update core/dnsserver/server.go

Co-authored-by: dilyevsky <ilyevsky@gmail.com>

* Use [3]string

Signed-off-by: Miek Gieben <miek@miek.nl>

* imports

Signed-off-by: Miek Gieben <miek@miek.nl>

* remove dnstest changes

Signed-off-by: Miek Gieben <miek@miek.nl>

* revert

Signed-off-by: Miek Gieben <miek@miek.nl>

* Add some sleeps to make it less flaky

Signed-off-by: Miek Gieben <miek@miek.nl>

* Revert "Add some sleeps to make it less flaky"

This reverts commit b5c6655196.

* Remove forward when not needed

Signed-off-by: Miek Gieben <miek@miek.nl>

* remove newline

Signed-off-by: Miek Gieben <miek@miek.nl>

Co-authored-by: dilyevsky <ilyevsky@gmail.com>
2021-11-12 16:07:05 +00:00
..
auto_test.go cleanup deprecated package io/ioutil (#4920) 2021-10-13 09:30:31 +02:00
cache_test.go cache: do the msg copy right (#4207) 2020-10-15 07:47:07 -07:00
chaos_test.go core: fix crash with no plugins (#4184) 2020-10-07 15:58:14 +02:00
compression_scrub_test.go Fix mixed indentation within tests (#3855) 2020-04-25 08:08:36 +02:00
corefile_test.go Fix obsure crash in Corefile parsing (#4637) 2021-05-19 10:38:37 -07:00
doc.go Run gostaticheck (#3325) 2019-10-01 07:41:29 +01:00
ds_file_test.go Fix mixed indentation within tests (#3855) 2020-04-25 08:08:36 +02:00
edns0_test.go Fix mixed indentation within tests (#3855) 2020-04-25 08:08:36 +02:00
erratic_autopath_test.go cleanup deprecated package io/ioutil (#4920) 2021-10-13 09:30:31 +02:00
etcd_cache_test.go Fix mixed indentation within tests (#3855) 2020-04-25 08:08:36 +02:00
etcd_credentials_test.go Fix mixed indentation within tests (#3855) 2020-04-25 08:08:36 +02:00
etcd_test.go Fix etcd to use v3.5.0-alpha.0 (#4628) 2021-05-14 23:55:01 -07:00
example_test.go Fix mixed indentation within tests (#3855) 2020-04-25 08:08:36 +02:00
file_cname_proxy_test.go Fix mixed indentation within tests (#3855) 2020-04-25 08:08:36 +02:00
file_loop_test.go plugin/file: guard against cname loops (#4387) 2021-01-15 18:26:04 +00:00
file_reload_test.go cleanup deprecated package io/ioutil (#4920) 2021-10-13 09:30:31 +02:00
file_serve_test.go Fix mixed indentation within tests (#3855) 2020-04-25 08:08:36 +02:00
file_srv_additional_test.go Fix mixed indentation within tests (#3855) 2020-04-25 08:08:36 +02:00
file_test.go Remove duplicated TempFile testsuit (#2508) 2019-01-28 07:25:14 +00:00
file_upstream_test.go plugin/file/auto: Write CNAME answer to client even if target lookup is SERVFAIL (#4863) 2021-09-14 10:08:22 +02:00
file_xfr_test.go Speed up testing (#4239) 2020-10-30 10:27:04 +01:00
fuzz_corefile.go fuzz: use gofuzz build tag instead of fuzz (#3185) 2019-08-25 13:02:44 +00:00
grpc_test.go Fix mixed indentation within tests (#3855) 2020-04-25 08:08:36 +02:00
hosts_file_test.go Fix mixed indentation within tests (#3855) 2020-04-25 08:08:36 +02:00
log_test.go Clean up tests logging (#1979) 2018-07-19 16:23:06 +01:00
metric_naming_test.go Remove newlines between braces (#4279) 2020-11-11 18:45:01 +01:00
metrics_test.go Metrics: expand coredns_dns_responses_total with plugin label (#4914) 2021-11-12 16:07:05 +00:00
miek_test.go Fix mixed indentation within tests (#3855) 2020-04-25 08:08:36 +02:00
no_plugins_test.go core: fix crash with no plugins (#4184) 2020-10-07 15:58:14 +02:00
plugin_dnssec_test.go cleanup deprecated package io/ioutil (#4920) 2021-10-13 09:30:31 +02:00
presubmit_test.go Fix import ordering presubmit test (#4422) 2021-01-24 17:28:49 +00:00
proxy_health_test.go Speed up testing (#4239) 2020-10-30 10:27:04 +01:00
proxy_test.go Fix mixed indentation within tests (#3855) 2020-04-25 08:08:36 +02:00
readme_test.go cleanup deprecated package io/ioutil (#4920) 2021-10-13 09:30:31 +02:00
reload_test.go cleanup deprecated package io/ioutil (#4920) 2021-10-13 09:30:31 +02:00
reverse_test.go Default to upstream to self (#2436) 2019-01-13 16:54:49 +00:00
rewrite_test.go Fix mixed indentation within tests (#3855) 2020-04-25 08:08:36 +02:00
secondary_test.go plugin/secondary: Retry initial transfer until successful (#4663) 2021-06-10 10:49:31 +02:00
server.go For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
server_reverse_test.go Fix mixed indentation within tests (#3855) 2020-04-25 08:08:36 +02:00
server_test.go deflake TestMultiZoneBlockConfigs (#4751) 2021-07-14 10:36:25 +02:00
template_upstream_test.go Fix mixed indentation within tests (#3855) 2020-04-25 08:08:36 +02:00
wildcard_test.go Remove newlines between braces (#4279) 2020-11-11 18:45:01 +01:00