Categorygithub.com/retgits/gcr-wavefront
modulepackage
0.3.1
Repository: https://github.com/retgits/gcr-wavefront.git
Documentation: pkg.go.dev

# README

gcr-wavefront

Go Report Card Godoc GitHub GitHub tag (latest SemVer)

gcr-wavefront is an HTTP middleware to emit Google Cloud Run metrics to Wavefront.

Prerequisites

To use this HTTP middleware, you'll need to have

Installation

Using go get

go get github.com/retgits/gcr-wavefront

Usage

To start, you'll need to initialize the Wavefront emitter:

// Set configuration parameters
wfconfig := &gcrwavefront.WavefrontConfig{
    Server:        "https://<INSTANCE>.wavefront.com",
    Token:         "my-api-key",
    BatchSize:     10000,
    MaxBufferSize: 50000,
    FlushInterval: 1,
    Source:        "my-app",
    MetricPrefix:  "my.awesome.app",
    PointTags:     make(map[string]string),
}

// Make sure the sender is configured and initialized
err := wfconfig.ConfigureSender()
if err != nil {
    panic(err)
}

// Wrap your handler
http.HandleFunc("/", wfconfig.WrapHandlerFunc(handler))

A complete sample app can be found in the examples folder

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

See the LICENSE file in the repository

# Packages

No description provided by the author

# Constants

DebugServerName has the server name to set when you want to print things to the log instead of sending data to Wavefront.
ErrCreateSender in case any errors occur while creating the Wavefront Direct Sender.

# Structs

WavefrontConfig configures the direct ingestion sender to Wavefront.
No description provided by the author