mirror of
https://github.com/ckaczor/Common.OpenTelemetry.git
synced 2026-01-14 01:25:42 -05:00
Allow for no activity source name
This commit is contained in:
@@ -13,6 +13,12 @@ namespace ChrisKaczor.Common.OpenTelemetry;
|
|||||||
|
|
||||||
public static class ServiceExtensions
|
public static class ServiceExtensions
|
||||||
{
|
{
|
||||||
|
[PublicAPI]
|
||||||
|
public static void AddCommonOpenTelemetry(this IServiceCollection serviceCollection, string serviceName, string telemetryEndpoint)
|
||||||
|
{
|
||||||
|
serviceCollection.AddCommonOpenTelemetry(serviceName, telemetryEndpoint, (IEnumerable<string>) null);
|
||||||
|
}
|
||||||
|
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public static void AddCommonOpenTelemetry(this IServiceCollection serviceCollection, string serviceName, string telemetryEndpoint, string activitySourceName)
|
public static void AddCommonOpenTelemetry(this IServiceCollection serviceCollection, string serviceName, string telemetryEndpoint, string activitySourceName)
|
||||||
{
|
{
|
||||||
@@ -50,9 +56,12 @@ public static class ServiceExtensions
|
|||||||
o.SetDbStatementForText = true;
|
o.SetDbStatementForText = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (var activitySourceName in activitySourceNames)
|
if (activitySourceNames != null)
|
||||||
{
|
{
|
||||||
tracerProviderBuilder.AddSource(activitySourceName);
|
foreach (var activitySourceName in activitySourceNames)
|
||||||
|
{
|
||||||
|
tracerProviderBuilder.AddSource(activitySourceName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tracerProviderBuilder.SetErrorStatusOnException();
|
tracerProviderBuilder.SetErrorStatusOnException();
|
||||||
|
|||||||
Reference in New Issue
Block a user