【问题标题】:Kubernetes nginx ingress controller with opentracing does not show url resource path具有 opentracing 的 Kubernetes nginx 入口控制器不显示 url 资源路径
【发布时间】:2019-12-29 13:10:18
【问题描述】:

我们在 aws eks(kubernetes 版本 1.13)上使用 kubenrnetes nginx 入口控制器版本 0.25.1。 我们根据文档启用 opentracing 并使用 Datadog 查看跟踪。我们有一个通用的入口规则来捕获每条路径:

rule {
  host = "staging.example.com"
  http {
    path {
      backend {
        service_name = "cpe-test1"
        service_port = 80
      }

      path = "/"
    }
  }
}

在 Datadog ui 中,我们看到 nginx 跟踪,但是“资源”列始终显示“/”而不是“/test”或“/ping”的完整路径。
如果我们为每个资源路径创建单独的入口规则,那么我们会看到预期的完整路径(即“/test”或“//ping”),但是为每个路径创建入口规则非常不方便和乏味。有什么方法可以在 datadog UI 中查看完整的资源路径,而无需为每个资源路径创建单独的入口规则?

【问题讨论】:

  • 我认为这是不可能的。查看nginx-opentracing,它基于location 块创建路径,并且每个ingress path 创建1 个location 块(opentracing_operation_nameopentracing_location_operation_name 可能会改变这一点,但这些仍然是静态值)。

标签: nginx-ingress opentracing


【解决方案1】:

这可以通过将以下注释添加到 nginx ingress 来实现:

annotations:
    ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/configuration-snippet: |
      opentracing_trace_locations off;
      opentracing_tag resource.name $uri;

https://github.com/DataDog/dd-opentracing-cpp/issues/118查看完整答案

【讨论】:

    猜你喜欢
    • 2021-11-20
    • 2019-07-22
    • 2017-04-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-14
    • 1970-01-01
    • 2020-12-20
    相关资源
    最近更新 更多