From bb0657292894925502a0f690744c4ab06c480fa4 Mon Sep 17 00:00:00 2001 From: Reiley Yang Date: Tue, 2 Aug 2022 16:16:21 -0700 Subject: [PATCH] Minor improvements to Prometheus Exporter (ASP.NET Core) --- .../PrometheusExporterOptions.cs | 4 ++-- .../README.md | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/PrometheusExporterOptions.cs b/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/PrometheusExporterOptions.cs index bf7576117b1..248b991f4c5 100644 --- a/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/PrometheusExporterOptions.cs +++ b/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/PrometheusExporterOptions.cs @@ -25,7 +25,7 @@ public class PrometheusExporterOptions { internal const string DefaultScrapeEndpointPath = "/metrics"; - private int scrapeResponseCacheDurationMilliseconds = 10 * 1000; + private int scrapeResponseCacheDurationMilliseconds = 300; /// /// Gets or sets the path to use for the scraping endpoint. Default value: "/metrics". @@ -33,7 +33,7 @@ public class PrometheusExporterOptions public string ScrapeEndpointPath { get; set; } = DefaultScrapeEndpointPath; /// - /// Gets or sets the cache duration in milliseconds for scrape responses. Default value: 10,000 (10 seconds). + /// Gets or sets the cache duration in milliseconds for scrape responses. Default value: 300. /// /// /// Note: Specify 0 to disable response caching. diff --git a/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/README.md b/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/README.md index 855c20637a6..d9cb8bfdc1a 100644 --- a/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/README.md +++ b/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/README.md @@ -15,15 +15,15 @@ to scrape. ### Step 1: Install Package -Install - ```shell dotnet add package OpenTelemetry.Exporter.Prometheus.AspNetCore ``` ### Step 2: Configure OpenTelemetry MeterProvider -* When using OpenTelemetry.Extensions.Hosting package on .NET Core 3.1+: +* When using + [OpenTelemetry.Extensions.Hosting](../OpenTelemetry.Extensions.Hosting/README.md) + package on .NET Core 3.1+: ```csharp services.AddOpenTelemetryMetrics(builder => @@ -34,7 +34,7 @@ dotnet add package OpenTelemetry.Exporter.Prometheus.AspNetCore * Or configure directly: - Call the `AddPrometheusExporter` `MeterProviderBuilder` extension to + Call the `MeterProviderBuilder.AddPrometheusExporter` extension to register the Prometheus exporter. ```csharp @@ -94,8 +94,7 @@ registered by Configures scrape endpoint response caching. Multiple scrape requests within the cache duration time period will receive the same previously generated response. -The default value is `10000` (10 seconds). Set to `0` to disable response -caching. +The default value is `300`. Set to `0` to disable response caching. ## Troubleshooting