Skip to content
Metric reporting for Go applications
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
reporters
.gitignore
.travis.yml
README.md
average.go
counter.go
current.go
telemetry.go
telemetry_test.go
total.go

README.md

telemetry

build-status code-coverage go-doc

metric reporting for Go applications

sample usage:

package main

import(
    "github.com/arussellsaw/telemetry"
    "github.com/arussellsaw/telemetry/reporters"
    "time"
    "net/http"
    )

func main() {
    //New telemetry object (prefix, maintainance schedule)
    tel := telemetry.New("test", 5 * time.Second)
    avg := telemetry.NewAverage(tel, "average", 60 * time.Second)

    //Register influxdb reporter
    influx := reporters.InfluxReporter{
        Host: "192.168.1.100:8086",
        Interval: 60 * time.Second,
        Tel: tel,
        Database: "telemetry"
    }
    influx.Report() //trigger reporting loop

    //Create http handler for json metrics
    telemetryHandler := reporters.TelemetryHandler{
        Tel: tel,
    }
    http.HandleFunc("/metrics", telemetryHandler.ServeHTTP)
    http.ListenAndServe(":8080", nil)

    start = time.Now()
    somethingYouWantToTime()
    avg.Add(tel, float64(time.Since(start).Nanoseconds()))
}
You can’t perform that action at this time.