-
-
Save jqr/5468956 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net" | |
"bufio" | |
"time" | |
) | |
const apiKey string = "your api key" | |
func main() { | |
fmt.Println("Starting Instrumental collection") | |
conn, err := net.Dial("tcp", "collector.instrumentalapp.com:8000") | |
if err != nil { | |
fmt.Println(err) | |
} | |
fmt.Println("Sending hello") | |
fmt.Fprintf(conn, "hello version 0.1\n") | |
status, err := bufio.NewReader(conn).ReadString('\n') | |
if err != nil { | |
fmt.Println(err) | |
} | |
fmt.Println("Authenticating w/ instrumental") | |
fmt.Fprintf(conn, "authenticate %v\n", apiKey) | |
authStatus, err := bufio.NewReader(conn).ReadString('\n') | |
if err != nil { | |
fmt.Println("There was an error authenticating") | |
} | |
fmt.Println("Sneding increment to test metric") | |
fmt.Fprintf(conn, "increment test.increment_metric 1 %v\n", time.Now().Unix()) | |
fmt.Printf("metric submitted") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment