Monitor Service Proxies with Prometheus
Membrane API Gateway collects statistics for your services proxies. These statistics can be made available with Membranes Prometheus interceptor. The collected statistics are consumable by the Prometheus ecosystem out of the box.
order_api_code_307_count 1 order_api_code_307_min 6 ms order_api_code_307_max 6 ms order_api_code_307_avg 6 ms order_api_code_404_count 1 order_api_code_404_min 3 ms order_api_code_404_max 3 ms order_api_code_404_avg 3 ms order_api_code_200_count 18 order_api_code_200_min 3 ms order_api_code_200_max 60 ms order_api_code_200_avg 26.778 ms prometheus_monitoring_code_200_count 14 prometheus_monitoring_code_200_min prometheus_monitoring_code_200_max prometheus_monitoring_code_200_avg admin_console_code_200_count 110 admin_console_code_200_min 0 ms admin_console_code_200_max 47 ms admin_console_code_200_avg 4.736 ms
Listing 1 shows an example output of the Prometheus interceptor.
Setup Prometheus Monitoring
Setting up monitoring for Prometheus is easy. Have a look at the configuration in listing 2.
<serviceProxy name="Prometheus Monitoring" port="8080"> <path>/prometheus</path> <prometheus/> </serviceProxy>
With this configuration monitoring data is served on localhost:8080/prometheus. The interceptor chain will not continue beyond this interceptor as it returns the collected data directly.
Help needed?
Do you need any help? Then contact us using the Membrane Google Group or send an email to membrane@predic8.com.