Skip to content

Commit e15a517

Browse files
committed
Fixed suggestions in apm metrics
1 parent 19af1d6 commit e15a517

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

src/Exceptionless.Web/ApmExtensions.cs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ public static IHostBuilder AddApm(this IHostBuilder builder, ApmConfig config)
6666
}
6767

6868
// 404s should not be error
69-
int? httpStatus = activity.GetTagItem("http.status_code") as int?;
70-
if (httpStatus.HasValue && httpStatus.Value == 404)
69+
if (activity.GetTagItem("http.status_code") is 404)
7170
activity.SetStatus(Status.Unset);
7271
};
7372
});
@@ -197,10 +196,10 @@ public static TracerProviderBuilder AddFilteredOtlpExporter(this TracerProviderB
197196

198197
if (builder is IDeferredTracerProviderBuilder deferredTracerProviderBuilder)
199198
{
200-
return deferredTracerProviderBuilder.Configure((sp, builder) =>
199+
return deferredTracerProviderBuilder.Configure((sp, providerBuilder) =>
201200
{
202201
var oltpOptions = sp.GetService<IOptions<FilteredOtlpExporterOptions>>()?.Value ?? new FilteredOtlpExporterOptions();
203-
AddFilteredOtlpExporter(builder, oltpOptions, configure, sp);
202+
AddFilteredOtlpExporter(providerBuilder, oltpOptions, configure, sp);
204203
});
205204
}
206205

@@ -228,17 +227,14 @@ internal static TracerProviderBuilder AddFilteredOtlpExporter(
228227
{
229228
return builder.AddProcessor(new CustomFilterProcessor(new SimpleActivityExportProcessor(otlpExporter), exporterOptions.Filter));
230229
}
231-
else
232-
{
233-
var batchOptions = exporterOptions.BatchExportProcessorOptions ?? new();
234-
235-
return builder.AddProcessor(new CustomFilterProcessor(new BatchActivityExportProcessor(
236-
otlpExporter,
237-
batchOptions.MaxQueueSize,
238-
batchOptions.ScheduledDelayMilliseconds,
239-
batchOptions.ExporterTimeoutMilliseconds,
240-
batchOptions.MaxExportBatchSize), exporterOptions.Filter));
241-
}
230+
231+
var batchOptions = exporterOptions.BatchExportProcessorOptions ?? new();
232+
return builder.AddProcessor(new CustomFilterProcessor(new BatchActivityExportProcessor(
233+
otlpExporter,
234+
batchOptions.MaxQueueSize,
235+
batchOptions.ScheduledDelayMilliseconds,
236+
batchOptions.ExporterTimeoutMilliseconds,
237+
batchOptions.MaxExportBatchSize), exporterOptions.Filter));
242238
}
243239

244240
public static void TryEnableIHttpClientFactoryIntegration(this OtlpExporterOptions options, IServiceProvider? serviceProvider, string httpClientName)

0 commit comments

Comments
 (0)