Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[Bug] Prometheus metrics format bug

Abierto Apto para principiantes
#3,142 7 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
64/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
grafana, java, prometheus

Línea de trabajo

Locate the metric-name processing methods replaceSlashInKey and replaceDotDashInKey shown in the issue, then trace where hugegraph-server builds the /metrics output. Reproduce a Prometheus scrape with a metric containing '~' and verify that the exposed names use valid characters and are parsed successfully.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug
Bug Type (问题类型)

None

Before submit
  • 我已经确认现有的 Issues 与 FAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)
Environment (环境信息)

3 pd
3 server
5 store

Expected & Actual behavior (期望与实际表现)

I pulled the latest version of the HugeGraph source code, compiled and deployed it, and then deployed a Prometheus + Grafana monitoring environment.

During the monitoring test, I found that the metrics exposed by hugegraph-server (/metrics) could not be scraped correctly by Prometheus. After checking the logs, I found that some metric names contained the illegal character ~, which does not comply with the Prometheus metric naming specification. As a result, Prometheus failed to parse the metrics data, causing the server monitoring metrics collection to fail.

I located the issue in the metric name processing logic and modified the related code to correctly replace the illegal characters in metric names. After recompiling and redeploying HugeGraph Server, the metrics format was fixed, and Prometheus was able to successfully scrape the server monitoring metrics.

public static String replaceSlashInKey(String orgKey) {
    return orgKey.replace("/", "_");
}
->
public static String replaceSlashInKey(String orgKey) {
    return orgKey.replace("/", "_").replace("~", "_");
}

I also modified the following code section. However, I am not sure whether this change has any effect. What I can confirm is that the code above definitely needs to be modified, because I first modified the code below, recompiled and redeployed the project, but the issue still occurred. After modifying the code above, recompiling and redeploying HugeGraph Server successfully resolved the problem.

public static String replaceDotDashInKey(String orgKey) {
return orgKey.replace(".", "").replace("-", "").replace("/", "").replace("$", "");
}
->
public static String replaceDotDashInKey(String orgKey) {
return orgKey.replace(".", "").replace("-", "").replace("/", "").replace("$", "").replace("~", "_");
}

Vertex/Edge example (问题点 / 边数据举例)

Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

Lenguaje dominante
Java
Estrellas
3.2k
Forks
637
Merge medio
3 d 21 h
PR fusionados (30 d)
21

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/hugegraph

Todos los issues de apache/hugegraph

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.