graphite: Index | Examples | Files | Directories

package graphite

import ""

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


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

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



Package Files


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 "".
    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.


exampleCommand graphite is an example program that collects data for video size.

Package graphite imports 12 packages (graph) and is imported by 1 packages. Updated 2020-05-25. Refresh now. Tools for package owners.