Rework the TestProxyClose - close the proxy in the *same* goroutine
as where we started it. Close channels as long as we don't get dataraces
(this may need another fix).
Move the Dial goroutine out of the connManager - this simplifies things
*and* makes another goroutine go away and removes the need for connErr
channels - can now just be dns.Conn.
Also:
Revert "plugin/forward: gracefull stop (#1701)"
This reverts commit 135377bf77.
Revert "rework TestProxyClose (#1735)"
This reverts commit 9e8893a0b5.
* plugin/health: update README
Make more clear in the readme that health is limited to 1 server.
Fixes#1722
* rephrase and remove ~~~ corefile because it will fail
* core: remove HostAddresses()
config.HostAddresses() is a weird function that gathers
some data from the server and returns a string.
It is *only* used the trace plugin, to figure out what
server starts the trace.
Looks to be better to fit in the with metrics.WithServer label
on the trace itself to show which server handled the trace.
Remove HostAddresses() and cleanup trace a small bit.:w
* lint
https_google and reverse will be removed in 2 releases. Add warnings.
We will move reverse to coredns/reverse and list it as external after
this switch.
See #1713
also ignore build/ and release/ as they may be left over from releasing
coredns.
Sending build context to Docker daemon 490.9MB ->
Sending build context to Docker daemon 98.82kB
* build: add presubmits
We didn't have a way to encode presubmit; with this hack we can just
run a bunch of script on the build; this allows us to automatically
capture things like using the wrong context and maybe other fluff.
This allows us to cut down on code reviews and just have the build fail.
* hook it up
* put presubmit in checks; so we do it for tests as well
* Add explicit exit 1 if things fails
* update docs
* plugins: use plugin specific logging
Hooking up pkg/log also changed NewWithPlugin to just take a string
instead of a plugin.Handler as that is more flexible and for instance
the Root "plugin" doesn't implement it fully.
Same logging from the reload plugin:
.:1043
2018/04/22 08:56:37 [INFO] CoreDNS-1.1.1
2018/04/22 08:56:37 [INFO] linux/amd64, go1.10.1,
CoreDNS-1.1.1
linux/amd64, go1.10.1,
2018/04/22 08:56:37 [INFO] plugin/reload: Running configuration MD5 = ec4c9c55cd19759ea1c46b8c45742b06
2018/04/22 08:56:54 [INFO] Reloading
2018/04/22 08:56:54 [INFO] plugin/reload: Running configuration MD5 = 9e2bfdd85bdc9cceb740ba9c80f34c1a
2018/04/22 08:56:54 [INFO] Reloading complete
* update docs
* better doc
Add per plugin logging to make it explicit what is logging, if you
include this package under the name clog (coredns log), you can do the
following:
log := clog.NewWithPlugin{whoami{}} // e.g.
And then just log.Info(...); these will then include the plugin ala:
[INFO] plugin/whoami: stuff
So we only need to init the logger and then just use it.
* reload: use OnRestart
Close the listener on OnRestart for health and metrics so the default
setup function can setup the listener when the plugin is "starting up".
Lightly test with some SIGUSR1-ing. Also checked the reload plugin with
this, seems fine:
.com.:1043
.:1043
2018/04/20 15:01:25 [INFO] CoreDNS-1.1.1
2018/04/20 15:01:25 [INFO] linux/amd64, go1.10,
CoreDNS-1.1.1
linux/amd64, go1.10,
2018/04/20 15:01:25 [INFO] Running configuration MD5 = aa8b3f03946fb60546ca1f725d482714
2018/04/20 15:02:01 [INFO] Reloading
2018/04/20 15:02:01 [INFO] Running configuration MD5 = b34a96d99e01db4015a892212560155f
2018/04/20 15:02:01 [INFO] Reloading complete
^C2018/04/20 15:02:06 [INFO] SIGINT: Shutting down
With this corefile:
.com {
proxy . 127.0.0.1:53
prometheus :9054
whoami
reload
}
. {
proxy . 127.0.0.1:53
prometheus :9054
whoami
reload
}
The prometheus port was 9053, changed that to 54 so reload would pick it
up.
From a cursory look it seems this also fixes:
Fixes#1604#1618#1686#1492
* At least make it test
* Use onfinalshutdown
* reload: add reload test
This test #1604 adn right now fails.
* Address review comments
* Add bug section explaining things a bit
* compile tests
* Fix tests
* fixes
* slightly less crazy
* try to make prometheus setup less confusing
* Use ephermal port for test
* Don't use the listener
* These are shared between goroutines, just use the boolean in the main
structure.
* Fix text in the reload README,
* Set addr to TODO once stopping it
* Morph fturb's comment into test, to test reload and scrape health and
metric endpoint
* plugin/forward: gracefull stop
- stop connection manager only when no queries in progress
* minor improvement
* prevent healthcheck on stopped proxy
* revert closing channels
* use standard context
* 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
* Update all plugins to use plugin/pkg/log
I wish this could have been done with sed. Alas manually changed all
callers to use the new plugin/pkg/log package.
* Error -> Info
* Add docs to debug plugin as well
* pkg/log: ability for debug logs
When the debug plugin is enabled all log.Debug calls will print to
standard; if not there are a noop (almost).
The log package wraps some standard log functions as well, so just
replacing "log" with "plugin/pkg/log" should be enough to use this
package.
* docs
* Add docs
* lint
* Test fallthrough to log pkg as well
* simple package - up test coverage
* add other log levels as well
* update docs
* plugin/metrics: add 'server' label
This uses the new WithServer(ctx) to get the current server from the
context.
First in a larger refactor to make all plugins do this.
* compile
* compile
* lala test
* compile and test
* typos
* Dont duplicate the code
With this change the original truncated message returned by requested
server is returned to the client, instead of returning an empty dummy
message with only the truncation bit set.
- each proxy stores average RTT (round trip time) of last rttCount queries.
For now, I assigned the value 4 to rttCount
- the read timeout is calculated as doubled average RTT, but it cannot
exceed default timeout
- initial avg RTT is set to a half of default timeout, so initial timeout
is equal to default timeout
- the RTT for failed read is considered equal to default timeout, so any
failed read will lead to increasing average RTT (up to default timeout)
- dynamic timeouts will let us react faster on lost UDP packets
- in future, we may develop a low-latency forward policy based on
collected RTT values of proxies