reporter

package module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2020 License: MIT Imports: 8 Imported by: 2

README

go-metrics-influxdb

This is a reporter for the go-metrics library which will post the metrics to InfluxDB.

Based on the official InfluxDB Client Go and compatible with InfluxDB 2.x and InfluxDB 1.8+.

Installation

go get https://github.com/zakhio/go-metrics-influxdb

Usage

import "github.com/zakhio/go-metrics-influxdb"

go reporter.InfluxDBWithTags(
    metrics.DefaultRegistry,    // metrics registry
    time.Second * 10,           // reporting interval
    serverURL,                  // InfluxDB instance url
    organizationID,             // organization id
    bucketID,                   // data bucket id
    measurement,                // measurement
    token,                      // access token
    tags,                       // default tags (for example, server name, artifact version, etc)
    alignTimestamps             // flag to align the timestamps
)

Metrics can be aligned to the beginning of a bucket as defined by the interval.

Setting alignTimestamps to true will cause the timestamp to be truncated down to the nearest even integral of the reporting interval.

For example, if the interval is 30 seconds, timestamps will be aligned on :00 and :30 for every reporting interval.

Note: check go-metrics-influxdb-grpc-example for more hands on example.

License

go-metrics-influxdb is licensed under the MIT license. See the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InfluxDB

func InfluxDB(registry metrics.Registry, interval time.Duration, serverUrl, organizationID, bucketID, measurement, token string, alignTimestamps bool)

InfluxDB starts a InfluxDB reporter which will post the metrics from the given registry at each interval.

func InfluxDBWithTags

func InfluxDBWithTags(registry metrics.Registry, interval time.Duration, serverUrl, organizationID, bucketID, measurement, token string, tags map[string]string, alignTimestamps bool)

InfluxDBWithTags starts a InfluxDB reporter which will post the metrics from the given registry at each 'd' interval with the specified 'tags'.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL