csharp-netcore icon indicating copy to clipboard operation
csharp-netcore copied to clipboard

Prevent endless loop if tracer sends each span separately via HTTP

Open cwe1ss opened this issue 6 years ago • 1 comments

As every HTTP call creates a new span, there could be an endless loop if a tracer sends each span separately (for whatever reason) to its backend system.

The only way to prevent this right now is to tell the HTTP instrumentation that those tracer HTTP calls should not be traced. This can be done in two ways:

  • There's a built-in rule that ignores requests that contain a request property key called ot-ignore. Ideally, this would automatically be set by the tracer. If the tracer allows passing a custom DelegatingHandler a user can also set this himself for each request via:
request.Properties["ot-ignore"] = true;
  • Adding a custom rule that ignores these requests based on their URL. This can be done in ConfigureServices via the following example:
services.Configure<HttpHandlerDiagnosticOptions>(options =>
{
    options.IgnorePatterns.Add(request => request.RequestUri == _tracerUri);
});

Maybe there is a way to prevent this scenario even if none of these things have been done?!

cwe1ss avatar Mar 14 '18 15:03 cwe1ss

Fixed for Jaeger's HttpSender. See https://github.com/jaegertracing/jaeger-client-csharp/issues/154

bocharovf avatar Aug 28 '19 17:08 bocharovf