Skip to content

Commit

Permalink
Make UseApplicationInsights more explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
robinmanuelthiel committed Dec 10, 2023
1 parent ce73a2e commit 18cb840
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Wemogy.Core/Monitoring/MonitoringEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -64,6 +64,7 @@ public MonitoringEnvironment WithApplicationInsights(string connectionString, fl

ApplicationInsightsConnectionString = connectionString;
ApplicationInsightsSamplingRatio = samplingRatio;
UseApplicationInsights = true;
return this;
}

Expand All @@ -79,6 +80,11 @@ public MonitoringEnvironment WithOptionalApplicationInsights(string? connectionS
{
ApplicationInsightsConnectionString = connectionString;

Check failure on line 81 in src/Wemogy.Core/Monitoring/MonitoringEnvironment.cs

View workflow job for this annotation

GitHub Actions / Build Library

Possible null reference assignment.

Check failure on line 81 in src/Wemogy.Core/Monitoring/MonitoringEnvironment.cs

View workflow job for this annotation

GitHub Actions / Build Library

Possible null reference assignment.

Check failure on line 81 in src/Wemogy.Core/Monitoring/MonitoringEnvironment.cs

View workflow job for this annotation

GitHub Actions / Tests

Possible null reference assignment.

Check failure on line 81 in src/Wemogy.Core/Monitoring/MonitoringEnvironment.cs

View workflow job for this annotation

GitHub Actions / Tests

Possible null reference assignment.
ApplicationInsightsSamplingRatio = samplingRatio;
UseApplicationInsights = true;
}
else
{
UseApplicationInsights = false;
}

return this;
Expand Down

0 comments on commit 18cb840

Please sign in to comment.