Documentation ¶
Overview ¶
Package influxdb exposes an opencensus stats exporter for influxdb.
It may be used to store opencensus metrics in an influxdb database.
Index ¶
- type Exporter
- type MetricPoint
- type Option
- type Store
- type StoreOption
- func WithAddr(addr string) StoreOption
- func WithDatabase(db string) StoreOption
- func WithInsecureSkipVerify(skip bool) StoreOption
- func WithMapper(mapper func(string, map[string]string) (string, map[string]string)) StoreOption
- func WithNameAsTag(timeseries string) StoreOption
- func WithPassword(pwd string) StoreOption
- func WithProxy(proxy func(*http.Request) (*url.URL, error)) StoreOption
- func WithTLSConfig(config *tls.Config) StoreOption
- func WithTimeout(d time.Duration) StoreOption
- func WithURL(r string) StoreOption
- func WithUser(user string) StoreOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter is an opencensus exporter for Influxdb
func NewExporter ¶
NewExporter creates a new Influxdb exporter.
Use options to configure:
- an influxdd.Store instance, configured with the desired settings
- an error handler. If set to nil, a no-op handler is set by default
- a map of custom tags for written records (may be nil)
func (*Exporter) ExportView ¶
ExportView sends collected metrics to the backend sink
type MetricPoint ¶
type MetricPoint struct { Measurement string Tags map[string]string Fields map[string]interface{} Timestamp time.Time }
MetricPoint represents a single row in a batch of measurements
type Option ¶
type Option func(*Exporter)
Option configures an exporter
func WithErrorHandler ¶
WithErrorHandler sets an error handler for this exporter
type Store ¶
type Store interface { Database() string GetClient() influxdb.Client Ping(context.Context, time.Duration) error ReadMetrics(context.Context, string) (*influxdb.Response, error) WriteMetrics(context.Context, string, map[string]string, map[string]interface{}) error WriteBatch(context.Context, []MetricPoint) error }
Store provides an access to an influxdb database for reading and writing metrics
func NewStore ¶
func NewStore(opts ...StoreOption) (Store, error)
NewStore builds an instance of Store with some options
type StoreOption ¶
type StoreOption func(*influxDB)
StoreOption configures an influxdb client
func WithInsecureSkipVerify ¶
func WithInsecureSkipVerify(skip bool) StoreOption
WithInsecureSkipVerify toggles TLS server certificate check by the client
func WithMapper ¶
WithMapper specifies a name mapping function, which translates a measurement name and a set of tags into another one. This allows for converting measurement names into tags and reduce the number of time series handled by influxdb.
func WithNameAsTag ¶
func WithNameAsTag(timeseries string) StoreOption
WithNameAsTag is a helper which specifies a simple mapper converting a measurement name into a "metric" tag and the time series name is predefined.
func WithPassword ¶
func WithPassword(pwd string) StoreOption
WithPassword sets the database password to connect to an influxdb database
func WithTLSConfig ¶
func WithTLSConfig(config *tls.Config) StoreOption
WithTLSConfig sets TLS configuration for an https client
func WithTimeout ¶
func WithTimeout(d time.Duration) StoreOption
WithTimeout sets write timeouts for the client
func WithURL ¶
func WithURL(r string) StoreOption
WithURL combines user, password and host address in one single URI notation (e.g. http://user:password@host:port)
func WithUser ¶
func WithUser(user string) StoreOption
WithUser sets the database user to connect to an influxdb database