cui2022 opened a new issue, #3142:
URL: https://github.com/apache/hugegraph/issues/3142

   ### Bug Type (问题类型)
   
   None
   
   ### Before submit
   
   - [x] 我已经确认现有的 [Issues](https://github.com/apache/hugegraph/issues) 与 
[FAQ](https://hugegraph.apache.org/docs/guides/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 (问题点 / 边数据举例)
   
   ```javascript
   
   ```
   
   ### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
   
   ```javascript
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to