func HandleRequest(w http.ResponseWriter, source sources.Source, sink sinks.ExternalSinkManager) error { out := fmt.Sprintf("Heapster Version: %v\n\n", version.HeapsterVersion) out += source.DebugInfo() out += sink.DebugInfo() _, err := w.Write([]byte(out)) return err }
func housekeep(source sources.Source, sink sinks.ExternalSinkManager) { ticker := time.NewTicker(*argPollDuration) defer ticker.Stop() for { select { case <-ticker.C: data, err := source.GetInfo() if err != nil { glog.Errorf("failed to get information from source - %v", err) } if err := sink.Store(data); err != nil { glog.Errorf("failed to push information to sink - %v", err) } } } }