<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Consumption Tier on Journey through Cloud</title><link>https://gurupasupathy.com/tags/consumption-tier/</link><description>Recent content in Consumption Tier on Journey through Cloud</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 13 Jul 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://gurupasupathy.com/tags/consumption-tier/index.xml" rel="self" type="application/rss+xml"/><item><title>Where did the missing milliseconds go in a Logic App execution?</title><link>https://gurupasupathy.com/post/logic-app-missing-milliseconds/</link><pubDate>Mon, 13 Jul 2026 00:00:00 +0000</pubDate><guid>https://gurupasupathy.com/post/logic-app-missing-milliseconds/</guid><description>This article outlines an approach with example on how to find the actual time taken by Logic Apps to execute the actions. It talks about using AzureDiagnostics to find accurate time taken by each action.</description><content:encoded><![CDATA[<hr>
<h3 id="context">Context</h3>
<hr>
<p>While investigating the latency of an API, I noticed that different Azure services were reporting different execution times for the same request. The caller reported a total duration of <strong>851ms</strong>, APIM reported <strong>845ms</strong>, and Application Insights showed that APIM waited <strong>837.6ms</strong> for the Logic App to respond. However, the Logic App runtime view appeared to show only about <strong>400ms</strong> of execution time.</p>
<p>The request flows through APIM to a Logic App (Consumption), which performs some in-memory processing before invoking an HTTP endpoint as part of the workflow.</p>
<p>This article walks through the investigation and shows how AzureDiagnostics can be used to account for almost every millisecond of the reported latency.By the end, we&rsquo;ll reconcile the reported latency to within 3.5 ms.</p>
<hr>
<h3 id="analysis">Analysis</h3>
<hr>
<p>The durations logged were - </p>
<ul>
<li>
<p>Calling UI logs report it took <strong>851ms</strong> to complete the request</p>
</li>
<li>
<p>APIM reports (ApiManagementGatewayLogs) it took 845 ms to complete. Total Time: <strong>845 ms</strong> | Backend Time: 837 ms | Client Time: 5 ms. </p>
<p>This means, between the UI and APIM there is a 6 ms difference, (851ms –845ms) which can largely be attributed to network transit. APIM spent about 5 ms preparing and returning the response to the caller. So, Backend Time + Client Time = ~ total time (there is a small 3ms difference). This is exactly what Application Insights also records - 845ms</p>
</li>
<li>
<p>As per the Application Insights, <strong>837.6ms</strong> is the APIM backend duration — the elapsed time between APIM forwarding the request to the Logic App endpoint and APIM receiving the HTTP response from that endpoint</p>
</li>
</ul>
<p><img loading="lazy" src="/img/la-missing-ms-1.jpg"></p>
<p>The strange part was that while Application Insights reported 837.6ms, the Logic App runtime log showed just about 400ms. </p>
<p>**Note ** -  Ignore the parallel steps in purple box because the Logic App
returns the response and does not wait for these steps. All calculations
are excluding these steps</p>
<p><img loading="lazy" src="/img/la-missing-ms-2.jpg"></p>
<p>At first glance, it appears that the Logic App spent only about 400ms executing because several actions are shown as 0s in the runtime view. Then why is Application Insights reporting 837.6ms?</p>
<p><strong>Unaccounted duration - 437.6ms (837.6ms as per AppInsights - 400ms taken by backend)</strong></p>
<p>So, I pulled up the logs from AzureDiagnostics table in the associated Log Analytics Workspace. It gave an entirely different picture. All the steps that were reported as 0s in Logic App runtime page were actually consuming measurable milliseconds. As shown below.</p>
<p><img loading="lazy" src="/img/la-missing-ms-3.jpg"></p>
<ul>
<li>The first row is the trigger of the Logic App</li>
<li>The second row tells you how long the logic app workflow ran. You may be  wondering why it shows as 985ms - that&rsquo;s because this workflow has a parallel branching within that still runs after the response is sent back to the caller after ~837.6ms. From that point till 985ms (~147.4ms) was consumed by the parallel branch and is not relevant for this discussion. I have removed the parallel unrelated actions in the screenshot.</li>
<li>So, lesson 1 - always look at AzureDiagnostics for real latency numbers.</li>
</ul>
<p>Adding all those durations came up to <strong>545ms</strong>. This is the total time taken by <strong>ALL</strong> the actions within the Logic App.</p>
<p><strong>Revised Unaccounted duration is 292.6ms (837.6ms, total duration reported in AppInsights  - 545ms)</strong></p>
<hr>
<h3 id="gap-between-actions-within-logicapp"><strong>Gap between actions within Logic App</strong></h3>
<hr>
<p>After some analysis, I realized that there is a gap between when the APIM calls the Logic App and when the Logic App&rsquo;s trigger actually runs. In addition to that, there are gaps between the different action end time and start time. I always assumed that if Action N ended at T ms then Action N+1 would start somewhere around ~ T+1ms. This was not the case. There were considerable gaps between when a parent action ends and its child action starts.</p>
<p>For example, look at the difference between 4th row end time (ends 43.8097323) and 5th row start time (starts 43.8285386) - it is 18.806ms. If you add up all these differences, it is coming up to <strong>233.94ms</strong> in my case.
~234ms accounts for most of the unaccounted 292.6ms (refer to end of previous paragraph).</p>
<p>Lesson 2 - The workflow may incur wait time after completing one action and before starting the next action.</p>
<p>My hypothesis is that this effect is more noticeable in the Consumption tier because it runs on shared multi-tenant infrastructure.</p>
<p><strong>Revised Unaccounted duration - 58.6ms</strong></p>
<hr>
<h3 id="the-final-piece-of-thepuzzle"><strong>The final piece of the puzzle</strong></h3>
<hr>
<p>Now I have 58.6ms unaccounted for. As per the logs, APIM called Logic App at 2026–07–06T23:49:43.5784182 and Logic App Manual trigger invoked at 2026–07–06T23:49:43.633478</p>
<p>So, the call from APIM to Logic App took <strong>55.06ms</strong> to dispatch, adding to the overall duration. Since we know 55.06 was towards the dispatch the total unaccounted time is 58.6ms - 55.06ms = <strong>3.54ms</strong></p>
<p><strong>Final unaccounted duration - 3.54ms</strong></p>
<hr>
<h3 id="latency-breakdown">Latency breakdown</h3>
<hr>
<p>APIM backend duration (App Insights) - <strong>837.6 ms</strong></p>
<p>Sum of Logic App action durations - <strong>545.0 ms</strong></p>
<p>Inter-action scheduling gaps - <strong>233.9 ms</strong></p>
<p>APIM → trigger dispatch gap - <strong>55.1 ms</strong></p>
<p>Residual runtime variance - <strong>3.5 ms</strong></p>
<hr>
<h3 id="summary">Summary</h3>
<hr>
<p>UI reported duration: 851ms; Application Insights reports time taken for the APIM to receive the response from Logic App was 837.6ms</p>
<p>A -&gt; Total duration taken by Logic App as reported in Application Insights is <strong>837.6ms</strong></p>
<p>B -&gt; Total duration for all the tasks (excluding parallel path), as per Log Analytics is <strong>545ms</strong></p>
<p>C -&gt; Gap between the end of parent action and start of child in the logic app, as per Log Analytics is <strong>234ms</strong></p>
<p><em>Although we set the sequence of actions in Logic App, the logs show measurable scheduling gaps between actions. In Consumption tier, these gaps may be influenced by the shared multi-tenant runtime and workflow orchestration overhead.</em></p>
<p>D -&gt; Dispatch gap = 43.633478 − 43.5784182 = 0.0550598s = <strong>55.06ms</strong></p>
<p>APIM called Logic App: 2026–07–06T23:49:<strong>43.5784182</strong></p>
<p>Logic App Manual trigger invoked: 2026–07–06T23:49:<strong>43.633478</strong></p>
<p>Unaccounted time = A - (B + C + D) = 837.6 - (545 + 234 + 55.06) = <strong>3.54ms</strong></p>
<p><strong>Key Observations-</strong></p>
<ul>
<li>
<p>The total workflow duration is not simply the sum of action durations. Logic Apps may introduce scheduling gaps between actions, and these gaps contribute to the end-to-end latency experienced by callers.</p>
</li>
<li>
<p>AzureDiagnostics is the source of truth for millisecond-level Logic App action timing. The Logic App designer view can round actions to 0s, hiding meaningful execution time and scheduling gaps between actions.</p>
</li>
</ul>
<p>If you&rsquo;re troubleshooting Logic App latency, don&rsquo;t rely solely on the Logic App runtime view. Correlating APIM telemetry with AzureDiagnostics provides a much more accurate picture of where time is actually being spent.</p>
<p>Hope this helps!</p>
<hr>
]]></content:encoded></item></channel></rss>