Improve WriteToTextfile doc
Signed-off-by: Sevag Hanssian <sevag.hanssian@gmail.com>
This commit is contained in:
parent
42e6616334
commit
924d5919f3
|
@ -537,9 +537,12 @@ func (r *Registry) Gather() ([]*dto.MetricFamily, error) {
|
||||||
return internal.NormalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap()
|
return internal.NormalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteToTextfile formats the metrics of the provided Gatherer interface and
|
// WriteToTextfile calls Gather on the provided Gatherer, encodes the result in the
|
||||||
// emits them in text format to the path. Intended for use with the node_exporter
|
// Prometheus text format, and writes it to a temporary file. Upon success, the
|
||||||
// textfile collector
|
// temporary file is renamed to the provided filename.
|
||||||
|
//
|
||||||
|
// This is intended for use with the textfile collector of the node exporter.
|
||||||
|
// Note that the node exporter expects the filename to be suffixed with ".prom".
|
||||||
func WriteToTextfile(filename string, g Gatherer) error {
|
func WriteToTextfile(filename string, g Gatherer) error {
|
||||||
tmp, err := ioutil.TempFile(filepath.Dir(filename), filepath.Base(filename))
|
tmp, err := ioutil.TempFile(filepath.Dir(filename), filepath.Base(filename))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue