侧边栏

Ocelot中文文档-跟踪(转)

原文地址:https://www.cnblogs.com/snaildev/articles/9151756.html

Ocelot使用一个杰出的项目Butterfly 提供了跟踪功能。

为了使用跟踪,请阅读Butterfly的文档。

在Ocelot中如果你想跟踪一个ReRoute,你需要做如下事情:

在ConfigureServices方法中

1
2
3
4
5
6
7
8
services
    .AddOcelot()
    .AddOpenTracing(option =>
    {
        //this is the url that the butterfly collector server is running on...
        option.CollectorUrl = "http://localhost:9618";
        option.Service = "Ocelot";
    });

然后在ocelot.json文件中,添加如下配置到你想要跟随的ReRoute中。

1
2
3
"HttpHandlerOptions": {
      "UseTracing"true
  },

现在,当这个ReRoute被调用的时候,Ocelot会发生跟踪信息到Butterfly。

posted @ 2022-09-30 15:45  我有我的骄傲  阅读(35)  评论(0)    收藏  举报