mirror of
https://github.com/kemko/reproxy.git
synced 2026-01-01 15:55:49 +03:00
rename endpoint to /metrics
This commit is contained in:
@@ -147,7 +147,7 @@ reproxy provides 2 endpoints for this purpose:
|
|||||||
Optional, can be turned on with `--mgmt.enabled`. Exposes 2 endpoints on `mgmt.listen` address:port:
|
Optional, can be turned on with `--mgmt.enabled`. Exposes 2 endpoints on `mgmt.listen` address:port:
|
||||||
|
|
||||||
- `GET /routes` - list of all discovered routes
|
- `GET /routes` - list of all discovered routes
|
||||||
- `GET /prometheus` - returns prometheus metrics (`http_requests_total`, `response_status` and `http_response_time_seconds`)
|
- `GET /metrics` - returns prometheus metrics (`http_requests_total`, `response_status` and `http_response_time_seconds`)
|
||||||
|
|
||||||
_see also [examples/metrics](https://github.com/umputun/reproxy/examples/metrics)_
|
_see also [examples/metrics](https://github.com/umputun/reproxy/examples/metrics)_
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ func (s *Server) Run(ctx context.Context) error {
|
|||||||
|
|
||||||
handler := http.NewServeMux()
|
handler := http.NewServeMux()
|
||||||
handler.HandleFunc("/routes", s.routesCtrl())
|
handler.HandleFunc("/routes", s.routesCtrl())
|
||||||
handler.Handle("/prometheus", promhttp.Handler())
|
handler.Handle("/metrics", promhttp.Handler())
|
||||||
h := rest.Wrap(handler,
|
h := rest.Wrap(handler,
|
||||||
rest.Recoverer(log.Default()),
|
rest.Recoverer(log.Default()),
|
||||||
rest.AppInfo("reproxy-mgmt", "umputun", s.Version),
|
rest.AppInfo("reproxy-mgmt", "umputun", s.Version),
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ func TestServer_controllers(t *testing.T) {
|
|||||||
assert.Contains(t, fmt.Sprintf("%v", data["srv1"][0]), `ping:http://example.com/ping`, data["srv1"][0])
|
assert.Contains(t, fmt.Sprintf("%v", data["srv1"][0]), `ping:http://example.com/ping`, data["srv1"][0])
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
req, err := http.NewRequest("GET", "http://127.0.0.1:"+strconv.Itoa(port)+"/prometheus", nil)
|
req, err := http.NewRequest("GET", "http://127.0.0.1:"+strconv.Itoa(port)+"/metrics", nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ scrape_configs:
|
|||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['localhost:9090']
|
- targets: ['localhost:9090']
|
||||||
- job_name: reproxy
|
- job_name: reproxy
|
||||||
metrics_path: /prometheus
|
metrics_path: /metrics
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets:
|
- targets:
|
||||||
- reproxy:8081
|
- reproxy:8081
|
||||||
|
|||||||
Reference in New Issue
Block a user