graphite: contrib.go.opencensus.io/exporter/graphite Index | Examples | Files | Directories

package graphite

import "contrib.go.opencensus.io/exporter/graphite"

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

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

Package Files

graphite.go

type Exporter Uses

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

Exporter exports stats to Graphite

func NewExporter Uses

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

NewExporter returns an exporter that exports stats to Graphite.

func (*Exporter) ExportView Uses

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 Uses

func (e *Exporter) Flush()

type Options Uses

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.

Directories

PathSynopsis
exampleCommand graphite is an example program that collects data for video size.
internal/client

Package graphite imports 12 packages (graph) and is imported by 1 packages. Updated 2019-03-26. Refresh now. Tools for package owners.