Back to godoc.org
contrib.go.opencensus.io/exporter/graphite

package graphite

v0.0.0 (26b9065)
Latest Go to latest
Published: Apr 24, 2020 | License: Apache-2.0 | Module: contrib.go.opencensus.io/exporter/graphite

Overview

Package graphite contains a Graphite exporter that supports exporting OpenCensus views as Graphite metrics.

Example

Code:

exporter, err := graphite.NewExporter(graphite.Options{})
if err != nil {
	log.Fatal(err)
}
view.RegisterExporter(exporter)

// Serve the scrape endpoint on port 9999.
log.Fatal(http.ListenAndServe(":9999", nil))

Index

Examples

type Exporter

type Exporter struct {
	// contains filtered or unexported fields
}

Exporter exports stats to Graphite

func NewExporter

func NewExporter(o Options) (*Exporter, error)

NewExporter returns an exporter that exports stats to Graphite.

func (*Exporter) ExportView

func (e *Exporter) ExportView(vd *view.Data)

ExportView exports to the Graphite if view data has one or more rows. Each OpenCensus stats records will be converted to corresponding Graphite Metric

func (*Exporter) Flush

func (e *Exporter) Flush()

type Options

type Options struct {
	// Host contains de host address for the graphite server.
	// The default value is "127.0.0.1".
	Host string

	// Port is the port in which the carbon endpoint is available.
	// The default value is 2003.
	Port int

	// Namespace is optional and will be the first element in the path.
	Namespace string

	// Tags specifies a set of default tags to attach to each metric.
	// Tags is optional and will work only for Graphite above 1.1.x.
	// Example : []string{"tagName1=tagValue1", "tagName2=tagValue2"}
	Tags []string

	// OnError is the hook to be called when there is
	// an error uploading the stats or tracing data.
	// If no custom hook is set, errors are logged.
	// Optional.
	OnError func(err error)
}

Options contains options for configuring the exporter.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier