Add configurable tags to influxdb metrics
This commit is contained in:
parent
2084201c8f
commit
8f0832d340
8 changed files with 100 additions and 42 deletions
|
@ -16,14 +16,10 @@ import (
|
|||
"github.com/traefik/traefik/v2/pkg/types"
|
||||
)
|
||||
|
||||
var influxDBClient *influx.Influx
|
||||
|
||||
type influxDBWriter struct {
|
||||
buf bytes.Buffer
|
||||
config *types.InfluxDB
|
||||
}
|
||||
|
||||
var influxDBTicker *time.Ticker
|
||||
var (
|
||||
influxDBClient *influx.Influx
|
||||
influxDBTicker *time.Ticker
|
||||
)
|
||||
|
||||
const (
|
||||
influxDBConfigReloadsName = "traefik.config.reload.total"
|
||||
|
@ -134,7 +130,7 @@ func initInfluxDBClient(ctx context.Context, config *types.InfluxDB) *influx.Inf
|
|||
}
|
||||
|
||||
return influx.New(
|
||||
map[string]string{},
|
||||
config.AdditionalLabels,
|
||||
influxdb.BatchPointsConfig{
|
||||
Database: config.Database,
|
||||
RetentionPolicy: config.RetentionPolicy,
|
||||
|
@ -165,6 +161,11 @@ func StopInfluxDB() {
|
|||
influxDBTicker = nil
|
||||
}
|
||||
|
||||
type influxDBWriter struct {
|
||||
buf bytes.Buffer
|
||||
config *types.InfluxDB
|
||||
}
|
||||
|
||||
// Write creates a http or udp client and attempts to write BatchPoints.
|
||||
// If a "database not found" error is encountered, a CREATE DATABASE
|
||||
// query is attempted when using protocol http.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue