在Datadog上没有显示任何指标。

huangapple go评论80阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2021年10月20日 20:09:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/69645732.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定