Skip to content

retgits/gin-wavefront

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gin-wavefront

Go Report Card Godoc GitHub GitHub tag (latest SemVer)

gin-wavefront is a Gin middleware to emit metrics to Wavefront.

Prerequisites

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

Installation

Using go get

go get github.com/retgits/gin-wavefront

Usage

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

wfconfig := &ginwavefront.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),
}
wfemitter, err := ginwavefront.WavefrontEmitter(wfconfig)
if err != nil {
    fmt.Println(err.Error())
}

Now you can use the wfemitter as a middleware function in Gin

r := gin.New()
r.Use(wfemitter)

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

About

Gin middleware to emit metrics to Wavefront

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages