Lowering log levels.
Reduce common logging using Kubernetes logging standards.
This commit is contained in:
parent
417cd5ead2
commit
11462d80bc
@ -67,7 +67,7 @@ const (
|
||||
func handleRequest(supportedApiVersions map[string]ApiVersion, m manager.Manager, w http.ResponseWriter, r *http.Request) error {
|
||||
start := time.Now()
|
||||
defer func() {
|
||||
glog.V(2).Infof("Request took %s", time.Since(start))
|
||||
glog.V(4).Infof("Request took %s", time.Since(start))
|
||||
}()
|
||||
|
||||
request := r.URL.Path
|
||||
@ -151,11 +151,9 @@ func streamResults(eventChannel *events.EventChannel, w http.ResponseWriter, r *
|
||||
for {
|
||||
select {
|
||||
case <-cn.CloseNotify():
|
||||
glog.V(3).Infof("Received CloseNotify event. About to return from api/handler:streamResults")
|
||||
m.CloseEventChannel(eventChannel.GetWatchId())
|
||||
return nil
|
||||
case ev := <-eventChannel.GetChannel():
|
||||
glog.V(3).Infof("Received event from watch channel in api: %v", ev)
|
||||
err := enc.Encode(ev)
|
||||
if err != nil {
|
||||
glog.Errorf("error encoding message %+v for result stream: %v", ev, err)
|
||||
@ -238,9 +236,6 @@ func getEventRequest(r *http.Request) (*events.Request, bool, error) {
|
||||
}
|
||||
}
|
||||
|
||||
glog.V(2).Infof(
|
||||
"%v was returned in api/handler.go:getEventRequest from the url rawQuery %v",
|
||||
query, r.URL.RawQuery)
|
||||
return query, stream, nil
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ func (self *version1_0) SupportedRequestTypes() []string {
|
||||
func (self *version1_0) HandleRequest(requestType string, request []string, m manager.Manager, w http.ResponseWriter, r *http.Request) error {
|
||||
switch requestType {
|
||||
case machineApi:
|
||||
glog.V(2).Infof("Api - Machine")
|
||||
glog.V(4).Infof("Api - Machine")
|
||||
|
||||
// Get the MachineInfo
|
||||
machineInfo, err := m.GetMachineInfo()
|
||||
@ -93,7 +93,7 @@ func (self *version1_0) HandleRequest(requestType string, request []string, m ma
|
||||
}
|
||||
case containersApi:
|
||||
containerName := getContainerName(request)
|
||||
glog.V(2).Infof("Api - Container(%s)", containerName)
|
||||
glog.V(4).Infof("Api - Container(%s)", containerName)
|
||||
|
||||
// Get the query request.
|
||||
query, err := getContainerInfoRequest(r.Body)
|
||||
@ -143,7 +143,7 @@ func (self *version1_1) HandleRequest(requestType string, request []string, m ma
|
||||
switch requestType {
|
||||
case subcontainersApi:
|
||||
containerName := getContainerName(request)
|
||||
glog.V(2).Infof("Api - Subcontainers(%s)", containerName)
|
||||
glog.V(4).Infof("Api - Subcontainers(%s)", containerName)
|
||||
|
||||
// Get the query request.
|
||||
query, err := getContainerInfoRequest(r.Body)
|
||||
@ -192,7 +192,7 @@ func (self *version1_2) SupportedRequestTypes() []string {
|
||||
func (self *version1_2) HandleRequest(requestType string, request []string, m manager.Manager, w http.ResponseWriter, r *http.Request) error {
|
||||
switch requestType {
|
||||
case dockerApi:
|
||||
glog.V(2).Infof("Api - Docker(%v)", request)
|
||||
glog.V(4).Infof("Api - Docker(%v)", request)
|
||||
|
||||
// Get the query request.
|
||||
query, err := getContainerInfoRequest(r.Body)
|
||||
@ -272,7 +272,7 @@ func handleEventRequest(m manager.Manager, w http.ResponseWriter, r *http.Reques
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
glog.V(2).Infof("Api - Events(%v)", query)
|
||||
glog.V(4).Infof("Api - Events(%v)", query)
|
||||
if !stream {
|
||||
pastEvents, err := m.GetPastEvents(query)
|
||||
if err != nil {
|
||||
@ -312,14 +312,14 @@ func (self *version2_0) HandleRequest(requestType string, request []string, m ma
|
||||
}
|
||||
switch requestType {
|
||||
case versionApi:
|
||||
glog.V(2).Infof("Api - Version")
|
||||
glog.V(4).Infof("Api - Version")
|
||||
versionInfo, err := m.GetVersionInfo()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return writeResult(versionInfo.CadvisorVersion, w)
|
||||
case attributesApi:
|
||||
glog.V(2).Info("Api - Attributes")
|
||||
glog.V(4).Info("Api - Attributes")
|
||||
|
||||
machineInfo, err := m.GetMachineInfo()
|
||||
if err != nil {
|
||||
@ -332,7 +332,7 @@ func (self *version2_0) HandleRequest(requestType string, request []string, m ma
|
||||
info := v2.GetAttributes(machineInfo, versionInfo)
|
||||
return writeResult(info, w)
|
||||
case machineApi:
|
||||
glog.V(2).Info("Api - Machine")
|
||||
glog.V(4).Info("Api - Machine")
|
||||
|
||||
// TODO(rjnagal): Move machineInfo from v1.
|
||||
machineInfo, err := m.GetMachineInfo()
|
||||
@ -342,7 +342,7 @@ func (self *version2_0) HandleRequest(requestType string, request []string, m ma
|
||||
return writeResult(machineInfo, w)
|
||||
case summaryApi:
|
||||
containerName := getContainerName(request)
|
||||
glog.V(2).Infof("Api - Summary for container %q, options %+v", containerName, opt)
|
||||
glog.V(4).Infof("Api - Summary for container %q, options %+v", containerName, opt)
|
||||
|
||||
stats, err := m.GetDerivedStats(containerName, opt)
|
||||
if err != nil {
|
||||
@ -351,7 +351,7 @@ func (self *version2_0) HandleRequest(requestType string, request []string, m ma
|
||||
return writeResult(stats, w)
|
||||
case statsApi:
|
||||
name := getContainerName(request)
|
||||
glog.V(2).Infof("Api - Stats: Looking for stats for container %q, options %+v", name, opt)
|
||||
glog.V(4).Infof("Api - Stats: Looking for stats for container %q, options %+v", name, opt)
|
||||
conts, err := m.GetRequestedContainersInfo(name, opt)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -363,7 +363,7 @@ func (self *version2_0) HandleRequest(requestType string, request []string, m ma
|
||||
return writeResult(contStats, w)
|
||||
case specApi:
|
||||
containerName := getContainerName(request)
|
||||
glog.V(2).Infof("Api - Spec for container %q, options %+v", containerName, opt)
|
||||
glog.V(4).Infof("Api - Spec for container %q, options %+v", containerName, opt)
|
||||
specs, err := m.GetContainerSpec(containerName, opt)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -48,7 +48,6 @@ func NewClient(url string) (*Client, error) {
|
||||
// Returns all past events that satisfy the request
|
||||
func (self *Client) EventStaticInfo(name string) (einfo []*info.Event, err error) {
|
||||
u := self.eventsInfoUrl(name)
|
||||
glog.V(3).Infof("got complete url %v", u)
|
||||
ret := new([]*info.Event)
|
||||
if err = self.httpGetJsonData(ret, nil, u, "event info"); err != nil {
|
||||
return
|
||||
@ -208,7 +207,6 @@ func (self *Client) getEventStreamingData(url string, einfo chan *info.Event) er
|
||||
var m *info.Event = &info.Event{}
|
||||
for {
|
||||
err := dec.Decode(m)
|
||||
glog.V(3).Infof("received m as %v", m)
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
break
|
||||
|
@ -65,13 +65,13 @@ func NewContainerHandler(name string) (ContainerHandler, error) {
|
||||
for _, factory := range factories {
|
||||
canHandle, err := factory.CanHandle(name)
|
||||
if err != nil {
|
||||
glog.V(1).Infof("Error trying to work out if we can hande %s: %v", name, err)
|
||||
glog.V(4).Infof("Error trying to work out if we can hande %s: %v", name, err)
|
||||
}
|
||||
if canHandle {
|
||||
glog.V(1).Infof("Using factory %q for container %q", factory, name)
|
||||
glog.V(3).Infof("Using factory %q for container %q", factory, name)
|
||||
return factory.NewContainerHandler(name)
|
||||
} else {
|
||||
glog.V(1).Infof("Factory %q was unable to handle container %q", factory, name)
|
||||
glog.V(4).Infof("Factory %q was unable to handle container %q", factory, name)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ func (self *events) AddEvent(e *info.Event) error {
|
||||
for _, watchObject := range watchesToSend {
|
||||
watchObject.eventChannel.GetChannel() <- e
|
||||
}
|
||||
glog.V(1).Infof("Added event %v", e)
|
||||
glog.V(4).Infof("Added event %v", e)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -162,11 +162,9 @@ func (self *containerData) nextHousekeeping(lastHousekeeping time.Time) time.Tim
|
||||
if self.housekeepingInterval > *maxHousekeepingInterval {
|
||||
self.housekeepingInterval = *maxHousekeepingInterval
|
||||
}
|
||||
glog.V(3).Infof("Raising housekeeping interval for %q to %v", self.info.Name, self.housekeepingInterval)
|
||||
} else if self.housekeepingInterval != *HousekeepingInterval {
|
||||
// Lower interval back to the baseline.
|
||||
self.housekeepingInterval = *HousekeepingInterval
|
||||
glog.V(3).Infof("Lowering housekeeping interval for %q to %v", self.info.Name, self.housekeepingInterval)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -270,7 +268,6 @@ func (c *containerData) updateLoad(newLoad uint64) {
|
||||
} else {
|
||||
c.loadAvg = c.loadAvg*loadDecay + float64(newLoad)*(1.0-loadDecay)
|
||||
}
|
||||
glog.V(3).Infof("New load for %q: %v. latest sample: %d", c.info.Name, c.loadAvg, newLoad)
|
||||
}
|
||||
|
||||
func (c *containerData) updateStats() error {
|
||||
|
@ -273,7 +273,7 @@ func (self *manager) globalHousekeeping(quit chan error) {
|
||||
// Log if housekeeping took too long.
|
||||
duration := time.Since(start)
|
||||
if duration >= longHousekeeping {
|
||||
glog.V(1).Infof("Global Housekeeping(%d) took %s", t.Unix(), duration)
|
||||
glog.V(3).Infof("Global Housekeeping(%d) took %s", t.Unix(), duration)
|
||||
}
|
||||
case <-quit:
|
||||
// Quit if asked to do so.
|
||||
@ -889,7 +889,7 @@ func (self *manager) watchForNewOoms() error {
|
||||
},
|
||||
},
|
||||
}
|
||||
glog.V(2).Infof("Created an oom event: %v", newEvent)
|
||||
glog.V(2).Infof("Created an oom event in container %q at %v", oomInstance.ContainerName, oomInstance.TimeOfDeath)
|
||||
err := self.eventHandler.AddEvent(newEvent)
|
||||
if err != nil {
|
||||
glog.Errorf("failed to add event %v, got error: %v", newEvent, err)
|
||||
|
@ -242,6 +242,6 @@ func serveContainersPage(m manager.Manager, w http.ResponseWriter, u *url.URL) e
|
||||
glog.Errorf("Failed to apply template: %s", err)
|
||||
}
|
||||
|
||||
glog.V(1).Infof("Request took %s", time.Since(start))
|
||||
glog.V(5).Infof("Request took %s", time.Since(start))
|
||||
return nil
|
||||
}
|
||||
|
@ -111,6 +111,6 @@ func serveDockerPage(m manager.Manager, w http.ResponseWriter, u *url.URL) error
|
||||
glog.Errorf("Failed to apply template: %s", err)
|
||||
}
|
||||
|
||||
glog.V(1).Infof("Request took %s", time.Since(start))
|
||||
glog.V(5).Infof("Request took %s", time.Since(start))
|
||||
return nil
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ import (
|
||||
"math"
|
||||
"sort"
|
||||
|
||||
"github.com/golang/glog"
|
||||
info "github.com/google/cadvisor/info/v2"
|
||||
)
|
||||
|
||||
@ -172,10 +171,8 @@ func GetMinutePercentiles(stats []*secondSample) info.Usage {
|
||||
if !lastSample.Timestamp.IsZero() {
|
||||
cpuRate, err := getCpuRate(*stat, lastSample)
|
||||
if err != nil {
|
||||
glog.V(3).Infof("Skipping sample, %v", err)
|
||||
continue
|
||||
}
|
||||
glog.V(3).Infof("Adding cpu rate sample : %d", cpuRate)
|
||||
cpu.AddSample(cpuRate)
|
||||
memory.AddSample(stat.Memory)
|
||||
} else {
|
||||
|
@ -37,7 +37,7 @@ func New() (*NetlinkReader, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get netlink family id for task stats: %s", err)
|
||||
}
|
||||
glog.V(2).Infof("Family id for taskstats: %d", id)
|
||||
glog.V(4).Infof("Family id for taskstats: %d", id)
|
||||
return &NetlinkReader{
|
||||
familyId: id,
|
||||
conn: conn,
|
||||
@ -73,6 +73,6 @@ func (self *NetlinkReader) GetCpuLoad(name string, path string) (info.LoadStats,
|
||||
if err != nil {
|
||||
return info.LoadStats{}, err
|
||||
}
|
||||
glog.V(3).Infof("Task stats for %q: %+v", path, stats)
|
||||
glog.V(4).Infof("Task stats for %q: %+v", path, stats)
|
||||
return stats, nil
|
||||
}
|
||||
|
@ -201,12 +201,10 @@ func getSystemFile() (string, error) {
|
||||
func New() (*OomParser, error) {
|
||||
systemFile, err := getSystemFile()
|
||||
if err != nil {
|
||||
glog.V(1).Infof("received error %v when calling getSystemFile", err)
|
||||
return trySystemd()
|
||||
}
|
||||
file, err := os.Open(systemFile)
|
||||
if err != nil {
|
||||
glog.V(1).Infof("received error %v when opening file", err)
|
||||
return trySystemd()
|
||||
}
|
||||
return &OomParser{
|
||||
|
Loading…
Reference in New Issue
Block a user