Documentation ¶
Overview ¶
writer provides our stdout writers for promql query results
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteInstant ¶
func WriteInstant(i InstantWriter, format string, noHeaders bool) error
WriteInstant writes out the results of the query to an output buffer and prints it to stdout
func WriteRange ¶
func WriteRange(r RangeWriter, format string, noHeaders bool) error
WriteRange writes out the results of the query to an output buffer and prints it to stdout
Types ¶
type InstantResult ¶
InstantResult is wrapper of the prometheus model.Matrix type returned from instant queries Satisfies the InstantWriter interface
func (*InstantResult) Csv ¶
func (r *InstantResult) Csv(noHeaders bool) (bytes.Buffer, error)
Csv returns the response from an instant query as a csv
type InstantWriter ¶
InstantWriter extends the Writer interface by adding a Table method Use specifically for writing the results of instant queries
type LabelsResult ¶
LabelsResult is the result of an instant query It's really the same as an InstantResult with different methods for parsing the unique labels present in a query result.
func (*LabelsResult) Csv ¶
func (r *LabelsResult) Csv(noHeaders bool) (bytes.Buffer, error)
Csv returns the labels from an instant query as a single column csv
type MetaResult ¶ added in v0.3.0
MetaResult is the result of our metadata query It satisfies the InstantWriter interface
func (*MetaResult) Csv ¶ added in v0.3.0
func (r *MetaResult) Csv(noHeaders bool) (bytes.Buffer, error)
Csv returns the result from a metadata query as csv
func (*MetaResult) Json ¶ added in v0.3.0
func (r *MetaResult) Json() (bytes.Buffer, error)
Json returns the result from a metadata query as json
func (*MetaResult) Metrics ¶ added in v0.3.0
func (r *MetaResult) Metrics() MetricsResult
Metrics returns an array of metrics from a metadata query result
type MetricsResult ¶
type MetricsResult []string
MetricsResult is the list of metrics names from a metadata query result It satisfies the InstantWriter interface as it's a point in time (e.g. what metrics are currently queryable)
func (*MetricsResult) Csv ¶
func (r *MetricsResult) Csv(noHeaders bool) (bytes.Buffer, error)
Csv returns the response from a metrics query as a single column csv
type RangeResult ¶
RangeResult is wrapper of the prometheus model.Matrix type returned from range queries Satisfies the RangeWriter interface
func (*RangeResult) Csv ¶
func (r *RangeResult) Csv(noHeaders bool) (bytes.Buffer, error)
Csv returns the response from a range query as a csv
func (*RangeResult) Graph ¶
func (r *RangeResult) Graph(dim util.TermDimensions) (bytes.Buffer, error)
Graph returns an ascii graph using https://github.com/guptarohit/asciigraph
type RangeWriter ¶
RangeWriter extends the Writer interface by adding a Graph method Used specifically for writing the results of range queries
type SeriesResult ¶ added in v0.3.0
SeriesResult currently doesn't write anything itself but helps create other result types like metrics from the series api
func (*SeriesResult) Metrics ¶ added in v0.3.0
func (r *SeriesResult) Metrics() MetricsResult
Metrics creates a MetricsResult from a SeriesResult