Traces are being recorded for ignored patterns
See original GitHub issueThere is an option to ignore some tracing patterns as described here - #28 Steps to reproduce: 0. Setup: ASP.NET Core 2.2, OpenTracing.Contrib.NetCore 0.5.0
- Have the following code. MonitoringController.cs
[HttpGet]
[Route("health")]
public IActionResult Health()
{
var state = StateManager.CurrentState;
if (state is State.RequiresRestart)
{
this.log.Warning("Health probe was requested, but service is in {State} state", state);
return this.StatusCode(503);
}
return this.Ok();
}
Startup.cs
services.AddJaeger().AddOpenTracing(builder =>
builder.ConfigureAspNetCore(options =>
{
// ignore certain requests to prevent spamming the tracer with irrelevant data
options.Hosting.IgnorePatterns.Add(request =>
request.Request.Path.Value?.StartsWith("/monitoring") == true);
}));
- Call GET
/monitoring/health
endpoint.
Expected behaviour: No traces were reported for this call.
Actual behaviour: Traces were recorded for this call.
So, I went on and fixed it with PR #35 where you can see the reason of this bug.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Q: Way to ignore healthcheck traces when using automatic ...
Hi, Will there be a way to ignore specific endpoints such as health checks when using the automatic tracer?
Read more >TroubleShooting OpenTelemetry NodeJS Tracing Issues
This guide is a checklist that will help you troubleshoot OpenTelemetry NodeJS tracing issues in your system.
Read more >Record traces | Android Studio
Learn how to record a trace in Android Studio. ... The CPU Profiler displays the status, duration, and type of recording being made....
Read more >Correlated Logs Are Not Showing Up In The Trace ID Panel
Logs are being sent from the host/container/pod that emitted the trace. ... If this process is not working as expected, ensure the logs...
Read more >Ignoring Unwanted Resources in APM
The ignore resources option allows resources to be excluded if the global root span of the trace matches certain criteria. See Exclude resources...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As noted in my earlier comment
Basically, this fixes one of the issues, but it doesn’t actually enforce it at all levels. So, no, unfortunately the PR didn’t totally resolve this for me.
The new v0.7.0 release now supports this via the
options.StartRootSpans
property on allConfigure*()
methods. If ASP.NET Core instrumentation is enabled (which happens automatically when it is an ASP.NET Core application), all other instrumentation is set toStartRootSpans = false
. This means that no spans are created if the ASP.NET Core request is ignored via theIgnorePatterns
option.The library still creates spans if running in a regular console application. In that case, you have to configure the library to your liking.