csharp-netcore
csharp-netcore copied to clipboard
Prevent endless loop if tracer sends each span separately via HTTP
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 customDelegatingHandler
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?!
Fixed for Jaeger's HttpSender. See https://github.com/jaegertracing/jaeger-client-csharp/issues/154