-
Notifications
You must be signed in to change notification settings - Fork 797
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove instrumentationKey from Application Insights publisher
- Loading branch information
Showing
5 changed files
with
39 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...hecks.Publisher.ApplicationInsights.Tests/Functional/ApplicationInsightsPublisherTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Microsoft.ApplicationInsights.Extensibility; | ||
using NSubstitute; | ||
|
||
namespace HealthChecks.Publisher.ApplicationInsights.Tests.Functional; | ||
|
||
public class application_insights_publisher_should | ||
{ | ||
[Fact] | ||
public void throw_when_neither_connection_string_nor_telemetry_configuration_provided() | ||
{ | ||
var options = Substitute.For<IOptions<TelemetryConfiguration>>(); | ||
var publisher = new ApplicationInsightsPublisher(options, connectionString: null); | ||
var report = new HealthReport(new Dictionary<string, HealthReportEntry>(), TimeSpan.Zero); | ||
|
||
var publish = () => publisher.PublishAsync(report, default); | ||
|
||
publish.ShouldThrow<ArgumentException>(); | ||
} | ||
} |
10 changes: 9 additions & 1 deletion
10
...blisher.ApplicationInsights.Tests/HealthChecks.Publisher.ApplicationInsights.approved.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
namespace HealthChecks.Publisher.ApplicationInsights | ||
{ | ||
public class ApplicationInsightsPublisher : Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheckPublisher | ||
{ | ||
public ApplicationInsightsPublisher(Microsoft.Extensions.Options.IOptions<Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration>? telemetryConfiguration, string? connectionString = null, bool saveDetailedReport = false, bool excludeHealthyReports = false) { } | ||
public System.Threading.Tasks.Task PublishAsync(Microsoft.Extensions.Diagnostics.HealthChecks.HealthReport report, System.Threading.CancellationToken cancellationToken) { } | ||
} | ||
} | ||
namespace Microsoft.Extensions.DependencyInjection | ||
{ | ||
public static class ApplicationInsightsHealthCheckBuilderExtensions | ||
{ | ||
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddApplicationInsightsPublisher(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string? connectionString = null, string? instrumentationKey = null, bool saveDetailedReport = false, bool excludeHealthyReports = false) { } | ||
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddApplicationInsightsPublisher(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string? connectionString = null, bool saveDetailedReport = false, bool excludeHealthyReports = false) { } | ||
} | ||
} |