dachuan9e opened a new issue #11451:
URL: https://github.com/apache/shardingsphere/issues/11451


   # Background
   If we use agent to monitor the hikariCP metrics and export to the 
prometheus.  There are many data sources exposed by the data. However it can be 
identified by the value of  key "pool" as following.  As the proxy running the 
postfix number will increated if any data source created.  It makes the 
exporting data in prometheus can not know the pool belongs to which schema.  It 
seems to name the data source pool for the monitor metrics.
   
   prometheus data:
   ```java
   hikaricp_active_connections{pool="HikariPool-1",} 0.0
   hikaricp_active_connections{pool="HikariPool-2",} 0.0
   ```
   
   # problems or influence
   
   The data source in proxy will be closed and opened during the running time. 
It makes it difficult to identify if no name.
   Otherwise the metrics tracer is also named by pool name. Naming a data 
source can solve the problem but also has some 
   influence if we can share the data source among different schemas. However 
proxy doesn't share the data source it will create different data source for 
different schema even the same ds name. At the same time naming the connection 
pool increases the complexity of code. We have to be careful to avoid potential 
issues in future.
   
   
   hikaricp code:
   
   ```java 
      public void setMetricsTrackerFactory(MetricsTrackerFactory 
metricsTrackerFactory)
      {
         if (metricsTrackerFactory != null) {
            this.metricsTracker = new 
MetricsTrackerDelegate(metricsTrackerFactory.create(config.getPoolName(), 
getPoolStats()));
         }
         else {
            this.metricsTracker = new NopMetricsTrackerDelegate();
         }
      }
   ```
   # Question
   At first, we need to confirm that it should provide named pool for 
prometheus for exporting data. If there is no this requirement we can avoid the 
complexity.


-- 
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