diff --git a/src/Wemogy.Core/Monitoring/MonitoringEnvironment.cs b/src/Wemogy.Core/Monitoring/MonitoringEnvironment.cs index 4ac1a9d..5a2e3e1 100644 --- a/src/Wemogy.Core/Monitoring/MonitoringEnvironment.cs +++ b/src/Wemogy.Core/Monitoring/MonitoringEnvironment.cs @@ -12,7 +12,7 @@ public class MonitoringEnvironment public string ServiceVersion { get; } public string ApplicationInsightsConnectionString { get; private set; } public float ApplicationInsightsSamplingRatio { get; private set; } - public bool UseApplicationInsights => !string.IsNullOrEmpty(ApplicationInsightsConnectionString); + public bool UseApplicationInsights { get; private set; } public Uri? OtlpExportEndpoint { get; private set; } public bool UseOtlpExporter => OtlpExportEndpoint != null; public bool UsePrometheus { get; private set; } @@ -64,6 +64,7 @@ public MonitoringEnvironment WithApplicationInsights(string connectionString, fl ApplicationInsightsConnectionString = connectionString; ApplicationInsightsSamplingRatio = samplingRatio; + UseApplicationInsights = true; return this; } @@ -79,6 +80,11 @@ public MonitoringEnvironment WithOptionalApplicationInsights(string? connectionS { ApplicationInsightsConnectionString = connectionString; ApplicationInsightsSamplingRatio = samplingRatio; + UseApplicationInsights = true; + } + else + { + UseApplicationInsights = false; } return this;