OpenLiberty / open-liberty

Open Liberty is a highly composable, fast to start, dynamic application server runtime environment
https://openliberty.io
Eclipse Public License 2.0
1.16k stars 597 forks source link

mpMetrics - /metrics - customizable endpoint #20258

Open krismarc opened 2 years ago

krismarc commented 2 years ago

Dear community/Open Liberty developers,

I was told to open a feature request for this issue: https://github.com/OpenLiberty/open-liberty/issues/20227

We would like to have an option to set customized endpoint's path for the metrics feature. The name may remain the same. Would be nice to have it somehow aligned with the application context root.

We are hosting most of our Liberties (WLPs and OLs - over 4k) inside Cloud Foundry deployment and there's a gateway in front of it. So there are applications which are sharing the hostname part of their urls, however, those are not located on the same machine.

eg. applications.domain.com/app1 <- 1st container inside the Cloud Foundry applications.domain.com/app2 <- 2nd container inside the Cloud Foundy

F5 acts as the gateway and any calls are forwarded to Cloud Foundry internal routing solution. In this case we can't reach any of those applications metrics as applications.domain.com/metrics is not available/exposed by F5 and even if so we could not share it for both of apps.

Therefore our question is if there's any chance to get this customizable so we can set this to eg. applications.domain.com/app1/metrics applications.domain.com/app2/metrics

We could by-pass the F5 and reach them directly using internal routing CF's feature. However, it would mean for us a dedicated route inside the Cloud Foundry for each of application. Which would be not really intuitive and nice.

Please let us know if this is anyhow possible and if this could be potentially picked up by someone and implemented :) I believe that many people/companies would be interested in this.

Thank you very much!

Best regards, K.M.

donbourne commented 2 years ago

@KrzMar , thanks for opening this.

Considering what you said about aligning the metrics context route with the app context route -- since Liberty servers can run multiple applications it may not be as simple as the CF case where one server has one app (and therefore one context root).

One possible alternative could be for the mpMetrics feature to have a configurable contextRoot attribute. That could enable the metrics context root to be explicitly set to the same as your app context root, if that's what is wanted. For example:

<mpMetrics contextRoot="app1"/>

Would that approach satisfy your use case?

krismarc commented 2 years ago

Hi @donbourne, thank you for so quick response! This is highly appreciated.

you are completly right. In this case any manipulation using the app context might be complicated if there's more than 1 application.

Your proposal sounds really promising. I believe this would meet all our expectations. If you decide to introduce this then we could offer our testing even with really initial version just to verify if it matches our usecase. If it passes all our tests, we will expected this to be introduced centrally on the high scale within the company as main source for Application Servers metrics.

Best regards, K.M.

donbourne commented 2 years ago

Thanks @KrzMar for your feedback on the design question! We'll discuss to see if this is something that can be implemented.

krismarc commented 2 years ago

@donbourne do you have any update on this?

donbourne commented 2 years ago

@krismarc , this still seems like a good idea, but isn't the top priority item to implement. We've got it in our future backlog list.