Metrics Collection¶
Guance Metrics collection is implemented based on DataKit (data collector), and its workflow follows a standardized pipeline model.
Deploy DataKit¶
Install DataKit¶
The following two installation methods are supported:
Configure Collector¶
Metrics collection through the standardized configuration of DataKit is realized, with the core process divided into four steps:
- Create a configuration template: Enter the target collector configuration directory (e.g.,
/usr/local/datakit/conf.d/mysql/
), copy the official provided.conf.sample
template file to a.conf
suffix effective configuration; - Edit key parameters: Define basic connections (such as MySQL's
host
) in the configuration file, collection strategies (such as interval timeinterval
), and business tags; - Restart to take effect: Execute
datakit --restart
to load the configuration, verify the status through log keywords (such asmysql collector started
) and thedatakit monitor
command; - Extend for multiple scenarios regarding infrastructure, MIDDLEWARE, and custom metrics.
For specific configuration steps, refer to Collector Configuration.
Custom Metrics Collection¶
In addition to collecting metrics data through DataKit, you can also achieve custom metrics collection for infrastructure, MIDDLEWARE, and business layers via multi-dimensional methods such as Prometheus system, HTTP API push, Graphite/StatsD protocol reception, Telegraf/Kafka pipeline transmission, SQL query generation, Python script extension, etc.
-
Promethues exporter Metrics Integration
-
Directly push metrics to the Prometheus Remote Write collector
-
Push metrics via the Prometheus push gateway collector
-
Insert metrics data via the DataKit HTTP API
-
Collect metrics data from Kafka using the Kafkamq collector
-
Receive data pushed by Telegraf
-
Database collectors access metrics through custom SQL (custom_queries) (example with MySQL)
-
Collect data via custom Python scripts
-
Kubernetes Prometheus exporter metric collection
-
Receive custom metrics data via the Graphite collector
-
Receive metrics data pushed by Statsd
Tag Specifications¶
-
Prohibit dynamic tags (such as
user_id
,ip
), use only static business tags (env
,project
). -
Global tags (
datakit.conf
):
Data Validation¶
-
Console: Path: Metrics > Explorer > Input Metrics Set name (such as
mysql
), check data continuity. -
Command-line debugging: For more details, refer to Debugging Collector Configuration.