go_metrics_clickhouse

package module
v0.0.0-...-2014f29 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: MIT Imports: 6 Imported by: 0

README

go-metrics-clickhouse

This is a utility for the go-metrics library which will send the metrics to ClickHouse.

Initial version of source code is forked from go-metrics-influxdb and all of the influxdb related code was removed and re-programmed for ClickHouse database. That's the reason why the behavior of module and API signature provided is very similar to that of go-metrics-influxdb.

This module supports align to interval feature (which means modification of reporting time, not actual sampling time) and tagging as go-metrics-influxdb does.

Note

This module uses Clickhouse-go and sqlx instead of native sql package. And it means that supporting ClickHouse version might be depend on that of those two packages.

Tested ClickHouse server version:

  • 20.3.4

Usage

import "github.com/wingsof/go-metrics-clickhouse"

go clickhouse.ClickHouseWithTags(
    metrics.DefaultRegistry,    // metrics registry
    time.Second * 10,           // interval
    hostport,                   // your ClickHouse url (host:port). port should be TCP port (not http api port) ex) host1:9000
    database,                   // your ClickHouse database
    table,                      // your ClickHouse table
    user,                       // your ClickHouse user
    pass,                       // your ClickHouse password
    tags,                       // your tag set as map[string]string
    aligntimestamps             // align the timestamps
)

License

go-metrics-clickhouse 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 ClickHouse

func ClickHouse(r metrics.Registry, d time.Duration, hostport, database, table, username, password string, align bool)

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

func ClickHouseWithTags

func ClickHouseWithTags(r metrics.Registry, d time.Duration, hostport, database, table, username, password string, tags map[string]string, align bool)

ClickHouseWithTags starts a ClickHouse 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