limowang commented on issue #1820: URL: https://github.com/apache/incubator-pegasus/issues/1820#issuecomment-1874894758
 # Go-collector indicator collection process analysis ## Process analysis 1. Metrics obtained from the server are stored in global variables in the metrics package. For example: GaugeMetricsMap map[string]prometheus.GaugeVec,CounterMetricsMap map[string]prometheus.CounterVec.In the main function, initialize the GaugeMetricsMap and CounterMetricsMap variables by calling InitMetrics() in the metrics package, and access the http indicator interface exposed by each server through getProMetricsByAddrs(addrs string) to initialize. 2. Generate a Collector object that collects meta-server indicators by calling NewMetaServerMetricCollector(), and then call its function Start() to update the indicators regularly. ProcessAllServerMetrics(dsource) will be called in Start(). This function will periodically update the global variables GaugeMetricsMap and CounterMetricsMap that store prometheus format indicators from the http indicator interface exposed on the server side, so that prometheus monitoring can update data periodically. 3. main() will finally call StartServer() in the webui package. The function of this function is: first generate a prometheus indicator registration center through NewRegister(), and then call MustRegister(prometheusMetricType) to add the GaugeVec variable in the global variable GaugeMetricsMap and the CounterMetricsMap CounterVec is registered in the prometheus indicator registration center, and finally the listening port is opened to allow the prometheus server to pull indicator data. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
