Skip to content

Conversation

@alrod
Copy link
Member

@alrod alrod commented Nov 6, 2025

Proposed Improvement
We want to emit error logs to the customer’s Application Insights whenever there are connectivity issues to the resource.

Current Behavior
Exceptions are swallowed in the extension code and logged only in internal logs.

Planned Change

  • The change will allow connectivity exceptions to bubble up to the WebJobs SDK, so they can be logged in the standard WebJobs format.
  • All extensions will follow the same logging format for consistency.
  • In case of an exception, the trigger will be ignored for the current vote integration.

References
-https://github.com/Azure/azure-webjobs-sdk/blob/dev/src/Microsoft.Azure.WebJobs.Host/Scale/ScaleManager.cs#L195
-https://github.com/Azure/azure-webjobs-sdk/blob/dev/src/Microsoft.Azure.WebJobs.Host/Scale/ScaleManager.cs#L121

Additional Notes

  • The ScaleManager class in WebJobs SDK is used for both regular scale and runtime-driven scale.
  • We are also adding voting logs in the PR to standardize how the current vote is logged. These logs will also be provided to the customer.

Copilot AI review requested due to automatic review settings November 6, 2025 18:05
Copy link
Contributor

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 changes exception handling behavior in the ServiceBus scale monitor by removing generic exception catching that previously logged warnings and returned default metrics. Instead, generic exceptions are now propagated to callers.

  • Removes two generic catch (Exception e) blocks from ServiceBusMetricsProvider that swallowed exceptions
  • Updates test to expect exceptions to be thrown instead of being caught and logged
  • Specific exception types (ServiceBusException with MessagingEntityNotFound, UnauthorizedAccessException) continue to be handled gracefully with warnings

Reviewed Changes

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

File Description
ServiceBusMetricsProvider.cs Removes generic exception handlers in GetMessageCountAsync and GetMetricsAsync that previously logged warnings
ServiceBusScaleMonitorTests.cs Updates test to verify generic exceptions are now thrown instead of caught and logged

_logger.LogWarning($"Error querying for Service Bus {entityName} scale status: {e.Message}");
}

// Path for connection strings with no manage claim
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

The comment at line 173 is now misleading. After removing the generic exception handler, this fallback return statement is only reached when an UnauthorizedAccessException is caught at line 164, not for other generic exceptions. The comment should be updated to clarify this is specifically the fallback for UnauthorizedAccessException (no manage claim), or when MessagingEntityNotFound is encountered.

Suggested change
// Path for connection strings with no manage claim
// Fallback for UnauthorizedAccessException (no manage claim) or when MessagingEntityNotFound is encountered

Copilot uses AI. Check for mistakes.
@alrod alrod closed this Nov 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants