英文:
No metrics showing on Datadog
问题
我正在尝试发送从我的Go微服务生成的指标,类似于这个。
我正在使用Gitlab将镜像推送到Azure容器注册表,并最终部署到我的Kubernetes集群中。我能够看到这个微服务的日志,但无法看到生成的自定义指标。我已经按照这里提到的方式设置了hostPort
,用于Kubernetes代理设置。如果能帮助找到错误的原因,将非常有帮助。
英文:
I am trying to send metrics generated from my Go microservice similar to this-
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)
}
}
I am using Gitlab to push the image into Azure Container Registry and eventually deploying it into my Kubernetes cluster. I am able to see the logs for this microservice, but not being able to see the custom metrics generated. I have already set the hostPort
as mentioned here for the Kubernetes agent setup. Any help in finding the cause of the error will be really helpful.
答案1
得分: 0
问题出在我没有在应用程序清单中添加主机信息。我按照这个链接(https://www.datadoghq.com/blog/monitor-kubernetes-docker/)解决了这个问题。
英文:
The issue was there since I did not add the host information in the application manifest. I followed this link which solved the problem.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论