Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] LiveMetrics showing incorrect values #46417

Closed
TimothyMothra opened this issue Oct 3, 2024 · 3 comments · Fixed by #46429
Closed

[BUG] LiveMetrics showing incorrect values #46417

TimothyMothra opened this issue Oct 3, 2024 · 3 comments · Fixed by #46429
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Monitor - Distro Monitor OpenTelemetry Distro

Comments

@TimothyMothra
Copy link
Contributor

Library name and version

Azure.Monitor.OpenTelemetry.AspNetCore

Describe the bug

LiveMetrics is showing incorrect values.
Specifically investigating Requests per second.

Expected behavior

N/A

Actual behavior

N/A

Reproduction Steps

Here I've written a console app that starts a web application.
The default endpoint is invoked in a loop, and every second we print out the number of requests.

    internal class Program
    {
        public static async Task Main(string[] args)
        {
            var builder = WebApplication.CreateBuilder(args);
            builder.Logging.ClearProviders();
            string connectionString = "...";
            builder.Services.AddOpenTelemetry().UseAzureMonitor(x => x.ConnectionString = connectionString);
            var app = builder.Build();

            app.MapGet("/", () => "Hello World!");

            var hostTask = app.RunAsync();

            using var httpClient = new HttpClient();
            var stopwatch = Stopwatch.StartNew();
            int callCount = 0;

            while (true)
            {
                var response = await httpClient.GetStringAsync("http://localhost:5000");
                callCount++;

                if (stopwatch.ElapsedMilliseconds >= 1000)
                {
                    Console.WriteLine($"{DateTime.Now:HH:mm:ss}: {callCount} calls");
                    callCount = 0;
                    stopwatch.Restart();
                }
            }
        }
    }

Console output shows between 30-50 requests per second.
image

The Metrics blade is showing an average of 45 requests per second.
image

LiveMetrics dashboard is showing 3 requests per second
image

A fiddler trace is also showing that the SDK is sending 3 requests per second
image

Environment

No response

@TimothyMothra TimothyMothra self-assigned this Oct 3, 2024
@TimothyMothra TimothyMothra added the Monitor - Distro Monitor OpenTelemetry Distro label Oct 3, 2024
@github-actions github-actions bot added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Oct 3, 2024
@TimothyMothra
Copy link
Contributor Author

TimothyMothra commented Oct 3, 2024

Seems like our internal buffer had a hard cap of 20. Meaning once the buffer was full, we would drop telemetry (from LiveMetrics).

When i changed this to an arbitrary high value, Live Metrics shows the correct value

image

@TimothyMothra TimothyMothra added bug This issue requires a change to an existing behavior in the product in order to be resolved. and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Oct 3, 2024
@jsquire jsquire added the Client This issue points to a problem in the data-plane of the library. label Oct 4, 2024
@TimothyMothra
Copy link
Contributor Author

FYI; The bug is related to the capacity limit on our internal buffer. The capacity was set too low.
We're discussing either increasing the capacity or removing it altogether.
We need to take some more time to review the performance implications of either change.

@vRune4
Copy link

vRune4 commented Dec 12, 2024

Live metrics:
Image

Meanwhile, what was running during this time was a load test that averaged almost 1500 requests per second.

Image

This is a .net 9 asp.net project that benchmarks a single query running against the northwind database.

builder.Services.AddOpenTelemetry().UseAzureMonitor(opt => { opt.Credential = credential; opt.ConnectionString = appInsightsConnectionString; });

Plus I'm worried that the CPU display is also displaying a too optimistic value. At some point, in an actual service of ours, if I really hit it hard the CPU chart will rarely go above 25-40% before all reporting simply halts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Monitor - Distro Monitor OpenTelemetry Distro
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants