public sealed class TraceDecisionPredicate
Reference documentation and code samples for the Google.Cloud.Diagnostics.AspNetCore3 class TraceDecisionPredicate.
Used to determine if an HttpRequest should be traced. This will not override a decision by the trace header.
Namespace
GoogleCloudGoogle.Cloud.DiagnosticsAspNetCore3Assembly
Google.Cloud.Diagnostics.AspNetCore3.dll
Properties
Default
public static TraceDecisionPredicate Default { get; }
A default TraceDecisionPredicate that only disables tracing health checks.
Property Value | |
---|---|
Type | Description |
TraceDecisionPredicate |
DoNothing
public static TraceDecisionPredicate DoNothing { get; }
A TraceDecisionPredicate that does not have any effect on trace decisions and does not disable tracing health checks.
Property Value | |
---|---|
Type | Description |
TraceDecisionPredicate |
Methods
Create(Func<HttpRequest, bool?>, bool)
public static TraceDecisionPredicate Create(Func<HttpRequest, bool?> traceDecisionPredicate, bool ignoreHealthChecks = true)
Creates a TraceDecisionPredicate.
Parameters | |
---|---|
Name | Description |
traceDecisionPredicate | FuncHttpRequestbool Used to determine if a request should be traced. Takes an HttpRequest. It should return true if the request should be traced, false if the request should not be traced and null if the decision should be left to other sampling mechanisms. Must not be null. |
ignoreHealthChecks | bool Optional. True if Google App Engine health check requests should not be traced. Defaults to true. |
Returns | |
---|---|
Type | Description |
TraceDecisionPredicate |
Ignoring of health checks (ignoreHealthChecks
) takes precedence over the
predicate (traceDecisionPredicate
). If ignoreHealthChecks
is true and the request is a health check traceDecisionPredicate
will not
be called.
ShouldTrace(HttpRequest)
public bool? ShouldTrace(HttpRequest request)
Used to determine if a request should be traced. This will not override a trace header decision.
Parameter | |
---|---|
Name | Description |
request | HttpRequest The HTTP request to check. |
Returns | |
---|---|
Type | Description |
bool | True if the request should be traced, false if the request should not be traced and null if the decision should be left to other sampling mechanisms. |