【问题标题】:Micronaut and OpenTracing of method calls方法调用的 Micronaut 和 OpenTracing
【发布时间】:2019-10-05 15:42:47
【问题描述】:

我们正在使用 Micronaut (v1.2.0) 构建一个 Web 应用程序,该应用程序将部署在 Kubernetes 集群中(我们使用 Istio 作为服务网格)。

我们希望检测关键方法调用,以便它们可以在 HTTP 请求跨度上下文中生成自己的跨度。为此,我们使用了 Micronaut OpenTracing 支持和 Jaeger 集成。

pom.xml中包含以下依赖项

...
    <dependency>
      <groupId>io.micronaut</groupId>
      <artifactId>micronaut-tracing</artifactId>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>io.jaegertracing</groupId>
      <artifactId>jaeger-thrift</artifactId>
      <scope>runtime</scope>
    </dependency>
...

已经用@ContinueSpan实现了Filter方法(也尝试了@NewSpan),如下所示

@Filter("/**")
public class TraceTestFilter implements HttpServerFilter {

  @Override
  public Publisher<MutableHttpResponse<?>> doFilter(
      HttpRequest<?> request, ServerFilterChain chain) {

    return testMethodTracing(request, chain);
  }

  @ContinueSpan
  public Publisher<MutableHttpResponse<?>> testMethodTracing(
      HttpRequest<?> request, ServerFilterChain chain) {

        // Details ommitted here
  }
}

以下维护在application-k8s.yml中(也有一个application.yml具有相同的设置)

---
tracing:
  jaeger:
    enabled: true
    sampler:
      probability: 1
    sender:
      agentHost: jaeger-agent.istio-system
      agentPort: 5775

但是,我们只看到由 Istio(Envoy 代理)生成的跟踪条目,而看不到方法调用本身的详细信息。

关于这里可能出现什么问题的任何想法?

【问题讨论】:

    标签: istio micronaut opentracing jaeger


    【解决方案1】:

    Istio 有一个名为 Distributed Tracing 的功能,它使用户能够跟踪分布在多个服务中的网格中的请求。这可用于可视化请求延迟、序列化和并行性。

    为此,Istio 使用了Envoy Proxy - Tracing 功能。

    您可以部署Bookinfo Application 并查看Trace context propagation 的工作原理。

    【讨论】:

      【解决方案2】:

      如果您遇到此票证中解释的相同问题,则需要等待 micronaut 的下一个版本或使用那里的 micronaut 人员提到的解决方法。

      https://github.com/micronaut-projects/micronaut-core/issues/2209

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多