Nit internal fixes for PrometheusExporter (#3525)

This commit is contained in:
Cijo Thomas 2022-08-03 10:16:31 -07:00 committed by GitHub
parent fc315f3f7e
commit c1df3a7577
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 8 deletions

View File

@ -50,7 +50,7 @@ namespace OpenTelemetry.Metrics
{
configure?.Invoke(options);
var exporter = new PrometheusExporter(scrapeEndpointPath: options.ScrapeEndpointPath, scrapeResponseCacheDurationMilliseconds: options.ScrapeResponseCacheDurationMilliseconds);
var exporter = new PrometheusExporter(scrapeResponseCacheDurationMilliseconds: options.ScrapeResponseCacheDurationMilliseconds);
var reader = new BaseExportingMetricReader(exporter)
{
TemporalityPreference = MetricReaderTemporalityPreference.Cumulative,

View File

@ -33,15 +33,13 @@ namespace OpenTelemetry.Exporter.Prometheus
/// <summary>
/// Initializes a new instance of the <see cref="PrometheusExporter"/> class.
/// </summary>
/// <param name="scrapeEndpointPath">Scraping endpoint.</param>
/// <param name="scrapeResponseCacheDurationMilliseconds">
/// The cache duration in milliseconds for scrape responses. Default value: 0.
/// </param>
public PrometheusExporter(string scrapeEndpointPath = null, int scrapeResponseCacheDurationMilliseconds = 0)
public PrometheusExporter(int scrapeResponseCacheDurationMilliseconds = 0)
{
Guard.ThrowIfOutOfRange(scrapeResponseCacheDurationMilliseconds, min: 0);
this.ScrapeEndpointPath = scrapeEndpointPath ?? "/metrics";
this.ScrapeResponseCacheDurationMilliseconds = scrapeResponseCacheDurationMilliseconds;
this.CollectionManager = new PrometheusCollectionManager(this);
}
@ -67,8 +65,6 @@ namespace OpenTelemetry.Exporter.Prometheus
internal int ScrapeResponseCacheDurationMilliseconds { get; }
internal string ScrapeEndpointPath { get; }
/// <inheritdoc/>
public override ExportResult Export(in Batch<Metric> metrics)
{

View File

@ -43,7 +43,7 @@ namespace OpenTelemetry.Exporter.Prometheus
this.exporter = exporter;
string path = this.exporter.ScrapeEndpointPath;
string path = options.ScrapeEndpointPath;
if (!path.StartsWith("/"))
{

View File

@ -55,7 +55,7 @@ namespace OpenTelemetry.Metrics
{
configure?.Invoke(options);
var exporter = new PrometheusExporter(scrapeEndpointPath: options.ScrapeEndpointPath);
var exporter = new PrometheusExporter();
var reader = new BaseExportingMetricReader(exporter)
{