Skip to content

Commit

Permalink
Minor improvements to Prometheus Exporter (ASP.NET Core) (#3522)
Browse files Browse the repository at this point in the history
  • Loading branch information
reyang authored Aug 3, 2022
1 parent 27658f0 commit 2821898
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
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

0 comments on commit 2821898

Please sign in to comment.