public PrometheusExporterHostedService()

in src/App/Services/Hosted/PrometheusExporterHostedService.cs [37:74]


        public PrometheusExporterHostedService(
            IEnumerable<IExporter> exporters,
            IOptions<PrometheusExporterConfiguration> configuration,
            ILogger<PrometheusExporterHostedService> logger)
        {
            _exporters = exporters;
            _configuration = configuration.Value;
            _logger = logger;
            _metricServer = new MetricServer(_configuration.Port);

            // Init metrics
            TotalScrapeActivations = Metrics.CreateCounter(
                "total_activations",
                "Total activations of the exporter",
                new CounterConfiguration() { SuppressInitialValue = true });
            TotalSuccessfulScrapeActivations = Metrics.CreateCounter(
                "total_success_activations",
                "Total successful activation of the exporter",
                new CounterConfiguration() { SuppressInitialValue = true });
            IsSuccessful = Metrics.CreateGauge(
                "is_successful_scrape",
                "Indication to if the last scrape was successful",
                new GaugeConfiguration() { SuppressInitialValue = true });
            ScrapeTime = Metrics.CreateSummary(
                "scrape_time",
                "Total scraping time of the exporter",
                new SummaryConfiguration()
                {
                    SuppressInitialValue = true,
                    Objectives = new[]
                    {
                        new QuantileEpsilonPair(0.5, 0.05),
                        new QuantileEpsilonPair(0.9, 0.05),
                        new QuantileEpsilonPair(0.95, 0.01),
                        new QuantileEpsilonPair(0.99, 0.01),
                    },
                });
        }