Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor improvements to Prometheus Exporter (ASP.NET Core) #3522

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ public class PrometheusExporterOptions
{
internal const string DefaultScrapeEndpointPath = "/metrics";

private int scrapeResponseCacheDurationMilliseconds = 10 * 1000;
private int scrapeResponseCacheDurationMilliseconds = 300;

/// <summary>
/// Gets or sets the path to use for the scraping endpoint. Default value: "/metrics".
/// </summary>
public string ScrapeEndpointPath { get; set; } = DefaultScrapeEndpointPath;

/// <summary>
/// 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.
/// </summary>
/// <remarks>
/// Note: Specify 0 to disable response caching.
Expand Down
11 changes: 5 additions & 6 deletions src/OpenTelemetry.Exporter.Prometheus.AspNetCore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down