Commit graph

18 commits

Author SHA1 Message Date
Ben Kochie
0d6e113f90
Enable Prometheus native histograms (#6524)
Add a NativeHistogramBucketFactor parameter to the use of
`NewHistogramVec` in order to enable use of Prometheus Native
Histograms.

This will store automatically computed sparse buckets in CoreDNS.
If a compatible Prometeus requests native histograms this data will
returned instead of the static buckets.

The default factor of 1.05 should provide high quality resolution data.

Signed-off-by: SuperQ <superq@gmail.com>
2024-03-11 16:09:09 -04:00
Ben Kochie
9edfaed631
Reduce the cardinality of health endpoint metrics (#4650)
The health endpoint histogram has a large amount of cardinality for a
simple endpoint. Introduce a new "Slim" set of buckets for `/health` to
reduce the metrics load on large deployments. Especially those that have
per-node DNS caching services.

Add a metric to count internal health check failures rather than use the
timeout value as side effect monitor of the check error. This avoids
incorrectly recording the timeout value if there is an error that is not
a timeout (ex. refused)

Signed-off-by: SuperQ <superq@gmail.com>
2021-05-27 15:16:38 +02:00
Soumya Ghosh Dastidar
7651e6c4de
Added minimal-responses plugin (#4417)
* Added minimal-responses plugin

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>

* Removed unnecessary comments

* Updated tests

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>

* Reformated imports

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>

* Updated package name

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>

* Removed  unnecessary comments

Co-authored-by: Miek Gieben <miek@miek.nl>

* Added changes

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>

* updated

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>

* Updated comment for NextOrFailure

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>

* Updated to test.Case for testing

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>

* Formated imports using goimports

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>

Co-authored-by: Miek Gieben <miek@miek.nl>
2021-03-15 15:37:55 +01:00
Chris O'Haver
3f47fc8ba4
typo fixes (#3169)
* spelling fixes

* its/it's
2019-08-21 16:08:55 -04:00
Chris O'Haver
1cb44f0bfd Update plugin.go (#2894) 2019-06-17 20:01:06 +01:00
Miek Gieben
9a8c301a42 Remove server addr from the context (#2722)
* more

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

* Remove server addr from the context

This was added twice, just leave the server which also holds the
address.

Conflicts with #2719 but should be easy to fix.

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

* doesn't need server context

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-03-25 10:46:44 -07:00
moredhel
b7bbfef6ef fix typo (#2272) 2018-11-05 05:59:24 -08:00
Miek Gieben
0930eb8beb
all: fix plugin import ordering (#1717)
Got a bit messed up with stb lib "context" usage.
2018-04-22 08:34:35 +01:00
Miek Gieben
8722336fff
global: move to context (#1699)
* global: move to context

Move from golang.org/x/net/context to std lib's context.

Change done with:

for i in $(grep -l '/context' **/*.go); do sed -e 's|golang.org/x/net/context|context|' -i $i; echo $i; done
for i in **/*.go; do goimports -w $i; done

* drop from dns.pb.go as well
2018-04-20 11:01:06 +01:00
Miek Gieben
4df416ca1d
Metrics (#1579)
* plugin/metrics: set server address in context

Allow cross server block metrics to co-exist; for this we should label
each metric with the server label. Put this information in the context
and provide a helper function to get it out.

Abstracting with entirely away with difficult as the release client_go
(0.8.0) doesn't have the CurryWith functions yet. So current use is like
so:

define metric, with server label:

	RcodeCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: plugin.Namespace,
		Subsystem: "forward",
		Name:      "response_rcode_count_total",
		Help:      "Counter of requests made per upstream.",
	}, []string{"server", "rcode", "to"})

And report ith with the helper function metrics.WithServer:

	RcodeCount.WithLabelValues(metrics.WithServer(ctx), rc, p.addr).Add(1)
2018-04-01 13:57:03 +01:00
Miek Gieben
f697b33283
return an error for multiple use of some plugins (#1559)
* plugins: Return error for multiple use of some

Return plugin.ErrOnce when a plugin that doesn't support it, is called
mutliple times.

This now adds it for: cache, dnssec, errors, forward, hosts, nsid.
And changes it slightly in kubernetes, pprof, reload, root.

* more tests
2018-02-28 18:16:05 -08:00
Miek Gieben
c6febe6250
Add pkg/fall for Fallthrough (#1355)
* Add pkg/fall for Fallthrough

Move this into it's own package to facilitate tests. Important bug
was fixed: make the names fully qualified.

Add fall package to hosts, reverse, etcd, and fix kubernetes and any
tests. The k8s tests are still as-is, might need a future cleanup.
2018-01-07 16:32:59 +00:00
John Belamaric
84ebbbc722
kubernetes: Add zone filtering to fallthrough (#1353)
* Add zone filtering to fallthrough

* Doh. gofmt

* Update documentation
2018-01-06 14:52:09 -05:00
Rene Treffer
98632cd4a6 Fix time bucketing of response time (#1274) 2017-12-05 18:51:55 +00:00
Miek Gieben
917965fa86
metrics: use exponentional buckets (#1261)
* metrics: use exponentional buckets

See  https://github.com/kubernetes/dns/pull/168
2017-12-01 11:15:05 +00:00
Ben Kochie
06006fac56 Update timing histograms (#1253)
* Use seconds for bucketing.
* Add template for high accuracy timing buckets to avoid copy-pasta.
2017-11-27 21:34:26 +00:00
Yong Tang
102cfbd7fe Use gometalinter and enforcing go fmt/lint/vet (#1108)
* Use gometalinter and enforcing go fmt/lint/vet

Before this PR go fmt is enabled, go lint is suggest only.
From time to time we have to manually check for go lint and go vet
for any issues.

This fix uses gometalinter and enforcing go fmt/lint/vet.
Several reasons:
- gometalinter could handle multiple linters concurrently
- gometalinter supports suppression with `// nolint[: <linter>]`

Previously one reason we didn't enable go lint was due to the
```
warning: context.Context should be the first parameter of a function (golint)
```
this is now possible with gometalinter and `// nolint: golint` (See changes).

This fix also discovered several go vet issues and fixes it.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Fix several issues reported by gometalinter (go vet)

This commit fixes several issues reported by gometalinter (go vet).

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Increase deadline

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-09-24 11:59:04 +01:00
Miek Gieben
d8714e64e4 Remove the word middleware (#1067)
* Rename middleware to plugin

first pass; mostly used 'sed', few spots where I manually changed
text.

This still builds a coredns binary.

* fmt error

* Rename AddMiddleware to AddPlugin

* Readd AddMiddleware to remain backwards compat
2017-09-14 09:36:06 +01:00
Renamed from middleware/middleware.go (Browse further)