-
Notifications
You must be signed in to change notification settings - Fork 14
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
How can we make sure that dependencies are automatically tracked #468
Comments
I've been looking into the code of the SqlClient library, but cannot find any calls to log requests there, so it must be done via the Application Insights middleware ? |
The ApplicationInsights sdk contains a If we look at the The I think we should investigate if we can leverage this functionality from our Arcus middleware as well. |
Just additional information: |
That's an interesting idea. If we could have something that does this for us. Previously, Microsoft was using activities to do this. And each dependency was starting an activity which was tracked. |
A quick view showed that there's an observer looking for general diagnostic events, and if the events matches a given SQL name, then it is considered from the SQL client. Maybe we can define our own observer and use our own logging system. |
That's true, but having this out of the box is really very valuable: you don't have to do it yourself, and you already have a ton of information out of the box. |
We can, but I believe that will be a lot of work, no ? |
Yeah, that would be nice, the problem is that we handle correlation differently. We use user-defined correlation accessors so that people are able to extend on the correlation and use the correlation outside Microsoft-specific dependencies. The problem is that all Microsoft dependencies are using Activities instead of dependency injection to handle correlation. |
I think this can be closed ? |
It should be okay now, indeed. This also includes Messaging, but that is not yet released, though. |
Ok, now we can close this! 😄 |
Is your feature request related to a problem? Please describe.
When creating an API that uses Arcus.Observability for logging to Application Insights, dependencies to SQL Server are not automatically tracked.
However, when I would use the default ApplicationInsights integration that is provided by Microsoft, calls to SQL Server are automatically tracked in AppInsights:
In the above screenshot, I've configured Arcus.Observability logging and I've also made sure that I've added MS Application Insights middleware by calling
builder.Services.AddApplicationInsightsTelemetry()
.As you can see, the dependency to SQL Server is tracked and the request is tracked twice (once by Arcus, once by Microsoft).
However, If I remove the
AddApplicationInsightsTelemetry
method call, then the dependency to SQL server is no longer logged.How come this is not logged anymore ? My guess would be that the dependency is logged by the Microsoft.Data.SqlClient package, and not by the MSFT Application Insights middleware itself. However, there must be something that happens inside that middleware that makes it possible.
Describe the solution you'd like
When using Arcus Observability for logging, dependencies to other systems should also be automatically tracked, just like it is done out-of-the-box.
The text was updated successfully, but these errors were encountered: