question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Traces are being recorded for ignored patterns

See original GitHub issue

There 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

  1. 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);
                }));
  1. Call GET /monitoring/health endpoint.

Expected behaviour: No traces were reported for this call. Actual behaviour: Traces were recorded for this call. image

So, I went on and fixed it with PR #35 where you can see the reason of this bug.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
tilligcommented, Sep 26, 2019

As noted in my earlier comment

PR #35 looks like it’ll handle the hosting and MVC parts but not the EF bit.

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.

0reactions
cwe1sscommented, Dec 12, 2020

The new v0.7.0 release now supports this via the options.StartRootSpans property on all Configure*() methods. If ASP.NET Core instrumentation is enabled (which happens automatically when it is an ASP.NET Core application), all other instrumentation is set to StartRootSpans = false. This means that no spans are created if the ASP.NET Core request is ignored via the IgnorePatterns 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found