Open telemetry .NET runtime instrumentation overhead #7068
Unanswered
niroshikaias-hub
asked this question in
Q&A
Replies: 1 comment 2 replies
-
|
I wouldn't expect to see memory usage grow indefinitely with stable usage, no. If you can create a public GitHub repository containing app that's a minimal repro of just enough to show what you're using, we could take a look and see if there's an issues cause by the OTel libraries (assuming no bugs in your app). |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi team,
I’m working with OpenTelemetry .NET (v1.15.x) using runtime instrumentation + Prometheus exporter, and I’m seeing continuous memory growth even when my service is mostly idle.
Setup
Using:
AddRuntimeInstrumentation()
AddPrometheusExporter()
Removed:
AddAspNetCoreInstrumentation()
Prometheus scrape interval: 30s
Added:
SetMaxMetricStreams(200)
My Code snippet:
builder.Services.AddOpenTelemetry()
.ConfigureResource(resource => resource.AddService("Service"))
.WithMetrics(metrics =>
{
metrics.AddRuntimeInstrumentation();
metrics.SetMaxMetricStreams(200);
metrics.AddPrometheusExporter();
});
app = builder.Build();
app.MapPrometheusScrapingEndpoint();
Observations:
Service is mostly idle (very low request rate)
But I still see:
Continuous allocation spikes
LOH (Large Object Heap) growing step-by-step
GC is running, but heap is not dropping
Heap (Gen2 + LOH) keeps increasing over time
What I tested:


Removed ASP.NET instrumentation → no major change
Tried AddView filtering → either no improvement or metrics dropped when AddView.Drop is added after adding few AddView(gc,heap,loh)
Prometheus scrape already reduced (30s)
My query is:
Is this expected behavior of:
runtime instrumentation + metrics SDK buffering/exporter, or
could this indicate a memory retention issue in OTel metrics pipeline?
Also,is there any recommended way to:
reduce memory footprint of runtime metrics?
control retention/allocation behavior?
or is this overhead expected when using runtime metrics + Prometheus exporter?
My main goal is to see GC,Heap,LOH,POH of the service(which runs in .net core).
Note: I cannot try OTEL zero instrumentation because my service code already have dynatrace logging as a profiler.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions