Class ServerTimingOptions
- Namespace
- Cuemon.AspNetCore.Diagnostics
- Assembly
- Cuemon.AspNetCore.dll
Configuration options for ServerTimingMiddleware and related.
public class ServerTimingOptions : TimeMeasureOptions, IValidatableParameterObject, IParameterObject
- Inheritance
-
ServerTimingOptions
- Implements
- Inherited Members
Constructors
ServerTimingOptions()
Initializes a new instance of the ServerTimingOptions class.
public ServerTimingOptions()
Remarks
The following table shows the initial property values for an instance of ServerTimingOptions.
Property | Initial Value |
---|---|
TimeMeasureCompletedThreshold | Zero |
LogLevelSelector | metric => metric.Duration.HasValue ? LogLevel.Debug : LogLevel.None |
SuppressHeaderPredicate | environment => environment.IsProduction() |
UseTimeMeasureProfiler | false |
Properties
LogLevelSelector
Gets or sets the function delegate that determines the LogLevel for a given ServerTimingMetric.
public Func<ServerTimingMetric, LogLevel> LogLevelSelector { get; set; }
Property Value
- Func<ServerTimingMetric, LogLevel>
The function delegate that determines the LogLevel for a given ServerTimingMetric.
SuppressHeaderPredicate
Gets or sets the predicate that can suppress the Server-Timing HTTP header(s).
public Func<IHostEnvironment, bool> SuppressHeaderPredicate { get; set; }
Property Value
- Func<IHostEnvironment, Boolean>
The function delegate that can determine if the Server-Timing HTTP header(s) should be suppressed.
UseTimeMeasureProfiler
Gets or sets a value indicating whether to apply TimeMeasureProfiler automatically on action methods in a Controller.
public bool UseTimeMeasureProfiler { get; set; }
Property Value
- Boolean
true
if action methods in a Controller should time measuring automatically; otherwise,false
.
Remarks
This property is only used in the context of a Global Filter for MVC.
Methods
ValidateOptions()
Determines whether the public read-write properties of this instance are in a valid state.
public void ValidateOptions()
Remarks
This method is expected to throw exceptions when one or more conditions fails to be in a valid state.
Exceptions
- InvalidOperationException
SuppressHeaderPredicate cannot be null.