Show / Hide Table of Contents

Class TraceDecisionPredicate

Used to determine if an System.Web.HttpRequest should be traced. This will not override a decision by the trace header.

Inheritance
System.Object
TraceDecisionPredicate
Inherited Members
System.Object.ToString()
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Google.Cloud.Diagnostics.AspNet
Assembly: Google.Cloud.Diagnostics.AspNet.dll
Syntax
public sealed class TraceDecisionPredicate

Properties

Default

A default TraceDecisionPredicate that only disables tracing health checks.

Declaration
public static TraceDecisionPredicate Default { get; }
Property Value
Type Description
TraceDecisionPredicate

DoNothing

A TraceDecisionPredicate that does not have any effect on trace decisions and does not disable tracing health checks.

Declaration
public static TraceDecisionPredicate DoNothing { get; }
Property Value
Type Description
TraceDecisionPredicate

Methods

Create(Func<HttpRequest, Nullable<Boolean>>, Boolean)

Creates a TraceDecisionPredicate.

Declaration
public static TraceDecisionPredicate Create(Func<HttpRequest, bool?> traceDecisionPredicate, bool ignoreHealthChecks = true)
Parameters
Type Name Description
System.Func<System.Web.HttpRequest, System.Nullable<System.Boolean>> traceDecisionPredicate

Used to determine if a request should be traced. Takes an System.Web.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.

System.Boolean ignoreHealthChecks

Optional. True if Google App Engine health check requests should not be traced. Defaults to true.

Returns
Type Description
TraceDecisionPredicate
Remarks

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)

Used to determine if a request should be traced. This will not override a trace header decision.

Declaration
public bool? ShouldTrace(HttpRequest request)
Parameters
Type Name Description
System.Web.HttpRequest request

The HTTP request to check.

Returns
Type Description
System.Nullable<System.Boolean>

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.

Back to top