@@ -0,0 +1,42 @@ | |||||
# OpenTelemetry | |||||
https://opentelemetry.io/ | |||||
OpenTelemetry is a collection of tools, APIs, and SDKs. Use it to instrument, generate, collect, and export telemetry data (metrics, logs, and traces) to help you analyze your software’s performance and behavior. | |||||
## Integration | |||||
You can find it [here](https://opentelemetry.io/docs/instrumentation/net/getting-started/) about how to use OpenTelemetry in console applications or ASP.NET Core, at here we mainly describe how to tracing CAP data to OpenTelemetry. | |||||
### Configuration | |||||
Install the CAP OpenTelemetry package into the project. | |||||
```C# | |||||
dotnet add package DotNetCore.Cap.OpenTelemetry | |||||
``` | |||||
The OpenTelemetry data comes from [diagnostics](diagnostics.md), add the configuration to enable data collection. | |||||
```C# | |||||
services.AddCap(x => | |||||
{ | |||||
//*** | |||||
x.UseOpenTelemetry(); // <-- Add this line | |||||
}); | |||||
``` | |||||
Add the instrumentation of CAP to the configuration of OpenTelemetry. | |||||
```C# | |||||
services.AddOpenTelemetryTracing((builder) => builder | |||||
.AddAspNetCoreInstrumentation() | |||||
.AddCapInstrumentation() // <-- Add this line | |||||
.AddZipkinExporter() | |||||
); | |||||
``` | |||||
Here is a diagram of CAP's tracking data in Zipkin: | |||||
<img src="/img/opentelemetry.png"> |
@@ -0,0 +1,45 @@ | |||||
# OpenTelemetry | |||||
https://opentelemetry.io/ | |||||
OpenTelemetry是工具、api和sdk的集合。 使用它来检测、生成、收集和导出遥测数据(度量、日志和跟踪),以帮助您分析软件的性能和行为。 | |||||
## 集成 | |||||
You can find it [here](https://opentelemetry.io/docs/instrumentation/net/getting-started/) about how to use OpenTelemetry in console applications or ASP.NET Core, at here we mainly describe how to tracing CAP data to OpenTelemetry. | |||||
你可以在[这里](https://opentelemetry.io/docs/instrumentation/net/getting-started/)找到关于如何在控制台应用或ASP.NET Core 中使用OpenTelemetry。 | |||||
在这里我们主要描述如何将CAP集成到OpenTelemetry中。 | |||||
### 配置 | |||||
安装CAP的OpenTelemetry包到项目中。 | |||||
```C# | |||||
dotnet add package DotNetCore.Cap.OpenTelemetry | |||||
``` | |||||
OpenTelemetry 的跟踪数据来自于[Diagnostics](diagnostics.md)发送的诊断数据,使用下面的配置行来启用收集数据。 | |||||
```C# | |||||
services.AddCap(x => | |||||
{ | |||||
//*** | |||||
x.UseOpenTelemetry(); // <-- Add this line | |||||
}); | |||||
``` | |||||
添加 CAP Instrumentation 到 OpenTelemetry的扩展配置中。 | |||||
```C# | |||||
services.AddOpenTelemetryTracing((builder) => builder | |||||
.AddAspNetCoreInstrumentation() | |||||
.AddCapInstrumentation() // <-- Add this line | |||||
.AddZipkinExporter() | |||||
); | |||||
``` | |||||
以下是CAP的跟踪数据在 Zipkin 中的一个示意图: | |||||
<img src="/img/opentelemetry.png"> |
@@ -113,6 +113,7 @@ nav: | |||||
- Consul: user-guide/en/monitoring/consul.md | - Consul: user-guide/en/monitoring/consul.md | ||||
- Dashboard: user-guide/en/monitoring/dashboard.md | - Dashboard: user-guide/en/monitoring/dashboard.md | ||||
- Diagnostics: user-guide/en/monitoring/diagnostics.md | - Diagnostics: user-guide/en/monitoring/diagnostics.md | ||||
- OpenTelemetry: user-guide/en/monitoring/opentelemetry.md | |||||
- Samples: | - Samples: | ||||
- Github: user-guide/en/samples/github.md | - Github: user-guide/en/samples/github.md | ||||
- eShopOnContainers: user-guide/en/samples/eshoponcontainers.md | - eShopOnContainers: user-guide/en/samples/eshoponcontainers.md | ||||
@@ -149,8 +150,8 @@ nav: | |||||
- 监控: | - 监控: | ||||
- Consul: user-guide/zh/monitoring/consul.md | - Consul: user-guide/zh/monitoring/consul.md | ||||
- Dashboard: user-guide/zh/monitoring/dashboard.md | - Dashboard: user-guide/zh/monitoring/dashboard.md | ||||
- 性能追踪: user-guide/zh/monitoring/diagnostics.md | |||||
- 健康检查: user-guide/zh/monitoring/health-checks.md | |||||
- Diagnostics: user-guide/zh/monitoring/diagnostics.md | |||||
- OpenTelemetry: user-guide/zh/monitoring/opentelemetry.md | |||||
- 示例: | - 示例: | ||||
- Castle DynamicProxy: user-guide/zh/samples/castle.dynamicproxy.md | - Castle DynamicProxy: user-guide/zh/samples/castle.dynamicproxy.md | ||||
- Github: user-guide/zh/samples/github.md | - Github: user-guide/zh/samples/github.md | ||||