Documentation ¶
Index ¶
Constants ¶
const ( // ClockKey is the key associated to a clock.Clock. ClockKey = "Clock" // NodesMetricsKey is the key associated to a map of node.Metrics. NodesMetricsKey = "Nodes" // PodsMetricsKey is the key associated to a map of pod.Metrics. PodsMetricsKey = "Pods" // QueueMetricsKey is the key associated to a queue.Metrics. QueueMetricsKey = "Queue" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileWriter ¶
type FileWriter struct {
// contains filtered or unexported fields
}
FileWriter is a Writer that writes metrics to a file.
func NewFileWriter ¶
func NewFileWriter(dest string, formatter Formatter) (*FileWriter, error)
NewFileWriter creates a new FileWriter with an output device or file at the given path, and the formatter that formats metrics to a string If /dev/stdout or stdout is given, the standard out is set. If /dev/stderr or stderr is given, the standard error is set. Otherwise, the file of a given path is set and it will be truncated if it exists. Returns error if failed to create a file.
func (*FileWriter) FileName ¶
func (w *FileWriter) FileName() string
FileName returns the name of file underlying this FileWriter.
func (*FileWriter) Write ¶
func (w *FileWriter) Write(metrics *Metrics) error
Write implements Writer interface. Returns error if failed to format with the underlying formatter.
type Formatter ¶
type Formatter interface { // Format formats the given metrics to a string. Format(metrics *Metrics) (string, error) }
Formatter defines the interface of metrics formatter.
type HumanReadableFormatter ¶
type HumanReadableFormatter struct{}
HumanReadableFormatter is a Foramtter that formats metrics in a human-readable style.
type JSONFormatter ¶
type JSONFormatter struct { }
JSONFormatter is a Formatter that formats metrics to a JSON string.
type Metrics ¶
type Metrics map[string]interface{}
Metrics represents a metrics at one time point, in the following structure.
Metrics[ClockKey] = a formatted clock Metrics[NodesMetricsKey] = map from node name to node.Metrics Metrics[PodsMetricsKey] = map from pod name to pod.Metrics Metrics[QueueMetricsKey] = queue.Metrics
type TableFormatter ¶
type TableFormatter struct{}
TableFormatter is a Formatter that formats metrics in a table.