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.

Ignore Tracing Http Requests

See original GitHub issue

There is any way to ignore some specific endpoints when using: Google.Cloud.Diagnostics.AspNetCore ? I would like to ignore /health or /swagger/*

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
jskeetcommented, Aug 22, 2019

Yes, in TraceServiceOptions you can specify the TraceFallbackPredicate property of type TraceDecisionPredicate, which is used to determine whether or not to trace requests which don’t explicitly have a trace header. You’d configure this in the AddGoogleTrace call (I don’t believe it can be done in UseGoogleDiagnostics at the moment, although we could look at changing that):

// The "true" is to ignore /_ah/health requests for AppEngine
services.AddGoogleTrace(options => options.TraceFallbackPredicate = new TraceDecisionPredicate(IgnoreSwaggerAndHealth, true));

...
bool? IgnoreSwaggerAndHealth(HttpRequest request) =>
    request.Path == "/health" || request.Path.StartsWith("/swagger/", StringComparison.Ordinal) ? false : null;

Note that the return type is bool? to indicate “definitely don’t trace”, “definitely trace”, or “trace if other code thinks it should”. This predicate won’t be called if the request already has a trace ID though - I hope that’s not a problem for you.

Let me know if this works out for you.

0reactions
jskeetcommented, Aug 22, 2019

Hooray - I’m so glad it worked out in the end, and thanks for explaining what was wrong… it’ll help me ask future customers to check their permissions 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable HTTP TRACE/TRACK methods in APACHE
There are two ways to disable HTTP TRACE/TRACK methods in Apache. ... Traditionally you can achieve this using the rewrite rule added to...
Read more >
How to intercept/disable HTTP Trace Method in Java ...
My question is how can I make TRACE response as same as the other requests ? Note: The solution in this thread did...
Read more >
Support filtering functions to trace/ignore http(s) requests
Current implementation of http plugin allows people to filter out requests that they do not want to trace using either ignoreIncomingPaths ...
Read more >
Disable Trace/Track in Apache HTTPD - Techstacks HOWTO's
Simply add the TraceEnable directive into your httpd.conf and set the value to Off. The second mechanism involves creating a mod_rewrite rule that...
Read more >
Ignoring Unwanted Resources in APM
The Trace Agent component within the Datadog Agent has two methods to prevent certain traces from coming through: ignoring span tags or ignoring...
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