From 91691e0862a5b03e1d78f2fb13dce1750cf21587 Mon Sep 17 00:00:00 2001 From: Steven He Date: Mon, 8 Apr 2024 14:12:48 +0900 Subject: [PATCH] feat: adding more instruments --- src/Directory.Packages.props | 12 ++++++++---- src/GZCTF/Extensions/TelemetryExtension.cs | 15 ++++++++++++++- src/GZCTF/GZCTF.csproj | 6 +++++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 148a4ea7e..d7071a39f 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -22,7 +22,11 @@ + + + + @@ -45,9 +49,9 @@ - - - - + + + + \ No newline at end of file diff --git a/src/GZCTF/Extensions/TelemetryExtension.cs b/src/GZCTF/Extensions/TelemetryExtension.cs index 1130e983f..c9039adca 100644 --- a/src/GZCTF/Extensions/TelemetryExtension.cs +++ b/src/GZCTF/Extensions/TelemetryExtension.cs @@ -22,9 +22,20 @@ public static void AddTelemetry(this IServiceCollection services, TelemetryConfi { metrics.AddAspNetCoreInstrumentation(); metrics.AddHttpClientInstrumentation(); + metrics.AddRuntimeInstrumentation(); + metrics.AddProcessInstrumentation(); + if (config.Prometheus.Enable) { - metrics.AddPrometheusExporter(); + metrics.AddPrometheusExporter(options => + { + options.DisableTotalNameSuffixForCounters = true; + }); + } + + if (config.Console.Enable) + { + metrics.AddConsoleExporter(); } }); @@ -32,6 +43,8 @@ public static void AddTelemetry(this IServiceCollection services, TelemetryConfi { tracing.AddAspNetCoreInstrumentation(); tracing.AddHttpClientInstrumentation(); + tracing.AddEntityFrameworkCoreInstrumentation(); + tracing.AddRedisInstrumentation(); tracing.AddNpgsql(); if (config.Console.Enable) { diff --git a/src/GZCTF/GZCTF.csproj b/src/GZCTF/GZCTF.csproj index c44f0f235..3e71d2b78 100644 --- a/src/GZCTF/GZCTF.csproj +++ b/src/GZCTF/GZCTF.csproj @@ -1,4 +1,4 @@ - + net8.0 @@ -52,7 +52,11 @@ + + + +