Azure / Azure/azure-functions-host
int64 overflow in MetricsEventManager
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
I came across the following stack trace in my App Insights exceptions view. If I had to guess, I'd say that it was probably from this line:
https://github.com/Azure/azure-webjobs-sdk-script/blob/d9feee3db2a59421fd5e11a0ac0636ca0a58049e/src/WebJobs.Script.WebHost/Diagnostics/MetricsEventManager.cs#L462
```
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.Splitter ---> System.OverflowException: Value was either too large or too small for a UInt64.
at System.Decimal.ToUInt64(Decimal d)
at Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.MetricsEventManager.FunctionActivityTracker.<>c.b__23_1(IGrouping`2 FunctionGroups)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.MetricsEventManager.FunctionActivityTracker.RaiseMetricsPerFunctionEvent()
at Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.MetricsEventManager.FunctionCompleted(FunctionStartedEvent completedEvent)
at Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.WebHostMetricsLogger.EndEvent(MetricEvent metricEvent)
at Microsoft.Azure.WebJobs.Script.Description.FunctionInvokerBase.d__30.MoveNext()
```
Contributor guide
Research direction
Start by reading src/WebJobs.Script.WebHost/Diagnostics/MetricsEventManager.cs around line 462 and tracing the RaiseMetricsPerFunctionEvent call in the reported stack trace. Compare the Decimal.ToUInt64 failure with the FunctionCompleted path. Done means the metrics path no longer raises this overflow for the reported case and the behavior is verified with a regression test if one is available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100