custom path for prometheus actuator

人盡茶涼 提交于 2019-12-05 09:00:21

From the reference documentation:

By default, endpoints are exposed over HTTP under the /actuator path by using the ID of the endpoint. For example, the beans endpoint is exposed under /actuator/beans. If you want to map endpoints to a different path, you can use the management.endpoints.web.path-mapping property. Also, if you want change the base path, you can use management.endpoints.web.base-path.

The following example remaps /actuator/health to /healthcheck:

application.properties:

management.endpoints.web.base-path=/
management.endpoints.web.path-mapping.health=healthcheck

So, to remap the prometheus endpoint to a different path beneath /actuator you can use the following property:

management.endpoints.web.path-mapping.prometheus=whatever-you-want

The above will make the Prometheus endpoint available at /actuator/whatever-you-want

If you want the Prometheus endpoint to be available at the root, you'll have to move all the endpoints there and remap it:

management.endpoints.web.base-path=/
management.endpoints.web.path-mapping.prometheus=whatever-you-want

The above will make the Prometheus endpoint available at /whatever-you-want but with the side-effect of also moving any other enabled endpoints up to / rather than being beneath /actuator.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!