You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My problem is that I'd like to be able to have prometheus scrape metrics from an HTTP endpoint on my functions project. The current middleware won't work for this since that's very server orientated. I imagine I will need to add a HTTP function endpoint to my functions project and write the metrics in. However, because so many of the classes are internal, this isn't possible.
Describe the solution you'd like:
I think this could be solve by either making the classes public (which I appreciate you might not want to do!) or by making an extension method of some form which operates on the HttpRequestData. Something a bit like this though can probably use dependency injection much better than passing all services.
public class Metrics
{
private readonly IServiceProvider _serviceProvider;
public Metrics(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
[Function("/metrics")]
public HttpResponseData Run([HttpTrigger(AuthorizationLevel.Function, "get")] HttpRequestData req,
FunctionContext executionContext)
{
return req.WritePrometheusMetrics(_serviceProvider);
}
}
Describe alternatives you've considered.
I could currently use reflection to hack around this? Not sure if anything else I could do.
Additional Context
Happy to have a go at implementing this myself if the general functionality request is okay.
The text was updated successfully, but these errors were encountered:
Hi @lbargery, we are actively working on a feature to enable OpenTelemetry support, ETA April/May. Here's our Azure/azure-functions-host#9273.
I would also like to understand your scenario better, are you looking to export ASP.NetCore metrics or your own custom metrics? Please transfer this issue over to the azure-functions-host repo.
Feature Request
Is your feature request related to a problem?
My problem is that I'd like to be able to have prometheus scrape metrics from an HTTP endpoint on my functions project. The current middleware won't work for this since that's very server orientated. I imagine I will need to add a HTTP function endpoint to my functions project and write the metrics in. However, because so many of the classes are internal, this isn't possible.
Describe the solution you'd like:
I think this could be solve by either making the classes public (which I appreciate you might not want to do!) or by making an extension method of some form which operates on the HttpRequestData. Something a bit like this though can probably use dependency injection much better than passing all services.
Describe alternatives you've considered.
I could currently use reflection to hack around this? Not sure if anything else I could do.
Additional Context
Happy to have a go at implementing this myself if the general functionality request is okay.
The text was updated successfully, but these errors were encountered: