mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 15:58:16 +08:00
tweaks
This commit is contained in:
@ -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
|
||||
^^^^^^^^^
|
||||
|
Reference in New Issue
Block a user