OpenAI¶
The display metrics of OpenAI include the total number of requests, response time, number of requests, number of request errors, and the number of consumed tokens.
Configuration¶
Install Func¶
It is recommended to enable the Guance integration - extension - hosted Func: all prerequisites are automatically installed. Please continue with the script installation.
If you deploy Func on your own, refer to Self-deployed Func
Install DataKit¶
Install the DataKit data collector. In the Guance workspace, click Integration -- Datakit, copy the installation command line to install Datakit.
Note: After installing DataKit, modify a configuration:
- Log in as the root user and open the DataKit configuration:
vim /usr/local/datakit/conf.d/datakit.conf
- Change http_listen = "localhost:9529" to http_listen = "0.0.0.0:9529"
- Restart the DataKit service:
datakit service -R
For more information, please refer to:
Install Script¶
Install the corresponding collection script: 「Guance Integration (ChatGpt Monitoring)」(ID: guance_chatgpt_monitor
)
After clicking 【Install】, enter the corresponding parameters: OpenAI key.
Click 【Integration】-'Authorization Link' -'Create', create an authorization link for this function. After creation, in the authorization link list, you can find this function. Click the "example" on the right side of this function, select 'POST Simplified Form (Json) ', you will get a link, fill this link into the 'url' section of the code.
We have collected some configurations by default, see the metrics section for details.
Verification¶
- In "Management / Automatic Trigger Configuration", confirm whether the corresponding task has the corresponding automatic trigger configuration, and at the same time, you can view the corresponding task records and logs to check for any abnormalities.
- In Guance, under "Metrics", check if there are corresponding monitoring data.
Metrics¶
Metric | Description | Type | Unit |
---|---|---|---|
question | Total number of requests | float | count |
response_time | Response time | float | s |
create_time | Number of requests | float | count |
res_status | Number of request errors | float | count |
total_tokens | Total number of consumed tokens | float | count |