Repository navigation
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
This is related to #7901 and #7586, both of which have been unfortunately closed.
However, the fix for excessive logging noise was apparently due in Functions Runtime 4.1038, and the problem persists:
There also appears to be a deeper configuration restriction that I just can't get my head around with the functions host and otel in general, related more to #7901. I know that was closed, and this might be more of a question for functions/otel rather than aspire, but I thought I'd start here in case anyone has been able to solve it. Let's say I wanted to filter the logging coming out of the functions host....
Versions:
Visual Studio 2022 17.14.7 Preview 1.0
Functions Runtime 4.1038.300.25164
Aspire 9.3.1
Aspire.Hosting.Azure.Functions 9.3.1-preview.1.25305.6
Steps:
- Create a new Aspire Starter App.
- Add a function app to the solution with http trigger, include in aspire orchestration.
- See the structured logging in the dashboard.
- Attempt to set the minimum log level in host.json using usual OpenTelemetry approaches (this works with webapi apps):
"telemetryMode": "openTelemetry",
"logging": {
"OpenTelemetry": {
"logLevel": {
"default": "Warning",
"Host": "Warning",
"Function": "Warning",
"Host.Aggregator": "Warning"
}
},
- Structured logging below level "warning" still appears in the dashboard. Logging provider alias "OpenTelemetry" configuration seems to be ignored by the function host.
- Attempt to set the minimum log level using top-level function host approaches:
"telemetryMode": "openTelemetry",
"logging": {
"logLevel": {
"default": "Warning",
"Host": "Warning",
"Function": "Warning",
"Host.Aggregator": "Warning"
},
"OpenTelemetry": {
"logLevel": {
"default": "Warning",
"Host": "Warning",
"Function": "Warning",
"Host.Aggregator": "Warning"
}
}
}
- Structured logging still appears in dashboard.
Logging in function apps always seems to be odd in comparison to standard webapi apps. I've tried a lot of variations on this theme. Note that the top-level function logging configuration does impact the logging that appears in the Console. But I've yet to find any way of filtering any otel logging coming out of the host.
I can provide a sample repo if needed.
Many thanks.
Expected Behavior
Filter the opentelemetry structured logging coming out of the functions host by some means.
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version info
.NET SDK:
Version: 9.0.301
Commit: a596cd22e2
Workload version: 9.0.300-manifests.e42facbb
MSBuild version: 17.14.5+edd3bbf37
Anything else?
No response

Activity
captainsafia commentedon Jul 3, 2025
Rohit Ranjan (@RohitRanjanMS) Does anything look off to you about the host version or config the user is using here?
Andrew Smith (@DGAISmith) Perhaps a quick sample app would help here as well!
DGAISmith commentedon Jul 3, 2025
Many thanks for the comment. I've created a sample repo that tries to show the problems we're having. I've tried to layer the commits to show how things progress:
https://github.com/DGAISmith/AspireFunctionOtel
Note that before I add the service bus trigger, I'm unable to filter the otel structured logging coming from the host (although this may be because I simply don't know how to configure the otel behaviour in the host, it's not clear what my options are to be honest and I've tried a lot of different methods).
After I add the service bus trigger, you then get all the noise in the structured logs. Which of course I'm still unable to filter out due to the above.
RohitRanjanMS commentedon Jul 3, 2025
Thanks for the sample, Andrew Smith (@DGAISmith). I will have a look at it. Meanwhile, can you configure Functions defaults and see if it makes any difference?
dotnet add package Microsoft.Azure.Functions.Worker.OpenTelemetry --version 1.0.0-preview1
builder.Services.AddOpenTelemetry().UseFunctionsWorkerDefaults();DGAISmith commentedon Jul 4, 2025
If I add this (well, I've used 1.1.0-preview6). in addition to the standard aspire service defaults (should I use it instead of?):
...a lot of the noise in structured logging goes away from the service bus activity, and the duplicate logs are sorted. However:
DGAISmith commentedon Jul 30, 2025
I've done more digging around this. I believe one part of the problem is a conflict between the ServiceDefaults code that gets scaffolded in to a new Aspire app and the necessary steps for Otel with Functions. It just doesn't include extra bits needed for Function Apps.
Duplicated Logs / Log Filtering
As mentioned above, if you follow the guidance here - https://learn.microsoft.com/en-us/azure/azure-functions/opentelemetry-howto?tabs=otlp-export&pivots=programming-language-csharp - you are instructed to add UseFunctionsWorkerDefaults(), which under the hood has the following really important line -
Without this (and potentially the other bits in UseFunctionsWorkerDefaults(), which have interesting features in FunctionsResourceDetector) , the Aspire template with a new Function App with "enlist in Aspire orchestration" ticked simply isn't correct and things are missing, leading to the duplication and inability to filter.
I think we can add our own workarounds for this part of the problem based on the above, but it's not a good experience out of the box at the moment.
Service Bus Trigger Trace Noise
Unfortunately, I haven't been able to resolve this one. The traces look to be coming from the functions host, so I don't have a way to filter them out with a sampler in the worker code. The aspire function hosting package switches the host's telemetryMode to OpenTelemetry, which is probably a good move. But then you just get thousands of traces building up, similar to the issue logged previously about blobs and storage. Is there a way of controlling this via environment variables or host.json?
It's an annoyance locally, but I'm more concerned about when we deploy to azure. That's a lot of unnecessary telemetry.
Rohit Ranjan (@RohitRanjanMS) any advice would be gratefully received
captainsafia commentedon Aug 11, 2025
Rohit Ranjan (@RohitRanjanMS) I think you came to the same conclusions as Andrew Smith (@DGAISmith) above based on our other thread. Did you have any thoughts on what the ideal fix here would be?
earloc commentedon Aug 12, 2025
This is affecting us heavily as well, which makes it very hard to even grasp, if our logs are actually helping when identifying runtime issues. The sheer amount of traces quickly hits the ceiling of maximum number of entries aspire-dashboard keeps in-memory.
Is there any workaround known so far, which let's us at least filter the noise based on some log-level, for now?
RohitRanjanMS commentedon Aug 12, 2025
Yes, I understand the pain. I am going to suppress the noise. Working on a PR for this.
RohitRanjanMS commentedon Sep 8, 2025
This is fixed, will be available in the next host release (1043) - Azure/azure-functions-host#11260
earloc commentedon Sep 8, 2025
Great, really looking forward to this!
So we would need to update our local
azure-functions-core-toolsfor this to take effect?RohitRanjanMS commentedon Sep 8, 2025
yes, it will take few weeks before we have a new core tools release.
DGAISmith commentedon Sep 8, 2025
Wonderful, I'll keep an eye out for the new tools release. This will help a lot, many thanks.
biltongza commentedon Oct 22, 2025
It looks like this is released, given that https://github.com/Azure/azure-functions-host/releases/tag/v4.1043.200 is out and my functions runtime matches that version number.
Is there anything outstanding for this?
DGAISmith commentedon Oct 23, 2025
I'd need to check more thoroughly, but I'd need the 4.1043 to appear via the function-core-tools and in visual studio before this one goes away entirely for my team. Otherwise we still have the noise locally, even if it's been resolved when apps are deployed to azure.