-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only determine success of request based on statuscode when the Activity Status is Unset #43594
Only determine success of request based on statuscode when the Activity Status is Unset #43594
Conversation
…ty Status is Unset
Thank you for your contribution @rvanheest! We will review the pull request and get back to you soon. |
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Need to update changelog.
…b.com/rvanheest/azure-sdk-for-net into feature/determine-success-with-status
@TimothyMothra updated changelog |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @rvanheest!
Co-authored-by: Vishwesh Bankwar <vishweshbankwar@users.noreply.github.com>
Fixes #41993
When a non-2xx response from a web request should not be marked as an error in OpenTelemetry, you can set the
Activity
's status toActivityStatusCode.Ok
manually.However, even though the status was set to
Ok
, the ApplicationInsights exporter still treats it like an error because of the response code being>= 400
. This should only happen in cases whereactivity.Status == ActivityStatusCode.Unset
.Added to the
RequestData.IsSuccess
function is this extra check. Also, inside theif
now the expressionactivity.Status != ActivityStatusCode.Error
becomes alwaystrue
and can hence be removed.