mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
proxy/httpproxy: fix v2 proxy log header
Replace all with capnslog
This commit is contained in:
parent
663db2bbf8
commit
dd8a36820e
@ -337,7 +337,7 @@ func (epc *etcdProcessCluster) Start() (err error) {
|
||||
etcdp.donec = make(chan struct{})
|
||||
rs := readyStr
|
||||
if etcdp.cfg.isProxy {
|
||||
rs = "proxy: endpoints found"
|
||||
rs = "httpproxy: endpoints found"
|
||||
}
|
||||
_, err := etcdp.proc.Expect(rs)
|
||||
readyC <- err
|
||||
|
@ -15,7 +15,6 @@
|
||||
package httpproxy
|
||||
|
||||
import (
|
||||
"log"
|
||||
"math/rand"
|
||||
"net/url"
|
||||
"sync"
|
||||
@ -135,10 +134,10 @@ func (ep *endpoint) Failed() {
|
||||
ep.Available = false
|
||||
ep.Unlock()
|
||||
|
||||
log.Printf("proxy: marked endpoint %s unavailable", ep.URL.String())
|
||||
plog.Printf("marked endpoint %s unavailable", ep.URL.String())
|
||||
|
||||
if ep.failFunc == nil {
|
||||
log.Printf("proxy: no failFunc defined, endpoint %s will be unavailable forever.", ep.URL.String())
|
||||
plog.Printf("no failFunc defined, endpoint %s will be unavailable forever.", ep.URL.String())
|
||||
return
|
||||
}
|
||||
|
||||
@ -149,7 +148,7 @@ func timedUnavailabilityFunc(wait time.Duration) func(*endpoint) {
|
||||
return func(ep *endpoint) {
|
||||
time.AfterFunc(wait, func() {
|
||||
ep.Available = true
|
||||
log.Printf("proxy: marked endpoint %s available, to retest connectivity", ep.URL.String())
|
||||
plog.Printf("marked endpoint %s available, to retest connectivity", ep.URL.String())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@ -76,8 +75,9 @@ func (p *reverseProxy) ServeHTTP(rw http.ResponseWriter, clientreq *http.Request
|
||||
if clientreq.Body != nil {
|
||||
proxybody, err = ioutil.ReadAll(clientreq.Body)
|
||||
if err != nil {
|
||||
msg := fmt.Sprintf("proxy: failed to read request body: %v", err)
|
||||
e := httptypes.NewHTTPError(http.StatusInternalServerError, msg)
|
||||
msg := fmt.Sprintf("failed to read request body: %v", err)
|
||||
plog.Println(msg)
|
||||
e := httptypes.NewHTTPError(http.StatusInternalServerError, "httpproxy: "+msg)
|
||||
if we := e.WriteTo(rw); we != nil {
|
||||
plog.Debugf("error writing HTTPError (%v) to %s", we, clientreq.RemoteAddr)
|
||||
}
|
||||
@ -95,12 +95,12 @@ func (p *reverseProxy) ServeHTTP(rw http.ResponseWriter, clientreq *http.Request
|
||||
|
||||
endpoints := p.director.endpoints()
|
||||
if len(endpoints) == 0 {
|
||||
msg := "proxy: zero endpoints currently available"
|
||||
msg := "zero endpoints currently available"
|
||||
reportRequestDropped(clientreq, zeroEndpoints)
|
||||
|
||||
// TODO: limit the rate of the error logging.
|
||||
log.Printf(msg)
|
||||
e := httptypes.NewHTTPError(http.StatusServiceUnavailable, msg)
|
||||
plog.Println(msg)
|
||||
e := httptypes.NewHTTPError(http.StatusServiceUnavailable, "httpproxy: "+msg)
|
||||
if we := e.WriteTo(rw); we != nil {
|
||||
plog.Debugf("error writing HTTPError (%v) to %s", we, clientreq.RemoteAddr)
|
||||
}
|
||||
@ -117,7 +117,7 @@ func (p *reverseProxy) ServeHTTP(rw http.ResponseWriter, clientreq *http.Request
|
||||
select {
|
||||
case <-closeCh:
|
||||
atomic.StoreInt32(&requestClosed, 1)
|
||||
log.Printf("proxy: client %v closed request prematurely", clientreq.RemoteAddr)
|
||||
plog.Printf("client %v closed request prematurely", clientreq.RemoteAddr)
|
||||
cancel()
|
||||
case <-completeCh:
|
||||
}
|
||||
@ -142,7 +142,7 @@ func (p *reverseProxy) ServeHTTP(rw http.ResponseWriter, clientreq *http.Request
|
||||
}
|
||||
if err != nil {
|
||||
reportRequestDropped(clientreq, failedSendingRequest)
|
||||
log.Printf("proxy: failed to direct request to %s: %v", ep.URL.String(), err)
|
||||
plog.Printf("failed to direct request to %s: %v", ep.URL.String(), err)
|
||||
ep.Failed()
|
||||
continue
|
||||
}
|
||||
@ -152,10 +152,10 @@ func (p *reverseProxy) ServeHTTP(rw http.ResponseWriter, clientreq *http.Request
|
||||
|
||||
if res == nil {
|
||||
// TODO: limit the rate of the error logging.
|
||||
msg := fmt.Sprintf("proxy: unable to get response from %d endpoint(s)", len(endpoints))
|
||||
msg := fmt.Sprintf("unable to get response from %d endpoint(s)", len(endpoints))
|
||||
reportRequestDropped(clientreq, failedGettingResponse)
|
||||
log.Printf(msg)
|
||||
e := httptypes.NewHTTPError(http.StatusBadGateway, msg)
|
||||
plog.Println(msg)
|
||||
e := httptypes.NewHTTPError(http.StatusBadGateway, "httpproxy: "+msg)
|
||||
if we := e.WriteTo(rw); we != nil {
|
||||
plog.Debugf("error writing HTTPError (%v) to %s", we, clientreq.RemoteAddr)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user