i'm collect data using Go and want to visualize it, i chose Datadog, but didn't find examples or live projects where Go used for sending metrics to Datadog. But in offical site says that Go is supported.
2条回答 默认 最新
- doushi1929 2018-07-01 16:25关注
First step is to install the DataDog agent on the server in which you are running your application:
https://docs.datadoghq.com/agent/
You then need to enable the
DogStatsD
service in the DataDog agent:https://docs.datadoghq.com/developers/dogstatsd/
After that, you can send metrics to the
statsd
agent using any Go library that connects tostatsd
.For example:
https://github.com/DataDog/datadog-go
https://github.com/go-kit/kit/tree/master/metrics/statsd
Here's an example program sending some counts using the first library:
import ( "github.com/DataDog/datadog-go/statsd" "log" ) func main() { // Create the client c, err := statsd.New("127.0.0.1:8125") if err != nil { log.Fatal(err) } // Prefix every metric with the app name c.Namespace = "myapp." // Count two events err = c.Count("my_counter", 2, nil, 1) if err != nil { log.Fatal(err) } // Close the client err = c.Close() if err != nil { log.Fatal(err) } }
解决 无用评论 打赏 举报
悬赏问题
- ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
- ¥15 谁有desed数据集呀
- ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
- ¥15 关于#hadoop#的问题
- ¥15 (标签-Python|关键词-socket)
- ¥15 keil里为什么main.c定义的函数在it.c调用不了
- ¥50 切换TabTip键盘的输入法
- ¥15 可否在不同线程中调用封装数据库操作的类
- ¥15 微带串馈天线阵列每个阵元宽度计算
- ¥15 keil的map文件中Image component sizes各项意思