alibaba / alibaba/Sentinel

Use a fixed metric name for sentinel prometheus exporter

Open
#3,320 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

### Issue Description

**Type:** *Enhancement*

I have followed this [README](https://github.com/alibaba/Sentinel/blob/a524ab3bb3364818e292e1255480d20845e77c89/sentinel-extension/sentinel-prometheus-metric-exporter/README.md) to set up sentinel prometheus exporter. However, I've observed that the metric name is currently tied to the `appName`, which is typically the JAR's name or specified by the VM option `csp.sentinel.prometheus.app`. The logic can be found at [SentinelCollector.java#L83](https://github.com/alibaba/Sentinel/blob/master/sentinel-extension/sentinel-prometheus-metric-exporter/src/main/java/com/alibaba/csp/sentinel/metric/prom/collector/SentinelCollector.java#L83).

Querying metrics using `appName` in PromQL seems unconventional and inconvenient. In scenarios where multiple services enable the Prometheus exporter feature, prometheus will receive numerous distinct metrics that essentially convey the same information.

I propose using a fixed metric name and introducing an additional label (`app_name`) representing the `appName`.

### Desired Feature

I would like the Prometheus exporter to provide a fixed metric name and an extra label (`app_name`). This would enable querying with a consistent PromQL expression like `sentinel_metric_log{app_name="xx", resource="xxx", type="xxx"}`. With this enhancement, every service can be queried using the same PromQL, requiring only the label's value to be adjusted.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.