This commit is contained in:
TomPallister
2020-05-25 18:39:00 +01:00
parent 56fe7b5ba9
commit 21b9d73c7f
9 changed files with 226 additions and 133 deletions

View File

@ -1,8 +1,41 @@
Tracing
=======
This page details how to perform distributed tracing with Ocelot. At the moment we only support Butterfly but other tracers might just work without
anything Ocelot specific.
This page details how to perform distributed tracing with Ocelot.
OpenTracing
^^^^^^^^^^^
Ocelot providers tracing functionality from the excellent `OpenTracing C# <https://github.com/opentracing/opentracing-csharp>`_ project. The code for the Ocelot integration
can be found `here <https://github.com/ThreeMammals/Ocelot.Tracing.OpenTracing>`_.
The example below uses `Jaeger C# <https://github.com/jaegertracing/jaeger-client-csharp>`_ client to provide the tracer used in Ocelot.
.. code-block:: csharp
services.AddSingleton<ITracer>(sp =>
{
var loggerFactory = sp.GetService<ILoggerFactory>();
Configuration config = new Configuration(context.HostingEnvironment.ApplicationName, loggerFactory);
var tracer = config.GetTracer();
GlobalTracer.Register(tracer);
return tracer;
});
services
.AddOcelot()
.AddOpenTracing();
Then in your ocelot.json add the following to the Route you want to trace..
.. code-block:: json
"HttpHandlerOptions": {
"UseTracing": true
},
Ocelot will now send tracing information to Jaeger when this Route is called.
Butterfly
^^^^^^^^^