func main() { conn, err := net.Dial("udp", "127.0.0.1:8125") if err != nil { fmt.Printf("Some error %v", err) return } for i := 0; i < 10; i++ { // This is the only line of code you need to push stats to telegraf fmt.Fprintf(conn, "deploys.test.myservice,from=go:1|c") time.Sleep(1 * time.Second) } conn.Close() }