Metrics Collection¶
Guance metrics collection is implemented based on DataKit (data collector), and its workflow follows a standardized pipeline model.
Deploy DataKit¶
Install DataKit¶
Two installation methods are supported:
Configure Collectors¶
Metrics collection is achieved through DataKit's standardized configuration. The core process consists of four steps:
- Create a configuration template: Navigate to the target collector's configuration directory (e.g.,
/usr/local/datakit/conf.d/mysql/), copy the official.conf.sampletemplate file to an effective configuration file with a.confextension. - Edit core parameters: Define basic connections (e.g.,
hostfor MySQL), collection strategies (e.g.,intervalfor time intervals), and business tags in the configuration file. - Restart to take effect: Execute
datakit --restartto load the configuration. Verify the status using log keywords (e.g.,mysql collector started) and thedatakit monitorcommand. - Extend for multiple scenarios such as infrastructure, middleware, and custom metrics.
For specific configuration steps, refer to Collector Configuration.
Custom Metrics Collection¶
In addition to collecting metric data through DataKit, you can also implement custom metrics collection for infrastructure, middleware, and business layers through multi-dimensional methods such as the Prometheus ecosystem, HTTP API push, Graphite/StatsD protocol reception, Telegraf/Kafka pipeline transmission, SQL query generation, and Python script extensions.
-
Prometheus exporter metrics integration
-
Directly push metrics to the Prometheus Remote Write collector
-
Push metrics via the Prometheus push gateway collector
-
Write metric data via the DataKit HTTP API
-
Collect metric data from Kafka via the Kafkamq collector
-
Receive data pushed by Telegraf
-
Database collectors integrate metrics via custom SQL (custom_queries) (using MySQL as an example)
-
Collect data via custom Python scripts
-
Prometheus exporter metrics collection in Kubernetes
-
Receive custom metric data via the Graphite collector
-
Receive metric data pushed by Statsd
Tag Specifications¶
-
Prohibit dynamic tags (e.g.,
user_id,ip), use only static business tags (e.g.,env,project). -
Global tags (
datakit.conf):
Data Validation¶
-
Console: Path: Metrics > Explorer > Enter the measurement name (e.g.,
mysql), check data continuity. -
Command-line debugging: For more details, refer to Debugging Collector Configuration.