File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
src/Prometheus.Client.AspNetCore Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -41,12 +41,18 @@ public static IApplicationBuilder UsePrometheusServer(this IApplicationBuilder a
4141 if ( options . UseDefaultCollectors )
4242 options . CollectorRegistryInstance . UseDefaultCollectors ( ) ;
4343
44+ var contentType = "text/plain; version=0.0.4" ;
45+
46+ if ( options . ResponseEncoding != null )
47+ contentType += $ "; charset={ options . ResponseEncoding . BodyName } ";
48+
4449 void AddMetricsHandler ( IApplicationBuilder coreapp )
4550 {
4651 coreapp . Run ( async context =>
4752 {
4853 var response = context . Response ;
49- response . ContentType = "text/plain; version=0.0.4" ;
54+
55+ response . ContentType = contentType ;
5056
5157 using var outputStream = response . Body ;
5258 await ScrapeHandler . ProcessAsync ( options . CollectorRegistryInstance , outputStream ) ;
Original file line number Diff line number Diff line change 1+ using System . Text ;
12using Prometheus . Client . Collectors ;
23
34namespace Prometheus . Client . AspNetCore
@@ -26,5 +27,10 @@ public class PrometheusOptions
2627 /// Use default collectors
2728 /// </summary>
2829 public bool UseDefaultCollectors { get ; set ; } = true ;
30+
31+ /// <summary>
32+ /// Charset of text response.
33+ /// </summary>
34+ public Encoding ResponseEncoding { get ; set ; }
2935 }
3036}
You can’t perform that action at this time.
0 commit comments