nexogen-international / Nexogen.Libraries.Metrics

Library for collecting application metrics in .NET and exporting them to Prometheus
MIT License
61 stars 9 forks source link

Attaching `instance` to PushGateway payload #6

Closed endofcake closed 6 years ago

endofcake commented 6 years ago

Hello. Great library, by the way, thanks for publishing it. I'm trying to start using PushGateway functionality for our metrics, and at the moment it doesn't look like it's possible to identify where a given metric is coming from.

Here's how the path is configured:

var path = String.Format("/metrics/job/{0}", WebUtility.UrlEncode(job));

https://github.com/nexogen-international/Nexogen.Libraries.Metrics/blob/master/Nexogen.Libraries.Metrics.Prometheus.PushGateway/PushGateway.cs#L115

My understanding is that if it were in the form

var path = String.Format("/metrics/job/{0}/instance/{1}", WebUtility.UrlEncode(job), WebUtility.UrlEncode(instance));

it would be possible to identify the instance where the metric is coming from.

I see there's a way to set custom metrics, but having an option to set instance would still be handy.

farkasmark commented 6 years ago

Hi @endofcake! Thanks for sharing us your valuable remarks, at first glance it makes sense! We can start investigating and working on this issue on Monday.