From 29fd24098e7a9a2ca3ec4ac6c888376312f7fbbe Mon Sep 17 00:00:00 2001 From: Yixiang Zhao Date: Mon, 9 Jan 2023 06:34:58 +0000 Subject: [PATCH 1/3] [ISSUE #2790] Add Jaeger tracing plugin en docs Signed-off-by: Yixiang Zhao --- docs/en/design-document/13-jaeger.md | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 docs/en/design-document/13-jaeger.md diff --git a/docs/en/design-document/13-jaeger.md b/docs/en/design-document/13-jaeger.md new file mode 100644 index 0000000000..e9452c3554 --- /dev/null +++ b/docs/en/design-document/13-jaeger.md @@ -0,0 +1,44 @@ +# Collect Trace with Jaeger + +## Jaeger + +[Jaeger](https://www.jaegertracing.io/), inspired by [Dapper](https://research.google.com/pubs/pub36356.html) and [OpenZipkin](https://zipkin.io/), is a distributed tracing platform created by [Uber Technologies](https://uber.github.io/) and donated to [Cloud Native Computing Foundation](https://cncf.io/). It can be used for monitoring microservices-based distributed systems. + +For the installation of Jaeger, you can refer to the [official documentation](https://www.jaegertracing.io/docs/latest/getting-started/) of Jaeger. It is recommended to use docker image `jaegertracing/all-in-one` to quickly build the environment for testing. + +## Configuration + +To enable the trace exporter of EventMesh Runtime, set the `eventMesh.server.trace.enabled` field in the `conf/eventmesh.properties` file to `true`. + +```conf +# Trace plugin +eventMesh.server.trace.enabled=true +eventMesh.trace.plugin=jaeger +``` + +To customize the behavior of the trace exporter such as timeout or export interval, edit the `exporter.properties` file. + +```conf +# Set the maximum batch size to use +eventmesh.trace.max.export.size=512 +# Set the queue size. This must be >= the export batch size +eventmesh.trace.max.queue.size=2048 +# Set the max amount of time an export can run before getting(TimeUnit=SECONDS) +eventmesh.trace.export.timeout=30 +# Set time between two different exports (TimeUnit=SECONDS) +eventmesh.trace.export.interval=5 +``` + +To send the exported trace data to Jaeger, edit the `eventmesh.trace.jaeger.ip` and `eventmesh.trace.jaeger.port` fields in the `conf/jaeger.properties` file to match the configuration of the Jaeger server. + +```conf +# Jaeger's IP and Port +eventmesh.trace.jaeger.ip=localhost +eventmesh.trace.jaeger.port=14250 +``` + +## Migrating from Zipkin + +Collector service exposes Zipkin compatible REST API `/api/v1/spans` which accepts both Thrift and JSON. Also there is `/api/v2/spans` for JSON and Proto. + +So you can also use the `eventmesh-trace-zipkin` plugin to collect trace with Jaeger. Please refer to the `eventmesh-trace-zipkin` documentation for the specific configuration. By default this feature in Jaeger is disabled. It can be enabled with `--collector.zipkin.host-port=:9411`. \ No newline at end of file From c58bf83502614ed33279f2727463ce177d29240f Mon Sep 17 00:00:00 2001 From: Yixiang Zhao Date: Mon, 9 Jan 2023 06:35:08 +0000 Subject: [PATCH 2/3] [ISSUE #2790] Add Jaeger tracing plugin zh docs Signed-off-by: Yixiang Zhao --- docs/zh/desing-document/13-jaeger.md | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 docs/zh/desing-document/13-jaeger.md diff --git a/docs/zh/desing-document/13-jaeger.md b/docs/zh/desing-document/13-jaeger.md new file mode 100644 index 0000000000..9ac0269342 --- /dev/null +++ b/docs/zh/desing-document/13-jaeger.md @@ -0,0 +1,44 @@ +# 通过 Jaeger 观察 Trace + +## Jaeger + +[Jaeger](https://www.jaegertracing.io/) 是 [Uber](https://uber.github.io/) 开发的分布式跟踪系统,现已成为 [CNCF](https://cncf.io/) 开源项目,其灵感来源于 Google 的 [Dapper](https://research.google.com/pubs/pub36356.html) 和 Twitter 的 [Zipkin](https://zipkin.io/),用于监控基于微服务的分布式系统。 + +Jaeger 的安装可以参考[官方文档](https://www.jaegertracing.io/docs/latest/getting-started/),推荐使用官方的 Docker 镜像 `jaegertracing/all-in-one` 来快速搭建环境进行测试。 + +## 配置 + +为了启用 EventMesh Runtime 的 trace exporter,请将 `conf/eventmesh.properties` 文件中的 `eventMesh.server.trace.enabled` 字段设置为 true。 + +```conf +# Trace plugin +eventMesh.server.trace.enabled=true +eventMesh.trace.plugin=jaeger +``` + +为了定义 trace exporter 的行为,如超时时间或导出间隔,请编辑 `exporter.properties` 文件。 + +```conf +# Set the maximum batch size to use +eventmesh.trace.max.export.size=512 +# Set the queue size. This must be >= the export batch size +eventmesh.trace.max.queue.size=2048 +# Set the max amount of time an export can run before getting(TimeUnit=SECONDS) +eventmesh.trace.export.timeout=30 +# Set time between two different exports (TimeUnit=SECONDS) +eventmesh.trace.export.interval=5 +``` + +为了将导出的 trace 数据发送到 Jaeger,请编辑 `conf/jaeger.properties` 文件中的 `eventmesh.trace.jaeger.ip` 和 `eventmesh.trace.jaeger.port` 字段,来匹配 Jaeger 服务器的配置。 + +```conf +# Jaeger's IP and Port +eventmesh.trace.jaeger.ip=localhost +eventmesh.trace.jaeger.port=14250 +``` + +## 从 Zipkin 迁移 + +Jaeger 采集器服务暴露了与 Zipkin 兼容的 REST API,`/api/v1/spans` 可以接收 Thrift 和 JSON,`/api/v2/spans` 可以接收 JSON 和 Proto。 + +因此你也可以使用 `eventmesh-trace-zipkin` 插件来通过 Jaeger 观察 trace,具体配置细节请参考 `eventmesh-trace-zipkin` 的文档。默认情况下这个特性在 Jaeger 中是关闭的,可以通过 `--collector.zipkin.host-port=:9411` 启用。 \ No newline at end of file From 8db67112dd3b2fcfebe8eb30e0deffc2dc68c053 Mon Sep 17 00:00:00 2001 From: Yixiang Zhao Date: Mon, 9 Jan 2023 06:47:41 +0000 Subject: [PATCH 3/3] Add Apache header Signed-off-by: Yixiang Zhao --- .../trace/jaeger/JaegerTraceServiceTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/eventmesh-trace-plugin/eventmesh-trace-jaeger/src/test/java/org/apache/eventmesh/trace/jaeger/JaegerTraceServiceTest.java b/eventmesh-trace-plugin/eventmesh-trace-jaeger/src/test/java/org/apache/eventmesh/trace/jaeger/JaegerTraceServiceTest.java index 62d64d9dc9..19e1702bcd 100644 --- a/eventmesh-trace-plugin/eventmesh-trace-jaeger/src/test/java/org/apache/eventmesh/trace/jaeger/JaegerTraceServiceTest.java +++ b/eventmesh-trace-plugin/eventmesh-trace-jaeger/src/test/java/org/apache/eventmesh/trace/jaeger/JaegerTraceServiceTest.java @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.apache.eventmesh.trace.jaeger; import static org.junit.Assert.assertThrows;