Log discovery updates in the outbound proxy (#153)

When debugging issues that users believe is related to discovery, it's
helpful to get a narrow set of logs out to determine whether the proxy
is observing discovery updates.

With this change, a user can inject the proxy with
```
LINKERD2_PROXY_LOG='warn,linkerd2_proxy=info,linkerd2_proxy::app::outbound::discovery=debug'
```
and the proxy's logs will include messages like:

```
DBUG voting-svc.emojivoto.svc.cluster.local:8080 linkerd2_proxy::app::outbound::discovery adding 10.233.70.98:8080 to voting-svc.emojivoto.svc.cluster.local:8080
DBUG voting-svc.emojivoto.svc.cluster.local:8080 linkerd2_proxy::app::outbound::discovery removing 10.233.66.36:8080 from voting-svc.emojivoto.svc.cluster.local:8080
```

This change also turns-down some overly chatty INFO logging in main.
This commit is contained in:
Oliver Gould 2018-12-04 07:45:20 -08:00 committed by GitHub
parent f3f959b854
commit 68f42c337f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -542,13 +542,13 @@ where
.get(super::CANONICAL_DST_HEADER)
.and_then(|dst| dst.to_str().ok())
.and_then(|d| Addr::from_str(d).ok());
info!("inbound canonical={:?}", canonical);
debug!("inbound canonical={:?}", canonical);
let dst = canonical
.or_else(|| super::http_request_authority_addr(req).ok())
.or_else(|| super::http_request_host_addr(req).ok())
.or_else(|| super::http_request_orig_dst_addr(req).ok());
info!("inbound dst={:?}", dst);
debug!("inbound dst={:?}", dst);
dst.map(DstAddr::inbound)
}))
.make(&router::Config::new("in dst", capacity, max_idle_age))

View File

@ -147,9 +147,11 @@ pub mod discovery {
match self {
Resolution::Name(ref name, ref mut res) => match try_ready!(res.poll()) {
resolve::Update::Remove(addr) => {
debug!("removing {}", addr);
Ok(Async::Ready(resolve::Update::Remove(addr)))
}
resolve::Update::Add(addr, metadata) => {
debug!("adding {}", addr);
// If the endpoint does not have TLS, note the reason.
// Otherwise, indicate that we don't (yet) have a TLS
// config. This value may be changed by a stack layer that