Skip to content

OpenAI

The displayed metrics of OpenAI include total requests, response time, number of requests, number of request errors, and token consumption.

Configuration{#config}

Install Func

It is recommended to activate the TrueWatch integration - extensions - DataFlux Func (Automata): all prerequisites are automatically installed, please proceed with the script installation.

If you are deploying Func manually, refer to Manual Func Deployment

Install DataKit

Install the DataKit data collector. In the TrueWatch workspace, click Integration -- Datakit, copy the installation command line to install Datakit.

Note: After installing DataKit, modify one configuration:

  • Log in as root 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, refer to:

Install Script

Install the corresponding collection script: "TrueWatch Integration (ChatGPT Monitoring)" (ID: integration_chatgpt_monitor)

After clicking 【Install】, enter the corresponding parameters: OpenAI key.

Click 【Integration】 - 'Authorization Links' - 'Create', create an authorization link for this function. After creation, you can find this function in the authorization link list. Click the "Example" on the right side of this function, select 'POST Simplified Form (Json)', and you will get a link. Fill this link into the 'url' field in the code.

We have collected some configurations by default, see the metrics section for details.

Verification

  1. In 「Management / Automatic Trigger Configuration」, confirm whether the corresponding task has the corresponding automatic trigger configuration. At the same time, you can check the corresponding task records and logs to see if there are any exceptions.
  2. In TrueWatch, check if there is corresponding monitoring data in 「Metrics」.

Metrics

Metric Description Type Unit
question Total 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 Token Consumption float count