27 lines
629 B
C#
27 lines
629 B
C#
namespace VECV_WebApi.Controllers.Metrics
|
|
{
|
|
using System.IO;
|
|
using System.Net.Http;
|
|
using System.Net.Http.Headers;
|
|
using System.Web.Http;
|
|
using Prometheus;
|
|
|
|
public class MetricsController : ApiController
|
|
{
|
|
[HttpGet]
|
|
public HttpResponseMessage Index()
|
|
{
|
|
var stream = new MemoryStream();
|
|
Metrics.DefaultRegistry.CollectAndExportAsTextAsync(stream).Wait();
|
|
stream.Position = 0;
|
|
|
|
return new HttpResponseMessage
|
|
{
|
|
Content = new StreamContent(stream)
|
|
{
|
|
Headers = { ContentType = new MediaTypeHeaderValue("text/plain") }
|
|
}
|
|
};
|
|
}
|
|
}
|
|
} |