Git Product home page Git Product logo

go-wavefront-management-api's Introduction

Golang Wavefront Client

Golang SDK for interacting with the Wavefront v2 REST API, and sending metrics through a Wavefront proxy.

Usage

API Client

Supports most public API paths. Refer to the documentation for further information.

package main

import (
    "fmt"
    "log"
    "os"

    wavefront "github.com/WavefrontHQ/go-wavefront-management-api"
)

func main() {
    client, err := wavefront.NewClient(
        &wavefront.Config{
            Address: os.Getenv("WAVEFRONT_ADDRESS"),
            Token:     os.Getenv("WAVEFRONT_TOKEN"),
        },
    )

    query := client.NewQuery(
        wavefront.NewQueryParams(`ts("cpu.load.1m.avg", dc=dc1)`),
    )

    result, err := query.Execute()

    if err != nil {
        log.Fatal(err)
    }

    if len(result.TimeSeries) > 0 {
        fmt.Println(result.TimeSeries[0].Label)
        fmt.Println(result.TimeSeries[0].DataPoints[0])
    } else {
        fmt.Println("No matching data.")
    }
}

Writer

Writer has full support for metric tagging etc.

Again, see examples for a more detailed explanation.

package main

import (
    "log"
    "os"

    wavefront "github.com/WavefrontHQ/go-wavefront-management-api/writer"
)

func main() {
    source, _ := os.Hostname()

    wf, err := wavefront.NewWriter("wavefront-proxy.example.com", 2878, source, nil)
    if err != nil {
        log.Fatal(err)
    }
    defer wf.Close()

    wf.Write(wavefront.NewMetric("something.very.good.count", 33))
}

Contributing

Pull requests are welcomed.

If you'd like to contribute to this project, please raise an issue and indicate that you'd like to take on the work prior to submitting a pull request.

go-wavefront-management-api's People

Contributors

agarfu avatar akshaychitneni avatar ashwin1dd avatar chengwang86 avatar fr0stbyte avatar ggpaue avatar jmoravec avatar keep94 avatar louism517 avatar mikemcmahon avatar nathmclean avatar oppegard avatar pacejackson avatar ray2kool avatar sanoojm avatar siralvarex avatar snltd avatar ssnorrizaurous avatar yogeshprasad avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.