Nit internal fixes for PrometheusExporter (#3525)
This commit is contained in:
parent
fc315f3f7e
commit
c1df3a7577
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace OpenTelemetry.Exporter.Prometheus
|
|||
|
||||
this.exporter = exporter;
|
||||
|
||||
string path = this.exporter.ScrapeEndpointPath;
|
||||
string path = options.ScrapeEndpointPath;
|
||||
|
||||
if (!path.StartsWith("/"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue