Skip to content

Commit

Permalink
OpenAI Update Resources (#15494)
Browse files Browse the repository at this point in the history
* Update readme with api keys section

* Add dashboard images

* Add api token usage monitor

* Fix comma

* Add monitor metadata

* Add integration tag
  • Loading branch information
cmlaverdiere authored Aug 9, 2023
1 parent 4b38a80 commit a071e42
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 2 deletions.
16 changes: 16 additions & 0 deletions openai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,20 @@ Validate that the APM Node.js library can communicate with your Agent by examini
}
```

<!-- xxz tabs xxx -->
<!-- xxx tab "API Key" xxx -->

### Installation

1. Login to your [OpenAI Account][10].
2. Navigate to **View API Keys** under account settings.
3. Click the **Create a new secret key** button.
4. Copy the created API Key to your clipboard.

### Configuration

1. Navigate to the configuration tab inside Datadog [OpenAI integration tile][11].
2. Enter an account name and OpenAI API key copied above in the accounts configuration.

<!-- xxz tab xxx -->
<!-- xxz tabs xxx -->
Expand Down Expand Up @@ -212,3 +226,5 @@ Additional helpful documentation, links, and articles:
[7]: https://www.datadoghq.com/blog/monitor-azure-openai-with-datadog/
[8]: https://datadoghq.dev/dd-trace-js/interfaces/plugins.openai.html
[9]: https://github.com/DataDog/dd-trace-js
[10]: https://platform.openai.com/
[11]: https://app.datadoghq.com/integrations/openai
28 changes: 28 additions & 0 deletions openai/assets/recommended_monitors/api_token_usage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "[OpenAI] Abnormally high token usage ",
"type": "query alert",
"query": "avg(last_12h):anomalies(sum:openai.api.usage.n_context{*}.as_count() + sum:openai.api.usage.n_generated{*}.as_count(), 'basic', 2, direction='both', interval=120, alert_window='last_30m', count_default_zero='true', seasonality='hourly') >= 1",
"message": "{{#is_alert}}\n\nALERT: Your OpenAI usage in the last hour has been abnormally high\n\n{{/is_alert}}",
"tags": [
"integration:openai"
],
"options": {
"thresholds": {
"critical": 1,
"critical_recovery": 0
},
"notify_audit": false,
"require_full_window": false,
"notify_no_data": false,
"no_data_timeframe": 10,
"renotify_interval": 0,
"threshold_windows": {
"trigger_window": "last_30m",
"recovery_window": "last_15m"
},
"include_tags": false
},
"recommended_monitor_metadata": {
"description": "Notify your team when OpenAI token usage is abnormally high"
}
}
Binary file added openai/images/openai_dash_samples.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added openai/images/openai_dash_tokens_cost.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added openai/images/openai_dash_usage_trends.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 19 additions & 2 deletions openai/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,23 @@
"changelog": "CHANGELOG.md",
"description": "Optimize OpenAI usage: cost estimates, prompt sampling and performance metrics.",
"title": "OpenAI",
"media": [],
"media": [
{
"media_type": "image",
"caption": "OpenAI Dashboard Usage Trends",
"image_url": "images/openai_dash_usage_trends.png"
},
{
"media_type": "image",
"caption": "OpenAI Dashboard Samples",
"image_url": "images/openai_dash_samples.png"
},
{
"media_type": "image",
"caption": "OpenAI Dashboard Tokens and Cost",
"image_url": "images/openai_dash_tokens_cost.png"
}
],
"classifier_tags": [
"Submitted Data Type::Metrics",
"Submitted Data Type::Logs",
Expand Down Expand Up @@ -42,7 +58,8 @@
},
"monitors": {
"Request Limits": "assets/recommended_monitors/request_limits.json",
"Token per min Limits": "assets/recommended_monitors/tokens_limits.json"
"Token per min Limits": "assets/recommended_monitors/tokens_limits.json",
"Abnormally High Token Usage": "assets/recommended_monitors/api_token_usage.json"
}
},
"author": {
Expand Down

0 comments on commit a071e42

Please sign in to comment.