azure-functions-host icon indicating copy to clipboard operation
azure-functions-host copied to clipboard

Traces lost after awaiting long task?

Open spplante opened this issue 1 year ago • 4 comments

Not sure if this is a bug related to Azure Insights or Function Apps, but I am using an Azure Function v4 in .net 6.0 and Azure Insights randomly loses traces after awaiting for an async method that takes roughly 8 minutes to complete.

When executing the function using the Test/Run button in Azure, I can see all logs correctly in the live console, however in both the Monitor page or Azure Insights the traces after the long await don't exist.

I validated that there is 0% sampling in Azure Insights going on.

It looks like after a certain amount of time Insights just gives up and goes to sleep. I have had one successfull execution where 100% of the traces were there, in this case the long operation took +- 6 min instead of 8 minutes, not sure if it has something to do with this...

Investigative information

Please provide the following:

  • Timestamp: 12/9/2023 11:00:02 PM
  • Function App version: v4
  • Function name(s) (as appropriate): GovernanceAttributes_Full
  • Invocation ID: 89ef4f25-f4be-4fcb-b5ac-39882757f255
  • Region: East US 2

Repro steps

In an async method of your code:

  • Add some traces using ILogger.LogInformation("...")
  • Await for 8 minutes using await Task.Delay(480000);
  • Add some traces again after the await

Expected behavior

Insights should not lose traces and should show all traces

Actual behavior

Once in Azure, you will see the logs in the live console when you "Run/Test" your function manually, but both the Monitor section and Insights will often lose traces that were sent after the Task.Delay

Known workarounds

N/A

Related information

N/A

spplante avatar Dec 11 '23 15:12 spplante

Hi @spplante thanks for reporting will check and update.

bhagyshricompany avatar Dec 26 '23 13:12 bhagyshricompany

@bhagyshricompany Any news on this?

spplante avatar Jan 17 '24 13:01 spplante

@aishwaryabh pls comment .

bhagyshricompany avatar Jan 23 '24 10:01 bhagyshricompany

@RohitRanjanMS tagging you here for awareness (and in case you have some thoughts)

@bhagyshricompany flagging this with Needs: Triage Assistance so we can build a repro to investigate what is happening here.

fabiocav avatar Feb 21 '24 21:02 fabiocav

Hi @spplante , it seems the app no longer exists. Please create a support ticket if you are still facing this issue with some other app? We can enable diagnostics logs to investigate TelemetryClient behavior.

RohitRanjanMS avatar Apr 22 '24 06:04 RohitRanjanMS