ApplicationInsights-dotnet icon indicating copy to clipboard operation
ApplicationInsights-dotnet copied to clipboard

Add support for connection string to Microsoft.ApplicationInsights.NLogTarget

Open saidi-adot opened this issue 2 years ago • 10 comments

Add support for connection string to Microsoft.ApplicationInsights.NLogTarget https://github.com/microsoft/ApplicationInsights-dotnet/issues/2714

Fix Issue # .

Changes

(Please provide a brief description of the changes here.)

Checklist

  • [x] I ran Unit Tests locally.
  • [x] 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:

  • [x] Design discussion issue #
  • [x] 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 run will queue all builds
  • /AzurePipelines run will queue a specific build

saidi-adot avatar Mar 19 '24 20:03 saidi-adot

@TimothyMothra @cijothomas - Can you please review the PR

saidi-adot avatar Mar 20 '24 18:03 saidi-adot

https://github.com/microsoft/ApplicationInsights-dotnet/pull/2750#issuecomment-1771068342

cijothomas avatar Mar 27 '24 17:03 cijothomas

#2750 (comment)

@rajkumar-rangaraj and @TimothyMothra - Can you please let us know your thoughts on this.

saidi-adot avatar Mar 27 '24 17:03 saidi-adot

@cijothomas If NLog-target changes from using obsolete/legacy TelemetryClient (depending on on TelemtryConfiguration.Active), to instead create its own local TelemetryClient using connectionString. Would you accept the pull-request ?

snakefoot avatar May 09 '24 06:05 snakefoot

@cijothomas Polite poke. If NLog-target changes from using obsolete/legacy TelemetryClient (depending on on TelemtryConfiguration.Active), to instead create its own local TelemetryClient using connectionString. Would you accept the pull-request ?

snakefoot avatar May 22 '24 17:05 snakefoot

@cijothomas Polite poke. If NLog-target changes from using obsolete/legacy TelemetryClient (depending on on TelemtryConfiguration.Active), to instead create its own local TelemetryClient using connectionString. Would you accept the pull-request ?

I'll let @rajkumar-rangaraj @TimothyMothra to comment on if this repo plan to accept new features, given the OTel movement.

From a technical standpoint, creating own TelemetryClient would mean it'll have a config, different from the rest of the application, right?

cijothomas avatar May 22 '24 17:05 cijothomas

@cijothomas From a technical standpoint, creating own TelemetryClient would mean it'll have a config, different from the rest of the application, right?

Yes like this:

                var telemetryConfiguration = TelemetryConfiguration.CreateDefault();
                telemetryConfiguration.ConnectionString = connectionString;
                this.telemetryClient = new TelemetryClient(telemetryConfiguration);

Thus not depend on deprecated TelemtryConfiguration.Active, that requires one to explicit configure EnableActiveTelemetryConfigurationSetup to make the NLog-target work. Giving a better user-experience.

snakefoot avatar May 22 '24 18:05 snakefoot

@cijothomas + @rajkumar-rangaraj + @TimothyMothra Are you willing to accept pull-request that allows NLog to use ConnectionString and no longer use the now deprecated TelemtryConfiguration.Active ?

This will give a better user-experience, as people doesn't have to explicit set EnableActiveTelemetryConfigurationSetup

snakefoot avatar Jun 04 '24 17:06 snakefoot

@cijothomas + @rajkumar-rangaraj + @TimothyMothra Please accept this Pull Request.

Azure is ending support for InstrumentationKey in March 2025 forcing everyone to switch to ConnectionString. We really like using NLog and it huge be a huge effort for us to switch off of NLog. We cannot be losing application logs, we need to be able to continue to support our applications.

ahanneman-adot avatar Aug 01 '24 18:08 ahanneman-adot

Created fork #2897 that changes to use isolated TelemetryClient when using ConnectionString.

snakefoot avatar Aug 13 '24 19:08 snakefoot