NLog ApplicationInsightsTarget with support for IncludeMldc
Add support for NLog Mapped Diagnostic Logical Context (MDLC)
Changes
- Updated to NLog 4.7.15 with support for writing into existing property-bag.
- Inheriting from TargetWithContext
Checklist
- [ ] I ran Unit Tests locally.
- [ ] CHANGELOG.md updated with one line description of the fix, and a link to the original issue if available.
For significant contributions please make sure you have completed the following items:
- [ ] Design discussion issue #
- [ ] Changes in public surface reviewed
The PR will trigger build, unit tests, and functional tests automatically. Please follow these instructions to build and test locally.
Notes for authors:
- FxCop and other analyzers will fail the build. To see these errors yourself, compile localy using the Release configuration.
Notes for reviewers:
- We support comment build triggers
-
/AzurePipelines runwill queue all builds -
/AzurePipelines run <pipeline-name>will queue a specific build
-
@TimothyMothra why has this never get merged? Or has received any feedback?
Should I interpret the staleness of this PR to mean that there is a very low likelihood of https://github.com/microsoft/ApplicationInsights-dotnet/issues/2785 being resolved?
I'm guessing Microsoft wanted to invite existing NLog users to try the fruits of ApplicationInsights, which give birth to this NLog Target.
Microsoft is probably putting most of their energy into their pure Microsoft Extension Logging integration with ApplicationInsights, and not any hybrid modes.
Microsoft probably believes that one would not use NLog, after having started using Microsoft Extensions Logging.
Maybe we should fork this repo and release it as a NLog package. Not perfect, but I dont like getting ghosted.
Maybe we should fork this repo and release it as a NLog package. Not perfect, but I dont like getting ghosted.
Would prefer if someone with extensive knowledge about ApplicationInsights (along with its telemetry capture) took up the challenge. Since right now this NLog-target package cannot stand on its own (doesn't capture/forward all application-performance keyfigures).
From what I could see, I suspect maybe the App Insights team has been focused on other platforms (e.g. Python, etc.) for a little while, plus MS has been dedicating resources to integrating OpenTelemetry (which is a less proprietary design for similar functionality) to both .NET and App Insights so I'm hopeful it has just been a matter of lacking resources to dedicate to this side for now, though it does seem this has been here quite a while. I've also recently learned that .NET 8 is introducing a new Microsoft.Extensions.Telemetry set of abstractions so maybe there are some major refactorings coming? Not sure what to expect, just yet, as there's no documentation or road map about this very recent announcement and I haven't read the source yet.
Either way, without knowing what implementation we could possibly pursue with those things yet, we find ourselves missing needed functionality to properly implement App Insights at the immediate moment, since all of our logging goes through NLog and we don't have a current enough bridge to bring our traces and exceptions from there into App Insights.
See also: direction is to use OpenTelemetry
The overview linked there has the following excerpt which makes me wonder where we should be focusing our effort for the next release:
While we see OpenTelemetry as our future direction, we have no plans to stop collecting data from older SDKs. We still have a way to go before our Azure OpenTelemetry Distros reach feature parity with our Application Insights SDKs. In many cases, customers will continue to choose to use Application Insights SDKs for quite some time.