azure-functions-host
azure-functions-host copied to clipboard
Start metrics listener after specialization
Issue describing the changes in this PR
A bug was found where it appears that metrics are being captured pre-specialization and being persisted, leading to an inflated started invocation count e.g:
'AppFailureCount':0,'ActiveInvocationCount':0,'StartedInvocationCount':123
With this change, we are waiting for specialization to happen before we collect metrics.
Design choices and questions
I am currently utilizing the metrics publisher which lives in Script.WebHost and has access to IOptionsMonitor<StandbyOptions>
to listen for OnStandbyOptionsChange
. StandbyOptions
cannot be imported into the Script project where the HostMetricsProvider lives, so I am open to better suggestions on when to start the listener.
Q: Is starting the listener after specialization enough to fix this issue or do we need to also reset the actual metric for started invocation count?
I am deploying these changes to test them out on a legion stamp.
Pull request checklist
- [ ] 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
- [ ] Otherwise: I've added my notes to
- [ ] 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