[AppService] az webapp status: Add new command to show per-instance Site Runtime Status#33632
[AppService] az webapp status: Add new command to show per-instance Site Runtime Status#33632HaripriyaMehta wants to merge 6 commits into
Conversation
|
Validation for Azure CLI Full Test Starting...
Thanks for your contribution! |
|
Hi @HaripriyaMehta, |
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
AppService |
|
@HaripriyaMehta please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
| return rows | ||
|
|
||
|
|
||
| def show_webapp_status(cmd, resource_group_name, name, slot=None, instance=None): |
There was a problem hiding this comment.
This takes a slot, but the actual command does not. I do think the slot param should be present
There was a problem hiding this comment.
Is this about _params.py and there not being a slot parameter in az webapp status? I thought the slot parameter should be inherited from az webapp the way resource group or name are? Or am I misunderstanding something?
There was a problem hiding this comment.
I think the slot param would still work if unlisted as it is inherited (might want to test this to be 100%)
But I also see some other functions in _params.py, do list it, maybe as a style?
with self.argument_context('webapp list-instances') as c:
c.argument('name', arg_type=webapp_name_arg_type, id_part=None)
c.argument('slot', options_list=['--slot', '-s'], help='Name of the web app slot. Default to the productions slot if not specified.')
| # Normalize both shapes into a list for uniform formatting. | ||
| if isinstance(result, dict): | ||
| properties = result.get('properties') | ||
| if isinstance(properties, list): |
There was a problem hiding this comment.
I see there's a lot of isinstance type checks here, do we also need to check if each item in properties list is a dict? Up to you, just asking because we seem to be checking types a lot.
item.get('lastError') for item in items (line 2495) is assuming item is a dict I believe
| slot_segment = f'/slots/{slot}' if slot else '' | ||
| instance_segment = f'/{instance}' if instance else '' | ||
| request_url = ( | ||
| f'{resource_manager}/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}' |
There was a problem hiding this comment.
Just something from copilot, have you confirmed resource_manager does not end in '/' so we dont get resource_manager// ?
| items = _extract_webapp_status_items(result) | ||
| # LastError is a nullable field on the backend SiteRuntimeStatusOnWorker contract, | ||
| # so the error columns (LastError, LastErrorDetails, LastErrorTimestamp) are only | ||
| # surfaced when at least one instance reports a LastError. |
There was a problem hiding this comment.
Thank you for the comments!
| if not status_tip_logged: | ||
| _log_webapp_status_tip(webapp_name, resource_group_name, True) | ||
| break | ||
| if deployment_status == "RuntimeFailed": |
There was a problem hiding this comment.
Do we not want to log status tip if RuntimeFailed?
Related command
az webapp statusDescription
Adds a new
az webapp statuscommand that surfaces the per-instance Site Runtime Statusfor a web app by calling the
siteStatusARM API. Supports:--slotto target a deployment slot--instanceto filter to a single instance (runaz webapp list-instancesto discover IDs)Output is rendered as a table via a transformer, with error columns shown only when an
instance reports a
lastError.Screenshots of Output:
Testing
WebappStatusScenarioTest(recorded scenario test, NODE|22-lts Linux app).TestWebappStatusMockedwith 5 mocked unit tests covering slot/instance URLconstruction, output formatting, and the missing-instance error path.
azdev style appservice→ PASSED (pylint + flake8)azdev linter --include-whl-extensions appservice→ No violations foundazdev test test_webapp_status TestWebappStatusMocked→ 6 passedHistory Notes
[AppService]
az webapp status: Add new command to show per-instance Site Runtime Status