Writing Data to Guance via DataKit
This document primarily introduces how to write data to DataKit using this system. (That is: use DataFlux Func as a collector to connect with DataKit)
The sample data used in this article are random numbers. Therefore, for the overall appearance of the document, some screenshots have fictional elements and do not guarantee identical results every time you perform the operation.
The examples in this article will only work under correct configuration/operation of components like DataKit, DataWay, etc., from Guance and normal network conditions.
Always use the latest version of DataFlux Func for operations.
1. Background
In some cases, the collectors provided by Guance may not meet the needs for data reporting. At such times, you can use DataFlux Func as a collector for DataKit to report data.
This article assumes that the user has already correctly connected DataKit within DataFlux Func. For information on how to connect DataKit in DataFlux Func, please refer to:
2. Writing Data Insertion Functions
Enter the editor, create a script, and input the following sample script:
Python | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
3.1. Debugging Functions
Click the "Execute" button, and if it runs correctly, it indicates success.
4. Publishing the Script
After modifying the script, it will be saved as a draft. You need to publish it to officially go live.
5. Configuring Automatic Function Execution
Functions decorated with @DFF.API(...)
can be configured for automatic execution in the "Manage / Scheduled Tasks (Old Version: Automatic Trigger Configuration)" section.
6. Viewing Data in Guance
After the function runs normally, wait for a moment...
Switch to the "Metrics" section in Guance.
Select the Measurement and tags written earlier to view the generated data.
Switch to the "Logs" section in Guance.
Select the Measurement and tags written earlier to view the generated data.