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

Azure Functions does not support DiagnosticListener callbacks when using System.Diagnostics.DiagnosticSource (> 4.7.0) #7135

Closed
utpilla opened this issue Feb 6, 2021 · 8 comments

Comments

@utpilla
Copy link

utpilla commented Feb 6, 2021

DiagnosticListener callbacks are not called in Function apps when using System.Diagnostics.DiagnoticSource (> 4.7.0)

Investigative information

Tried this locally

Repro steps

Expected behavior

Response should be:

[
    "System.Net.Http.HttpRequestOut.Start",
    "System.Net.Http.Request",
    "System.Net.Http.HttpRequestOut.Stop",
    "System.Net.Http.Response"
]

This is a list of events that are logged by HttpClient when making an outbound Http request

Actual behavior

Response is empty

Known workarounds

Revert the System.Diagnostics.DiagnosticSource package version to 4.7.0

Related information

@fabiocav
Copy link
Member

We need to track the unification change in 4.0.

Tagging @brettsam for validation in v4

@RohitRanjanMS
Copy link
Member

@utpilla this is working in V4, we can close this issue.
@brettsam @fabiocav FYI

@liliankasem liliankasem modified the milestones: Functions Sprint 110, Left Overs Jan 19, 2023
@ThomsonTan
Copy link

Haven't seen any PR tagged for this issue. Is it working now?

@RohitRanjanMS
Copy link
Member

Hi @ThomsonTan did this not work for you in V4?

@cijothomas
Copy link

Hi @ThomsonTan did this not work for you in V4?

It should work in V4 and Otel 1.3.*.
A working app is here: https://github.com/cijothomas/FunctionsOpenTelemetry/tree/master/FunctionsOpenTelemetry

@agr
Copy link

agr commented May 4, 2023

Should it work with non-isolated workers? What I see is that msbuild when building a function deletes the "System.Diagnostics.DiagnoticSource.dll" file (presumably by a RemoveRuntimeDependencies msbuild task) if it ends up in the output directory, then when the code touches any OpenTelemetry class a TypeInitializationException exception is thrown:

FileNotFoundException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

OpenTelemetry.Api/1.4.0 depends on that particular version of System.Diagnostics.DiagnosticSource.

Setting _FunctionsSkipCleanOutput to true (as suggested here) seem to help though.

@fabiocav
Copy link
Member

@agr 7.0.0 dependencies will not work in Azure Functions 4.0 (in-proc) with the unification rules it has.

If you need to use 7.0.0, the recommendation is to use the Isolated (out-of-proc) model.

@fabiocav
Copy link
Member

Closing this as resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants