Sdílet prostřednictvím


RequestContext.AddClassifier Method

Definition

Overloads

AddClassifier(ResponseClassificationHandler)

Customizes the ResponseClassifier for this operation. Adding a ResponseClassificationHandler changes the classification behavior so that it first tries to classify a response via the handler, and if the handler doesn't have an opinion, it instead uses the default classifier. Handlers are applied in order so the most recently added takes precedence. This is useful for cases where you'd like to prevent specific response status codes from being treated as errors by logging and distributed tracing policies -- that is, if a response is not classified as an error, it will not appear as an error in logs or distributed traces.

AddClassifier(Int32, Boolean)

Customizes the ResponseClassifier for this operation to change the default Response classification behavior so that it considers the passed-in status code to be an error or not, as specified. Status code classifiers are applied after all ResponseClassificationHandler classifiers. This is useful for cases where you'd like to prevent specific response status codes from being treated as errors by logging and distributed tracing policies -- that is, if a response is not classified as an error, it will not appear as an error in logs or distributed traces.

AddClassifier(ResponseClassificationHandler)

Source:
RequestContext.cs

Customizes the ResponseClassifier for this operation. Adding a ResponseClassificationHandler changes the classification behavior so that it first tries to classify a response via the handler, and if the handler doesn't have an opinion, it instead uses the default classifier. Handlers are applied in order so the most recently added takes precedence. This is useful for cases where you'd like to prevent specific response status codes from being treated as errors by logging and distributed tracing policies -- that is, if a response is not classified as an error, it will not appear as an error in logs or distributed traces.

public void AddClassifier (Azure.Core.ResponseClassificationHandler classifier);
member this.AddClassifier : Azure.Core.ResponseClassificationHandler -> unit
Public Sub AddClassifier (classifier As ResponseClassificationHandler)

Parameters

classifier
ResponseClassificationHandler

The custom classifier.

Exceptions

If this method is called after the RequestContext has been used in a method call.

Applies to

AddClassifier(Int32, Boolean)

Source:
RequestContext.cs

Customizes the ResponseClassifier for this operation to change the default Response classification behavior so that it considers the passed-in status code to be an error or not, as specified. Status code classifiers are applied after all ResponseClassificationHandler classifiers. This is useful for cases where you'd like to prevent specific response status codes from being treated as errors by logging and distributed tracing policies -- that is, if a response is not classified as an error, it will not appear as an error in logs or distributed traces.

public void AddClassifier (int statusCode, bool isError);
member this.AddClassifier : int * bool -> unit
Public Sub AddClassifier (statusCode As Integer, isError As Boolean)

Parameters

statusCode
Int32

The status code to customize classification for.

isError
Boolean

Whether the passed-in status code should be classified as an error.

Exceptions

statusCode is not between 100 and 599 (inclusive).

If this method is called after the RequestContext has been used in a method call.

Applies to