apache / apache/apisix

As a use, I want to add URI label to http_requests_total metric in prometheus plugin

Open
#11,888 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Lua
Stars
17.1k
Forks
2.9k
Avg merge
3d 18h
Merged PRs (30d)
62

Description

### Description

The current prometheus plugin provides `http_requests_total` metric to track the total number of client requests. However, it lacks the ability to track requests by URI, which is crucial for monitoring traffic patterns and identifying potential bottlenecks at the endpoint level.

### Why

Currently, `http_requests_total` is defined as a simple gauge without labels:

```
metrics.requests = prometheus:gauge("http_requests_total"
```

This would allow users to:
- Track request counts per endpoint
- Set up alerts based on endpoint-specific traffic patterns
- Better understand traffic distribution across different APIs

In addition, it will be consistent with other metrics like `http_status` which already includes URI information

Contributor guide

Open the contributing guide

Research direction

Start by locating the Prometheus plugin code that defines the http_requests_total metric as a gauge. Compare it with the existing http_status metric's URI information, then verify that request totals can be tracked per URI and that the metric remains usable for endpoint-specific monitoring.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, prometheus
Domain
observability-sre
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.