Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

This is a reporter for the go-metrics library which will post the metrics to InfluxDB 2.x and InfluxDB 1.8+.

License

Notifications You must be signed in to change notification settings

zakhio/go-metrics-influxdb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

This is a reporter for the go-metrics library which will post the metrics to InfluxDB 2.x and InfluxDB 1.8+.

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • Go 100.0%