Feat/opentracing (#1243)

This commit is contained in:
Tom Pallister
2020-05-25 18:42:48 +01:00
committed by GitHub
parent 3439be8927
commit 865520f2d7
13 changed files with 929 additions and 76 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
^^^^^^^^^