Exemplo n.º 1
0
        public async Task GetMetricsAsync()
        {
            var           r = Metric.NewCustomRegistry();
            MetricFactory f = Metric.WithCustomRegistry(r);

            r.AddBeforeCollectCallback(() =>
            {
                f.CreateCounter("counter_v1", "").Inc(100);
            });
            Response.ContentType = PrometheusConstants.ExporterContentType;
            Response.StatusCode  = 200;
            await r.CollectAndExportAsTextAsync(Response.Body, HttpContext.RequestAborted);
        }