Код: Выделить всё
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System.Net;
using System.IO;
using OpenTelemetry.Metrics;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
namespace MyNamespace;
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args)
{
var builder = WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((hostingContext, config) => { ... }
.ConfigureServices((context, services) =>
{
services.AddOpenTelemetry()
.ConfigureResource(resource => resource
.AddService(serviceName: context.HostingEnvironment.ApplicationName))
.WithMetrics(metrics =>
{
metrics.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddSqlClientInstrumentation()
.AddPrometheusExporter();
})
.WithTracing(tracing =>
{
tracing.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation(config =>
{
config.FilterHttpRequestMessage = (httpRequestMessage) =>
{
// Filter out health check requests and other non-business requests
var path = httpRequestMessage.RequestUri?.AbsolutePath;
return !string.IsNullOrEmpty(path) &&
!path.StartsWith("/health") &&
!path.StartsWith("/metrics") &&
!path.StartsWith("/favicon.ico");
};
})
.AddOtlpExporter();
});
})
.UseStartup()
.UseKestrel();
return builder;
}
}
Я использую все-в-один-Jaeger без какой-либо дополнительной конфигурации. Трафик экспортируется через GRPC на порту 4317 и может быть запрошен в Jaeger:
есть все, что есть, как это, то есть, что это за то, что они были обнаружены? Они не служат мне никакой ценности, а вместо этого загромождают пользовательский интерфейс, а также сжигают мое хранилище.
Подробнее здесь: https://stackoverflow.com/questions/797 ... ntelemetry
Мобильная версия