Skip to content

Commit

Permalink
Merge pull request #89 from wemogy/main
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
robinmanuelthiel authored Nov 27, 2023
2 parents 442d6f8 + 5fa4b05 commit 1d9f5e9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Wemogy.Core/Monitoring/MonitoringEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class MonitoringEnvironment
public bool UseOtlpExporter => OtlpExportEndpoint != null;
public bool UsePrometheus { get; private set; }
public HashSet<string> MeterNames { get; private set; }
public HashSet<string> ActivitySourceNames { get; private set; }

public MonitoringEnvironment()
{
Expand All @@ -29,6 +30,7 @@ public MonitoringEnvironment()
UsePrometheus = false;
OtlpExportEndpoint = null;
MeterNames = new HashSet<string>();
ActivitySourceNames = new HashSet<string>();
}

public MonitoringEnvironment(string serviceName, string serviceVersion)
Expand Down Expand Up @@ -79,5 +81,15 @@ public MonitoringEnvironment WithMeter(string meterName)
MeterNames.Add(meterName);
return this;
}

/// <summary>
/// Registers a System.Diagnostics.ActivitySource at the environment. The activity source itself has to be created outside the environment.
/// </summary>
/// <param name="activitySourceName">Name of the activity source</param>
public MonitoringEnvironment WithActivitySource(string activitySourceName)
{
ActivitySourceNames.Add(activitySourceName);
return this;
}
}
}

0 comments on commit 1d9f5e9

Please sign in to comment.