Instrument Go apps using our Go client library for SignalFx. to send custom metrics from your code. Adding it to your project is as simple as:

import "github.com/signalfx/golib/sfxclient"

To send an ad-hoc datapoint to SignalFx, use HTTPDatapointSink, the core of the library. Here’s an example:

func SendHelloWorld() {

     client := NewHTTPDatapointSink()

     client.AuthToken = "ABCDXYZ"

     ctx := context.Background()

     client.AddDatapoints(ctx, []*datapoint.Datapoint{

         GaugeF("hello.world", nil, 1.0),

     })

 }

In this example, we sent the floating-point value of 1.0 to SignalFx as a gauge called hello.world.

You can also easily to send metrics and dimensions on a periodic basis on an interval you define using the built-in scheduler. Read more about our Go client library on godoc.org.

Go is just the latest SignalFx client library, adding to our support for Java, Python, Ruby and node.js.



About the authors

Rebecca Tortell

Rebecca is a product manager with many years of experience helping startups make products that users love. Previously she worked at companies like Turn, Playdom, and Disney Interactive.

Enjoyed this blog post? Sign up for our blog updates