Skip to content

Conversation

RohitRanjanMS
Copy link
Member

@RohitRanjanMS RohitRanjanMS commented Sep 10, 2025

Issue describing the changes in this PR

Azure Function Apps when using the Service Bus trigger or output binding. In certain scenarios, if the function execution encounters an error, the associated request is still reported as successful in telemetry and monitoring systems. As a result, failures may be hidden from logs, dashboards, or alerting pipelines, leading to inaccurate success rates and potentially masking operational issues.

resolves #11314

Pull request checklist

IMPORTANT: Currently, changes must be backported to the in-proc branch to be included in Core Tools and non-Flex deployments.

  • Backporting to the in-proc branch is not required
    • Otherwise: Link to backporting PR
  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • My changes do not require diagnostic events changes
    • Otherwise: I have added/updated all related diagnostic events and their documentation (Documentation issue linked to PR)
  • I have added all required tests (Unit tests, E2E tests)

Additional information

Additional PR information

@RohitRanjanMS RohitRanjanMS marked this pull request as ready for review September 10, 2025 18:53
@RohitRanjanMS RohitRanjanMS requested a review from a team as a code owner September 10, 2025 18:53
@Copilot Copilot AI review requested due to automatic review settings September 10, 2025 18:53
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a telemetry issue where Azure Function Apps with Service Bus triggers/outputs were incorrectly reporting failed invocations as successful. The fix ensures that Activity status is properly set to Error when function invocations fail.

  • Moves activity status setting from the logging layer to the invocation response layer
  • Adds proper execution context restoration to maintain AsyncLocal state flow
  • Includes comprehensive test coverage for the failure scenario

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/WebJobs.Script.Grpc/Channel/GrpcWorkerChannel.cs Implements the core fix by adding SetCurrentActivityStatus method and calling it during failed invocations
test/WebJobs.Script.Tests/Workers/Rpc/GrpcWorkerChannelTests.cs Adds test coverage to verify activity status is set to Error on invocation failures
release_notes.md Documents the change in release notes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@RohitRanjanMS RohitRanjanMS requested a review from jviau September 12, 2025 05:39
Copy link
Member

@brettsam brettsam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a couple small comments

@RohitRanjanMS RohitRanjanMS merged commit 63d5954 into dev Sep 16, 2025
9 checks passed
@RohitRanjanMS RohitRanjanMS deleted the roranjan/update-request-telemetry-status branch September 16, 2025 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OTel - Report Failed Executions as "Failure"

4 participants