Giter Site home page Giter Site logo

gotelemetry's Introduction

gotelemetry

Go bindings for the Telemetry Visualization API.

Installing

go get github.com/telemetryapp/gotelemetry

import "github.com/telemetryapp/gotelemetry"

Usage

Gotelemetry provides Go structures for all the flow variants support by the Telemetry API. It allows you to create flows and submit them to the API servers:

func ExampleFlow() {
    c := NewCredentials("test-api-token")

    g := Gauge{
        Value: 123,
    }

    f := NewFlow("test_gauge", &g)

    err := f.Publish(c)

    if err != nil {
        panic("Something went wrong…", err.Error)
    }
}

You can also submit flows in batches to limit network usage and latency:

func ExampleBatch() {
    // Note that the test API token cannot be used for
    // batch submission.
    c, err := NewCredentials("myapitoken")

    So(err, ShouldBeNil)

    g := Gauge{Value: 10}
    fg := NewFlow("gauge_1", &g)

    v := Value{Value: 101.23}
    fv := NewFlow("gauge_2", &v)

    b := Batch{}

    b.SetFlow(fg)
    b.SetFlow(fv)

    err = b.Publish(c)

    if err != nil {
        panic("Something went wrong…", err.Error())
    }
}

Note that neither flow nor batch values are thread-safe. If you require thread safety, you must mediate access to your values through some kind of synchronization mechanism, like a mutex.

Support and bug reports

Don't hesitate to open issues if you find a bug or require support.

gotelemetry's People

Contributors

gersham avatar mtabini avatar yehezkielbs avatar

Watchers

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