From f80eccff19698e840b2b415c1a52b5b68422b69a Mon Sep 17 00:00:00 2001 From: Bo Huang Date: Thu, 16 Jan 2025 12:17:16 -0500 Subject: [PATCH] [openai] Update dashboard to use daily rollups (#19403) * [openai] Update dashboard to use daily rollups * Update openai/assets/dashboards/cost_overview_dashboard.json Co-authored-by: Michael Cretzman <58786311+michaelcretzman@users.noreply.github.com> --------- Co-authored-by: Michael Cretzman <58786311+michaelcretzman@users.noreply.github.com> --- .../dashboards/cost_overview_dashboard.json | 2191 ++++++++--------- 1 file changed, 998 insertions(+), 1193 deletions(-) diff --git a/openai/assets/dashboards/cost_overview_dashboard.json b/openai/assets/dashboards/cost_overview_dashboard.json index 206bc16da2536..42818440b72a1 100644 --- a/openai/assets/dashboards/cost_overview_dashboard.json +++ b/openai/assets/dashboards/cost_overview_dashboard.json @@ -1,1242 +1,1047 @@ { "title": "OpenAI Cost Overview", "description": "This dashboard provides insights into various OpenAI costs and their sources of attribution.", - "widgets": [ - { - "id": 3636494906945158, - "definition": { - "type": "note", - "content": "There are **3 sections** in this dashboard, all require Cloud Cost Management for OpenAI to be set up to see data.\n\n1. **OpenAI Cost Management**: [Set up](https://docs.datadoghq.com/cloud_cost_management/saas_costs/?tab=openai#setup) Cloud Cost Management and then the OpenAI integration\n2. **OpenAI Integration (API)**: [Set up](https://docs.datadoghq.com/integrations/openai/?tab=apikey) the **free** API set-up portion\n3. **LLM Observability**: [Set up](https://docs.datadoghq.com/llm_observability/setup/?tab=decorators) LLM Observability \n\nYou can clone and customize this dashboard for your specific tags", - "background_color": "blue", - "font_size": "16", - "text_align": "left", - "vertical_align": "center", - "show_tick": false, - "tick_pos": "50%", - "tick_edge": "left", - "has_padding": true - }, - "layout": { - "x": 0, - "y": 0, - "width": 12, - "height": 3 - } + "widgets": [{ + "id": 3636494906945158, + "definition": { + "type": "note", + "content": "The 3 sections in this dashboard all require Cloud Cost Management for OpenAI to be set up in order to see data.\n\n1. **OpenAI Cost Management**: [Set up](https://docs.datadoghq.com/cloud_cost_management/saas_costs/?tab=openai#setup) Cloud Cost Management and then the OpenAI integration\n2. **OpenAI Integration (API)**: [Set up](https://docs.datadoghq.com/integrations/openai/?tab=apikey) the **free** API set-up portion\n3. **LLM Observability**: [Set up](https://docs.datadoghq.com/llm_observability/setup/?tab=decorators) LLM Observability \n\nYou can clone and customize this dashboard for your specific tags", + "background_color": "blue", + "font_size": "16", + "text_align": "left", + "vertical_align": "center", + "show_tick": false, + "tick_pos": "50%", + "tick_edge": "left", + "has_padding": true }, - { - "id": 8347049005274980, - "definition": { - "title": "OpenAI Cost Management", - "background_color": "vivid_green", - "show_title": true, - "type": "group", - "layout_type": "ordered", - "widgets": [ - { - "id": 8416974066900506, - "definition": { - "type": "note", - "content": "Set up the Cloud Cost Management [OpenAI Cost Integration](https://docs.datadoghq.com/cloud_cost_management/saas_costs/?tab=openai#setup) to see data in this section. ", - "background_color": "green", - "font_size": "14", - "text_align": "center", - "vertical_align": "center", - "show_tick": false, - "tick_pos": "50%", - "tick_edge": "left", - "has_padding": true - }, - "layout": { - "x": 0, - "y": 0, - "width": 12, - "height": 1 - } + "layout": { + "x": 0, + "y": 0, + "width": 12, + "height": 3 + } + }, { + "id": 8347049005274980, + "definition": { + "title": "OpenAI Cost Management", + "background_color": "vivid_green", + "show_title": true, + "type": "group", + "layout_type": "ordered", + "widgets": [{ + "id": 8416974066900506, + "definition": { + "type": "note", + "content": "Set up the Cloud Cost Management [OpenAI Cost Integration](https://docs.datadoghq.com/cloud_cost_management/saas_costs/?tab=openai#setup) to see data in this section. ", + "background_color": "green", + "font_size": "14", + "text_align": "center", + "vertical_align": "center", + "show_tick": false, + "tick_pos": "50%", + "tick_edge": "left", + "has_padding": true + }, + "layout": { + "x": 0, + "y": 0, + "width": 12, + "height": 1 + } + }, { + "id": 409821317360376, + "definition": { + "type": "image", + "url": "/static/images/logos/openai_large.svg", + "url_dark_theme": "/static/images/logos/openai_reversed_large.svg", + "sizing": "cover", + "has_background": true, + "has_border": true, + "vertical_align": "center", + "horizontal_align": "center" + }, + "layout": { + "x": 0, + "y": 1, + "width": 3, + "height": 2 + } + }, { + "id": 1457644073160806, + "definition": { + "title": "Total Costs (past 30d)", + "title_size": "16", + "title_align": "left", + "time": { + "type": "live", + "unit": "month", + "value": 1, + "hide_incomplete_cost_data": true }, - { - "id": 409821317360376, - "definition": { - "type": "image", - "url": "/static/images/logos/openai_large.svg", - "url_dark_theme": "/static/images/logos/openai_reversed_large.svg", - "sizing": "cover", - "has_background": true, - "has_border": true, - "vertical_align": "center", - "horizontal_align": "center" - }, - "layout": { - "x": 0, - "y": 1, - "width": 3, - "height": 2 - } + "type": "query_value", + "requests": [{ + "formulas": [{ + "formula": "query1" + }], + "queries": [{ + "data_source": "cloud_cost", + "name": "query1", + "query": "sum:custom.cost.amortized{providername:OpenAI,$api_key,$ml_app,$service,$model,$project}.rollup(sum, daily)", + "aggregator": "sum" + }], + "response_format": "scalar" + }], + "autoscale": true, + "precision": 2 + }, + "layout": { + "x": 3, + "y": 1, + "width": 3, + "height": 2 + } + }, { + "id": 5140360304170010, + "definition": { + "title": "Total Costs (30d prior)", + "title_size": "16", + "title_align": "left", + "time": { + "type": "live", + "unit": "month", + "value": 1, + "hide_incomplete_cost_data": true }, - { - "id": 1457644073160806, - "definition": { - "title": "Total Costs (past 30d)", - "title_size": "16", - "title_align": "left", - "time": { - "type": "live", - "unit": "month", - "value": 1, - "hide_incomplete_cost_data": true - }, - "type": "query_value", - "requests": [ - { - "formulas": [ - { - "formula": "query1" - } - ], - "queries": [ - { - "data_source": "cloud_cost", - "name": "query1", - "query": "sum:custom.cost.amortized{providername:OpenAI,$api_key,$ml_app,$service,$model,$project}.rollup(sum, 86400)", - "aggregator": "sum" - } - ], - "response_format": "scalar" - } - ], - "autoscale": true, - "precision": 2 - }, - "layout": { - "x": 3, - "y": 1, - "width": 3, - "height": 2 - } + "type": "query_value", + "requests": [{ + "formulas": [{ + "formula": "query1" + }], + "queries": [{ + "query": "sum:custom.cost.amortized{providername:OpenAI,$api_key,$ml_app,$service,$model,$project}.rollup(sum, daily)", + "data_source": "cloud_cost", + "name": "query1", + "aggregator": "sum" + }], + "response_format": "scalar" + }], + "autoscale": true, + "precision": 2 + }, + "layout": { + "x": 6, + "y": 1, + "width": 3, + "height": 2 + } + }, { + "id": 8170994894343814, + "definition": { + "title": "% change (past 30d vs 30d prior)", + "title_size": "16", + "title_align": "left", + "time": { + "type": "live", + "unit": "month", + "value": 1, + "hide_incomplete_cost_data": true }, - { - "id": 5140360304170010, - "definition": { - "title": "Total Costs (30d prior)", - "title_size": "16", - "title_align": "left", - "time": { - "type": "live", - "unit": "month", - "value": 1, - "hide_incomplete_cost_data": true - }, - "type": "query_value", - "requests": [ - { - "formulas": [ - { - "formula": "query1" - } - ], - "queries": [ - { - "query": "sum:custom.cost.amortized{providername:OpenAI,$api_key,$ml_app,$service,$model,$project}.rollup(sum, 86400)", - "data_source": "cloud_cost", - "name": "query1", - "aggregator": "sum" - } - ], - "response_format": "scalar" + "type": "query_value", + "requests": [{ + "formulas": [{ + "number_format": { + "unit": { + "type": "canonical_unit", + "unit_name": "percent" } - ], - "autoscale": true, - "precision": 2 - }, - "layout": { - "x": 6, - "y": 1, - "width": 3, - "height": 2 - } - }, - { - "id": 8170994894343814, - "definition": { - "title": "% change (past 30d vs 30d prior)", - "title_size": "16", - "title_align": "left", - "time": { - "type": "live", - "unit": "month", - "value": 1, - "hide_incomplete_cost_data": true }, - "type": "query_value", - "requests": [ - { - "formulas": [ - { - "number_format": { - "unit": { - "type": "canonical_unit", - "unit_name": "percent" - } - }, - "formula": "(query1 - calendar_shift(query2, '-1mo', 'Europe/Paris')) / calendar_shift(query2, '-1mo', 'Europe/Paris') * 100" - } - ], - "queries": [ - { - "query": "sum:custom.cost.amortized{providername:OpenAI,$api_key,$ml_app,$service,$model,$project}.rollup(sum, 86400)", - "data_source": "cloud_cost", - "name": "query1", - "aggregator": "sum" - }, - { - "query": "sum:custom.cost.amortized{providername:OpenAI,$api_key,$ml_app,$service,$model,$project}.rollup(sum, 86400)", - "data_source": "cloud_cost", - "name": "query2", - "aggregator": "sum" - } - ], - "response_format": "scalar", - "conditional_formats": [ - { - "comparator": "<", - "value": 5, - "palette": "black_on_light_green" - }, - { - "comparator": "<", - "value": 10, - "palette": "black_on_light_yellow" - }, - { - "comparator": ">", - "value": 10, - "palette": "black_on_light_red" - } - ] - } - ], - "autoscale": true, - "precision": 2 - }, - "layout": { - "x": 9, - "y": 1, - "width": 3, - "height": 2 - } + "formula": "(query1 - calendar_shift(query2, '-1mo', 'Europe/Paris')) / calendar_shift(query2, '-1mo', 'Europe/Paris') * 100" + }], + "queries": [{ + "query": "sum:custom.cost.amortized{providername:OpenAI,$api_key,$ml_app,$service,$model,$project}.rollup(sum, daily)", + "data_source": "cloud_cost", + "name": "query1", + "aggregator": "sum" + }, { + "query": "sum:custom.cost.amortized{providername:OpenAI,$api_key,$ml_app,$service,$model,$project}.rollup(sum, daily)", + "data_source": "cloud_cost", + "name": "query2", + "aggregator": "sum" + }], + "response_format": "scalar", + "conditional_formats": [{ + "comparator": "<", + "value": 5, + "palette": "black_on_light_green" + }, { + "comparator": "<", + "value": 10, + "palette": "black_on_light_yellow" + }, { + "comparator": ">", + "value": 10, + "palette": "black_on_light_red" + }] + }], + "autoscale": true, + "precision": 2 + }, + "layout": { + "x": 9, + "y": 1, + "width": 3, + "height": 2 + } + }, { + "id": 3631138712976072, + "definition": { + "type": "note", + "content": "OpenAI models have different capabilities and price points, and are priced by the **number of input and output tokens**.\n\nIn Cloud Cost Management, costs are broken down by the **input and output costs per model**. ", + "background_color": "green", + "font_size": "14", + "text_align": "center", + "vertical_align": "center", + "show_tick": false, + "tick_pos": "50%", + "tick_edge": "left", + "has_padding": true + }, + "layout": { + "x": 0, + "y": 3, + "width": 3, + "height": 4 + } + }, { + "id": 8525206763937204, + "definition": { + "title": "Cost per ServiceName", + "title_size": "16", + "title_align": "left", + "time": { + "type": "live", + "unit": "month", + "value": 1, + "hide_incomplete_cost_data": true }, - { - "id": 3631138712976072, - "definition": { - "type": "note", - "content": "OpenAI models have different capabilities and price points, and are priced by the **number of input and output tokens**.\n\nIn Cloud Cost Management, costs are broken down by the **input and output costs per model**. ", - "background_color": "green", - "font_size": "14", - "text_align": "center", - "vertical_align": "center", - "show_tick": false, - "tick_pos": "50%", - "tick_edge": "left", - "has_padding": true + "requests": [{ + "response_format": "scalar", + "queries": [{ + "data_source": "cloud_cost", + "name": "query1", + "query": "sum:all.cost{providername:OpenAI,$api_key,$ml_app,$service,$model,$project} by {servicename}", + "aggregator": "sum" + }], + "style": { + "palette": "datadog16" }, - "layout": { - "x": 0, - "y": 3, - "width": 3, - "height": 4 + "formulas": [{ + "formula": "query1" + }], + "sort": { + "count": 500, + "order_by": [{ + "type": "formula", + "index": 0, + "order": "desc" + }] } + }], + "type": "sunburst", + "legend": { + "type": "table" + } + }, + "layout": { + "x": 3, + "y": 3, + "width": 9, + "height": 4 + } + }, { + "id": 4968678189694062, + "definition": { + "title": "Cost Changes Over Time by ServiceName", + "title_size": "16", + "title_align": "left", + "show_legend": false, + "legend_layout": "auto", + "legend_columns": ["avg", "min", "max", "value", "sum"], + "time": { + "type": "live", + "unit": "month", + "value": 1, + "hide_incomplete_cost_data": true }, - { - "id": 8525206763937204, - "definition": { - "title": "Cost per ServiceName", - "title_size": "16", - "title_align": "left", - "time": { - "type": "live", - "unit": "month", - "value": 1, - "hide_incomplete_cost_data": true - }, - "requests": [ - { - "response_format": "scalar", - "formulas": [ - { - "formula": "query1" - } - ], - "queries": [ - { - "data_source": "cloud_cost", - "name": "query1", - "query": "sum:all.cost{providername:OpenAI,$api_key,$ml_app,$service,$model,$project} by {servicename}", - "aggregator": "sum" - } - ], - "style": { - "palette": "datadog16" - }, - "sort": { - "count": 500, - "order_by": [ - { - "type": "formula", - "index": 0, - "order": "desc" - } - ] - } - } - ], - "type": "sunburst", - "legend": { - "type": "table" - } + "type": "timeseries", + "requests": [{ + "formulas": [{ + "formula": "query1" + }], + "queries": [{ + "data_source": "cloud_cost", + "name": "query1", + "query": "sum:all.cost{providername:OpenAI,$api_key,$ml_app,$service,$model,$project} by {servicename}.rollup(sum, daily)" + }], + "response_format": "timeseries", + "style": { + "palette": "datadog16", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" }, - "layout": { - "x": 3, - "y": 3, - "width": 9, - "height": 4 - } + "display_type": "bars" + }] + }, + "layout": { + "x": 0, + "y": 7, + "width": 12, + "height": 3 + } + }, { + "id": 7084921580361980, + "definition": { + "title": "Cost by Organization and Project", + "title_size": "16", + "title_align": "left", + "time": { + "type": "live", + "unit": "month", + "value": 1, + "hide_incomplete_cost_data": true }, - { - "id": 4968678189694062, - "definition": { - "title": "Cost Changes Over Time by ServiceName", - "title_size": "16", - "title_align": "left", - "show_legend": false, - "legend_layout": "auto", - "legend_columns": [ - "avg", - "min", - "max", - "value", - "sum" - ], - "time": { - "type": "live", - "unit": "month", - "value": 1, - "hide_incomplete_cost_data": true - }, - "type": "timeseries", - "requests": [ - { - "formulas": [ - { - "formula": "query1" - } - ], - "queries": [ - { - "data_source": "cloud_cost", - "name": "query1", - "query": "sum:all.cost{providername:OpenAI,$api_key,$ml_app,$service,$model,$project} by {servicename}.rollup(sum, 86400)" - } - ], - "response_format": "timeseries", - "style": { - "palette": "datadog16", - "order_by": "values", - "line_type": "solid", - "line_width": "normal" - }, - "display_type": "bars" - } - ] - }, - "layout": { - "x": 0, - "y": 7, - "width": 12, - "height": 3 + "type": "toplist", + "requests": [{ + "queries": [{ + "data_source": "cloud_cost", + "name": "query1", + "query": "sum:all.cost{providername:OpenAI,$api_key,$ml_app,$service,$model,$project} by {organization_name,project_name}", + "aggregator": "sum" + }], + "response_format": "scalar", + "formulas": [{ + "formula": "query1" + }], + "sort": { + "count": 500, + "order_by": [{ + "type": "formula", + "index": 0, + "order": "desc" + }] } - }, - { - "id": 7084921580361980, - "definition": { - "title": "Cost by Organization and Project", - "title_size": "16", - "title_align": "left", - "time": { - "type": "live", - "unit": "month", - "value": 1, - "hide_incomplete_cost_data": true - }, - "type": "toplist", - "requests": [ - { - "queries": [ - { - "data_source": "cloud_cost", - "name": "query1", - "query": "sum:all.cost{providername:OpenAI,$api_key,$ml_app,$service,$model,$project} by {organization_name,project_name}", - "aggregator": "sum" - } - ], - "response_format": "scalar", - "formulas": [ - { - "formula": "query1" - } - ], - "sort": { - "count": 500, - "order_by": [ - { - "type": "formula", - "index": 0, - "order": "desc" - } - ] - } - } - ], - "style": { - "display": { - "type": "stacked", - "legend": "automatic" - }, - "palette": "datadog16" - } + }], + "style": { + "display": { + "type": "stacked", + "legend": "automatic" }, - "layout": { - "x": 0, - "y": 10, - "width": 5, - "height": 3 - } + "palette": "datadog16" + } + }, + "layout": { + "x": 0, + "y": 10, + "width": 5, + "height": 3 + } + }, { + "id": 2890013906934278, + "definition": { + "title": "Project Costs Over Time", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": ["avg", "min", "max", "value", "sum"], + "time": { + "type": "live", + "unit": "month", + "value": 1, + "hide_incomplete_cost_data": true }, - { - "id": 2890013906934278, - "definition": { - "title": "Project Costs Over Time", - "title_size": "16", - "title_align": "left", - "show_legend": true, - "legend_layout": "auto", - "legend_columns": [ - "avg", - "min", - "max", - "value", - "sum" - ], - "time": { - "type": "live", - "unit": "month", - "value": 1, - "hide_incomplete_cost_data": true - }, - "type": "timeseries", - "requests": [ - { - "formulas": [ - { - "alias": "Total Cost", - "formula": "query1" - } - ], - "queries": [ - { - "data_source": "cloud_cost", - "name": "query1", - "query": "sum:all.cost{providername:OpenAI,$api_key,$ml_app,$service,$model,$project} by {project_name}.rollup(sum, 86400)" - } - ], - "response_format": "timeseries", - "style": { - "palette": "dog_classic", - "order_by": "values", - "line_type": "solid", - "line_width": "normal" - }, - "display_type": "bars" - } - ] + "type": "timeseries", + "requests": [{ + "formulas": [{ + "alias": "Total Cost", + "formula": "query1" + }], + "queries": [{ + "data_source": "cloud_cost", + "name": "query1", + "query": "sum:all.cost{providername:OpenAI,$api_key,$ml_app,$service,$model,$project} by {project_name}.rollup(sum, daily)" + }], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" }, - "layout": { - "x": 5, - "y": 10, - "width": 7, - "height": 3 - } - } - ] - }, - "layout": { - "x": 0, - "y": 3, - "width": 12, - "height": 14 - } + "display_type": "bars" + }] + }, + "layout": { + "x": 5, + "y": 10, + "width": 7, + "height": 3 + } + }] }, - { - "id": 2162071155995882, - "definition": { - "title": "OpenAI Integration (API)", - "background_color": "vivid_blue", - "show_title": true, - "type": "group", - "layout_type": "ordered", - "widgets": [ - { - "id": 6603322518845350, - "definition": { - "type": "note", - "content": "Set up the **free** [API part](https://app.datadoghq.com/integrations/openai?search=OpenAI) of the [OpenAI general integration](https://docs.datadoghq.com/integrations/openai/?tab=python) to see data in this section. Dive deeper in [OpenAI Usage Overview](https://app.datadoghq.com/dash/integration/31040/openai-usage-overview). Widgets are focused on GPT costs.", - "background_color": "blue", - "font_size": "14", - "text_align": "center", - "vertical_align": "center", - "show_tick": false, - "tick_pos": "50%", - "tick_edge": "left", - "has_padding": true - }, - "layout": { - "x": 0, - "y": 0, - "width": 12, - "height": 1 - } + "layout": { + "x": 0, + "y": 3, + "width": 12, + "height": 14 + } + }, { + "id": 2162071155995882, + "definition": { + "title": "OpenAI Integration (API)", + "background_color": "vivid_blue", + "show_title": true, + "type": "group", + "layout_type": "ordered", + "widgets": [{ + "id": 6603322518845350, + "definition": { + "type": "note", + "content": "Set up the **free** [API part](https://app.datadoghq.com/integrations/openai?search=OpenAI) of the [OpenAI general integration](https://docs.datadoghq.com/integrations/openai/?tab=python) to see data in this section. Dive deeper in [OpenAI Usage Overview](https://app.datadoghq.com/dash/integration/31040/openai-usage-overview). Widgets are focused on GPT costs.", + "background_color": "blue", + "font_size": "14", + "text_align": "center", + "vertical_align": "center", + "show_tick": false, + "tick_pos": "50%", + "tick_edge": "left", + "has_padding": true + }, + "layout": { + "x": 0, + "y": 0, + "width": 12, + "height": 1 + } + }, { + "id": 7450240655684922, + "definition": { + "title": "Cost per Model", + "title_size": "16", + "title_align": "left", + "time": { + "type": "live", + "unit": "month", + "value": 1, + "hide_incomplete_cost_data": true }, - { - "id": 7450240655684922, - "definition": { - "title": "Cost per Model", - "title_size": "16", - "title_align": "left", - "time": { - "type": "live", - "unit": "month", - "value": 1, - "hide_incomplete_cost_data": true - }, - "type": "toplist", - "requests": [ - { - "queries": [ - { - "data_source": "cloud_cost", - "name": "query2", - "query": "sum:custom.cost.amortized{providername:OpenAI,servicename:*gpt*,$api_key,$ml_app,$service,$model,$project}.rollup(sum, 86400)", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query3", - "query": "sum:openai.api.usage.n_context_tokens_total{$api_key,$ml_app,$service,$model,$project} by {model}", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query4", - "query": "sum:openai.api.usage.n_generated_tokens_total{$api_key,$ml_app,$service,$model,$project} by {model}", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query1", - "query": "sum:openai.api.usage.n_context_tokens_total{$api_key,$ml_app,$service,$model,$project}", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query5", - "query": "sum:openai.api.usage.n_generated_tokens_total{$api_key,$ml_app,$service,$model,$project}", - "aggregator": "sum" - } - ], - "response_format": "scalar", - "formulas": [ - { - "formula": "query2 * (query3 + query4) / (query1 + query5)" - } - ], - "sort": { - "count": 500, - "order_by": [ - { - "type": "formula", - "index": 0, - "order": "desc" - } - ] - } - } - ], - "style": { - "display": { - "type": "stacked", - "legend": "automatic" - } - } - }, - "layout": { - "x": 0, - "y": 1, - "width": 6, - "height": 3 + "type": "toplist", + "requests": [{ + "queries": [{ + "data_source": "cloud_cost", + "name": "query2", + "query": "sum:custom.cost.amortized{providername:OpenAI,servicename:*gpt*,$api_key,$ml_app,$service,$model,$project}.rollup(sum, daily)", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query3", + "query": "sum:openai.api.usage.n_context_tokens_total{$api_key,$ml_app,$service,$model,$project} by {model}", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query4", + "query": "sum:openai.api.usage.n_generated_tokens_total{$api_key,$ml_app,$service,$model,$project} by {model}", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query1", + "query": "sum:openai.api.usage.n_context_tokens_total{$api_key,$ml_app,$service,$model,$project}", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query5", + "query": "sum:openai.api.usage.n_generated_tokens_total{$api_key,$ml_app,$service,$model,$project}", + "aggregator": "sum" + }], + "response_format": "scalar", + "formulas": [{ + "formula": "query2 * (query3 + query4) / (query1 + query5)" + }], + "sort": { + "count": 500, + "order_by": [{ + "type": "formula", + "index": 0, + "order": "desc" + }] } - }, - { - "id": 2146480474569892, - "definition": { - "title": "Cost per Operation", - "title_size": "16", - "title_align": "left", - "time": { - "type": "live", - "unit": "month", - "value": 1, - "hide_incomplete_cost_data": true - }, - "requests": [ - { - "formulas": [ - { - "number_format": { - "unit": { - "type": "canonical_unit", - "unit_name": "dollar" - } - }, - "formula": "query2 * (query3 + query4) / (query1 + query5)" - } - ], - "queries": [ - { - "data_source": "cloud_cost", - "name": "query2", - "query": "sum:custom.cost.amortized{providername:OpenAI,servicename:*gpt*,$api_key,$ml_app,$service,$model,$project}.rollup(sum, 86400)", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query3", - "query": "sum:openai.api.usage.n_context_tokens_total{$api_key,$ml_app,$service,$model,$project} by {operation}", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query4", - "query": "sum:openai.api.usage.n_generated_tokens_total{$api_key,$ml_app,$service,$model,$project} by {operation}", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query1", - "query": "sum:openai.api.usage.n_context_tokens_total{$api_key,$ml_app,$service,$model,$project}", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query5", - "query": "sum:openai.api.usage.n_generated_tokens_total{$api_key,$ml_app,$service,$model,$project}", - "aggregator": "sum" - } - ], - "response_format": "scalar", - "sort": { - "count": 500, - "order_by": [ - { - "type": "formula", - "index": 0, - "order": "desc" - } - ] - }, - "style": { - "palette": "datadog16" - } - } - ], - "type": "sunburst", - "legend": { - "type": "automatic" - } - }, - "layout": { - "x": 6, - "y": 1, - "width": 6, - "height": 3 + }], + "style": { + "display": { + "type": "stacked", + "legend": "automatic" } + } + }, + "layout": { + "x": 0, + "y": 1, + "width": 6, + "height": 3 + } + }, { + "id": 2146480474569892, + "definition": { + "title": "Cost per Operation", + "title_size": "16", + "title_align": "left", + "time": { + "type": "live", + "unit": "month", + "value": 1, + "hide_incomplete_cost_data": true }, - { - "id": 92163252088124, - "definition": { - "title": "Cost per Token ", - "title_size": "16", - "title_align": "left", - "time": { - "type": "live", - "unit": "month", - "value": 1, - "hide_incomplete_cost_data": true - }, - "type": "query_value", - "requests": [ - { - "formulas": [ - { - "number_format": { - "unit": { - "type": "canonical_unit", - "unit_name": "dollar" - }, - "unit_scale": { - "type": "canonical_unit", - "unit_name": "dollar" - } - }, - "formula": "(query2 / (query1 + query5))" - } - ], - "queries": [ - { - "data_source": "cloud_cost", - "name": "query2", - "query": "sum:custom.cost.amortized{providername:OpenAI,servicename:*gpt*,$api_key,$ml_app,$service,$model,$project}.rollup(sum, 86400)", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query1", - "query": "sum:openai.api.usage.n_context_tokens_total{$api_key,$ml_app,$service,$model,$project}", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query5", - "query": "sum:openai.api.usage.n_generated_tokens_total{$api_key,$ml_app,$service,$model,$project}", - "aggregator": "avg" - } - ], - "response_format": "scalar" - } - ], - "autoscale": false, - "precision": 2 + "requests": [{ + "queries": [{ + "data_source": "cloud_cost", + "name": "query2", + "query": "sum:custom.cost.amortized{providername:OpenAI,servicename:*gpt*,$api_key,$ml_app,$service,$model,$project}.rollup(sum, daily)", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query3", + "query": "sum:openai.api.usage.n_context_tokens_total{$api_key,$ml_app,$service,$model,$project} by {operation}", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query4", + "query": "sum:openai.api.usage.n_generated_tokens_total{$api_key,$ml_app,$service,$model,$project} by {operation}", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query1", + "query": "sum:openai.api.usage.n_context_tokens_total{$api_key,$ml_app,$service,$model,$project}", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query5", + "query": "sum:openai.api.usage.n_generated_tokens_total{$api_key,$ml_app,$service,$model,$project}", + "aggregator": "sum" + }], + "response_format": "scalar", + "style": { + "palette": "datadog16" }, - "layout": { - "x": 0, - "y": 4, - "width": 6, - "height": 2 - } - }, - { - "id": 2871269133729220, - "definition": { - "title": "# Input Tokens", - "title_size": "16", - "title_align": "left", - "type": "query_value", - "requests": [ - { - "formulas": [ - { - "formula": "query5" - } - ], - "queries": [ - { - "data_source": "metrics", - "name": "query5", - "query": "sum:openai.api.usage.n_context_tokens_total{$api_key,$ml_app,$service,$model,$project}", - "aggregator": "avg" - } - ], - "response_format": "scalar" + "formulas": [{ + "number_format": { + "unit": { + "type": "canonical_unit", + "unit_name": "dollar" } - ], - "autoscale": true, - "precision": 2 - }, - "layout": { - "x": 6, - "y": 4, - "width": 3, - "height": 2 + }, + "formula": "query2 * (query3 + query4) / (query1 + query5)" + }], + "sort": { + "count": 500, + "order_by": [{ + "type": "formula", + "index": 0, + "order": "desc" + }] } + }], + "type": "sunburst", + "legend": { + "type": "automatic" + } + }, + "layout": { + "x": 6, + "y": 1, + "width": 6, + "height": 3 + } + }, { + "id": 92163252088124, + "definition": { + "title": "Cost per Token ", + "title_size": "16", + "title_align": "left", + "time": { + "type": "live", + "unit": "month", + "value": 1, + "hide_incomplete_cost_data": true }, - { - "id": 5960580251979426, - "definition": { - "title": "# Output Tokens", - "title_size": "16", - "title_align": "left", - "type": "query_value", - "requests": [ - { - "formulas": [ - { - "formula": "query5" - } - ], - "queries": [ - { - "data_source": "metrics", - "name": "query5", - "query": "sum:openai.api.usage.n_generated_tokens_total{$api_key,$ml_app,$service,$model,$project}", - "aggregator": "avg" - } - ], - "response_format": "scalar" + "type": "query_value", + "requests": [{ + "formulas": [{ + "number_format": { + "unit": { + "type": "canonical_unit", + "unit_name": "dollar" + }, + "unit_scale": { + "type": "canonical_unit", + "unit_name": "dollar" } - ], - "autoscale": true, - "precision": 2 - }, - "layout": { - "x": 9, - "y": 4, - "width": 3, - "height": 2 - } - } - ] - }, - "layout": { - "x": 0, - "y": 17, - "width": 12, - "height": 7 - } + }, + "formula": "(query2 / (query1 + query5))" + }], + "queries": [{ + "data_source": "cloud_cost", + "name": "query2", + "query": "sum:custom.cost.amortized{providername:OpenAI,servicename:*gpt*,$api_key,$ml_app,$service,$model,$project}.rollup(sum, daily)", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query1", + "query": "sum:openai.api.usage.n_context_tokens_total{$api_key,$ml_app,$service,$model,$project}", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query5", + "query": "sum:openai.api.usage.n_generated_tokens_total{$api_key,$ml_app,$service,$model,$project}", + "aggregator": "avg" + }], + "response_format": "scalar" + }], + "autoscale": false, + "precision": 2 + }, + "layout": { + "x": 0, + "y": 4, + "width": 6, + "height": 2 + } + }, { + "id": 2871269133729220, + "definition": { + "title": "# Input Tokens", + "title_size": "16", + "title_align": "left", + "type": "query_value", + "requests": [{ + "formulas": [{ + "formula": "query5" + }], + "queries": [{ + "data_source": "metrics", + "name": "query5", + "query": "sum:openai.api.usage.n_context_tokens_total{$api_key,$ml_app,$service,$model,$project}", + "aggregator": "avg" + }], + "response_format": "scalar" + }], + "autoscale": true, + "precision": 2 + }, + "layout": { + "x": 6, + "y": 4, + "width": 3, + "height": 2 + } + }, { + "id": 5960580251979426, + "definition": { + "title": "# Output Tokens", + "title_size": "16", + "title_align": "left", + "type": "query_value", + "requests": [{ + "formulas": [{ + "formula": "query5" + }], + "queries": [{ + "data_source": "metrics", + "name": "query5", + "query": "sum:openai.api.usage.n_generated_tokens_total{$api_key,$ml_app,$service,$model,$project}", + "aggregator": "avg" + }], + "response_format": "scalar" + }], + "autoscale": true, + "precision": 2 + }, + "layout": { + "x": 9, + "y": 4, + "width": 3, + "height": 2 + } + }] }, - { - "id": 8181163626805416, - "definition": { - "title": "LLM Observability ", - "background_color": "vivid_purple", - "show_title": true, - "type": "group", - "layout_type": "ordered", - "widgets": [ - { - "id": 7136039305405288, - "definition": { - "type": "image", - "url": "/static/images/integration_dashboard/llm-observability_hero-1.jpeg", - "sizing": "cover", - "has_background": true, - "has_border": true, - "vertical_align": "center", - "horizontal_align": "center" - }, - "layout": { - "x": 0, - "y": 0, - "width": 4, - "height": 1 - } + "layout": { + "x": 0, + "y": 17, + "width": 12, + "height": 7 + } + }, { + "id": 8181163626805416, + "definition": { + "title": "LLM Observability ", + "background_color": "vivid_purple", + "show_title": true, + "type": "group", + "layout_type": "ordered", + "widgets": [{ + "id": 7136039305405288, + "definition": { + "type": "image", + "url": "/static/images/integration_dashboard/llm-observability_hero-1.jpeg", + "sizing": "cover", + "has_background": true, + "has_border": true, + "vertical_align": "center", + "horizontal_align": "center" + }, + "layout": { + "x": 0, + "y": 0, + "width": 4, + "height": 1 + } + }, { + "id": 3520544867910278, + "definition": { + "type": "note", + "content": "Please [set up](https://docs.datadoghq.com/llm_observability/) LLM Observability to see data in this section. With [LLM Observability](https://app.datadoghq.com/llm/traces), you can monitor, troubleshoot, and evaluate your LLM-powered applications. ", + "background_color": "purple", + "font_size": "14", + "text_align": "center", + "vertical_align": "center", + "show_tick": false, + "tick_pos": "50%", + "tick_edge": "left", + "has_padding": true + }, + "layout": { + "x": 4, + "y": 0, + "width": 8, + "height": 1 + } + }, { + "id": 2767009516392116, + "definition": { + "title": "Cost per ML App", + "title_size": "16", + "title_align": "left", + "time": { + "type": "live", + "unit": "month", + "value": 1, + "hide_incomplete_cost_data": true }, - { - "id": 3520544867910278, - "definition": { - "type": "note", - "content": "Please [set up](https://docs.datadoghq.com/llm_observability/) LLM Observability to see data in this section. With [LLM Observability](https://app.datadoghq.com/llm/traces), you can monitor, troubleshoot, and evaluate your LLM-powered applications. ", - "background_color": "purple", - "font_size": "14", - "text_align": "center", - "vertical_align": "center", - "show_tick": false, - "tick_pos": "50%", - "tick_edge": "left", - "has_padding": true + "requests": [{ + "queries": [{ + "data_source": "cloud_cost", + "name": "query2", + "query": "sum:custom.cost.amortized{providername:OpenAI,servicename:*gpt*,$api_key,$ml_app,$service,$model,$project}.rollup(sum, daily)", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query3", + "query": "sum:ml_obs.span.llm.input.tokens{$api_key,$ml_app,$service,$model,$project} by {ml_app}.as_count()", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query4", + "query": "sum:ml_obs.span.llm.output.tokens{$api_key,$ml_app,$service,$model,$project} by {ml_app}.as_count()", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query1", + "query": "sum:ml_obs.span.llm.input.tokens{$api_key,$ml_app,$service,$model,$project}.as_count()", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query5", + "query": "sum:ml_obs.span.llm.output.tokens{$api_key,$ml_app,$service,$model,$project}.as_count()", + "aggregator": "sum" + }], + "response_format": "scalar", + "style": { + "palette": "datadog16" }, - "layout": { - "x": 4, - "y": 0, - "width": 8, - "height": 1 - } - }, - { - "id": 2767009516392116, - "definition": { - "title": "Cost per ML App", - "title_size": "16", - "title_align": "left", - "time": { - "type": "live", - "unit": "month", - "value": 1, - "hide_incomplete_cost_data": true - }, - "requests": [ - { - "formulas": [ - { - "formula": "query2 * (query3 + query4) / (query1 + query5)", - "number_format": { - "unit": { - "type": "canonical_unit", - "unit_name": "dollar" - } - } - } - ], - "queries": [ - { - "data_source": "cloud_cost", - "name": "query2", - "query": "sum:custom.cost.amortized{providername:OpenAI,servicename:*gpt*,$api_key,$ml_app,$service,$model,$project}.rollup(sum, 86400)", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query3", - "query": "sum:ml_obs.span.llm.input.tokens{$api_key,$ml_app,$service,$model,$project} by {ml_app}.as_count()", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query4", - "query": "sum:ml_obs.span.llm.output.tokens{$api_key,$ml_app,$service,$model,$project} by {ml_app}.as_count()", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query1", - "query": "sum:ml_obs.span.llm.input.tokens{$api_key,$ml_app,$service,$model,$project}.as_count()", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query5", - "query": "sum:ml_obs.span.llm.output.tokens{$api_key,$ml_app,$service,$model,$project}.as_count()", - "aggregator": "sum" - } - ], - "response_format": "scalar", - "sort": { - "count": 500, - "order_by": [ - { - "type": "formula", - "index": 0, - "order": "desc" - } - ] - }, - "style": { - "palette": "datadog16" - } + "formulas": [{ + "number_format": { + "unit": { + "type": "canonical_unit", + "unit_name": "dollar" } - ], - "type": "sunburst", - "legend": { - "type": "automatic" - } - }, - "layout": { - "x": 0, - "y": 1, - "width": 4, - "height": 3 + }, + "formula": "query2 * (query3 + query4) / (query1 + query5)" + }], + "sort": { + "count": 500, + "order_by": [{ + "type": "formula", + "index": 0, + "order": "desc" + }] } + }], + "type": "sunburst", + "legend": { + "type": "automatic" + } + }, + "layout": { + "x": 0, + "y": 1, + "width": 4, + "height": 3 + } + }, { + "id": 650790161525400, + "definition": { + "title": "Cost per ML App Over Time", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": ["avg", "min", "max", "value", "sum"], + "time": { + "type": "live", + "unit": "month", + "value": 1, + "hide_incomplete_cost_data": true }, - { - "id": 650790161525400, - "definition": { - "title": "Cost per ML App Over Time", - "title_size": "16", - "title_align": "left", - "show_legend": true, - "legend_layout": "auto", - "legend_columns": [ - "avg", - "min", - "max", - "value", - "sum" - ], - "time": { - "type": "live", - "unit": "month", - "value": 1, - "hide_incomplete_cost_data": true - }, - "type": "timeseries", - "requests": [ - { - "formulas": [ - { - "formula": "query2 * (query3 + query4) / (query1 + query5)", - "number_format": { - "unit": { - "type": "canonical_unit", - "unit_name": "dollar" - } - } - } - ], - "queries": [ - { - "data_source": "cloud_cost", - "name": "query2", - "query": "sum:custom.cost.amortized{providername:OpenAI,servicename:*gpt*,$api_key,$ml_app,$service,$model,$project}.rollup(sum, 86400)" - }, - { - "data_source": "metrics", - "name": "query3", - "query": "sum:ml_obs.span.llm.input.tokens{$api_key,$ml_app,$service,$model,$project} by {ml_app}.as_count()" - }, - { - "data_source": "metrics", - "name": "query4", - "query": "sum:ml_obs.span.llm.output.tokens{$api_key,$ml_app,$service,$model,$project} by {ml_app}.as_count()" - }, - { - "data_source": "metrics", - "name": "query1", - "query": "sum:ml_obs.span.llm.input.tokens{$api_key,$ml_app,$service,$model,$project}.as_count()" - }, - { - "data_source": "metrics", - "name": "query5", - "query": "sum:ml_obs.span.llm.output.tokens{$api_key,$ml_app,$service,$model,$project}.as_count()" - } - ], - "response_format": "timeseries", - "style": { - "palette": "datadog16", - "order_by": "values", - "line_type": "solid", - "line_width": "normal" - }, - "display_type": "bars" + "type": "timeseries", + "requests": [{ + "formulas": [{ + "number_format": { + "unit": { + "type": "canonical_unit", + "unit_name": "dollar" } - ] + }, + "formula": "query2 * (query3 + query4) / (query1 + query5)" + }], + "queries": [{ + "data_source": "cloud_cost", + "name": "query2", + "query": "sum:custom.cost.amortized{providername:OpenAI,servicename:*gpt*,$api_key,$ml_app,$service,$model,$project}.rollup(sum, daily)" + }, { + "data_source": "metrics", + "name": "query3", + "query": "sum:ml_obs.span.llm.input.tokens{$api_key,$ml_app,$service,$model,$project} by {ml_app}.as_count()" + }, { + "data_source": "metrics", + "name": "query4", + "query": "sum:ml_obs.span.llm.output.tokens{$api_key,$ml_app,$service,$model,$project} by {ml_app}.as_count()" + }, { + "data_source": "metrics", + "name": "query1", + "query": "sum:ml_obs.span.llm.input.tokens{$api_key,$ml_app,$service,$model,$project}.as_count()" + }, { + "data_source": "metrics", + "name": "query5", + "query": "sum:ml_obs.span.llm.output.tokens{$api_key,$ml_app,$service,$model,$project}.as_count()" + }], + "response_format": "timeseries", + "style": { + "palette": "datadog16", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" }, - "layout": { - "x": 4, - "y": 1, - "width": 8, - "height": 3 - } + "display_type": "bars" + }] + }, + "layout": { + "x": 4, + "y": 1, + "width": 8, + "height": 3 + } + }, { + "id": 1463818413200384, + "definition": { + "title": "Cost per Service", + "title_size": "16", + "title_align": "left", + "time": { + "type": "live", + "unit": "month", + "value": 1, + "hide_incomplete_cost_data": true }, - { - "id": 1463818413200384, - "definition": { - "title": "Cost per Service", - "title_size": "16", - "title_align": "left", - "time": { - "type": "live", - "unit": "month", - "value": 1, - "hide_incomplete_cost_data": true - }, - "type": "toplist", - "requests": [ - { - "queries": [ - { - "data_source": "cloud_cost", - "name": "query2", - "query": "sum:custom.cost.amortized{providername:OpenAI,servicename:*gpt*,$api_key,$ml_app,$service,$model,$project}.rollup(sum, 86400)", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query3", - "query": "sum:ml_obs.span.llm.input.tokens{$api_key,$ml_app,$service,$model,$project} by {service}.as_count()", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query4", - "query": "sum:ml_obs.span.llm.output.tokens{$api_key,$ml_app,$service,$model,$project} by {service}.as_count()", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query1", - "query": "sum:ml_obs.span.llm.input.tokens{$api_key,$ml_app,$service,$model,$project}.as_count()", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query5", - "query": "sum:ml_obs.span.llm.output.tokens{$api_key,$ml_app,$service,$model,$project}.as_count()", - "aggregator": "sum" - } - ], - "response_format": "scalar", - "formulas": [ - { - "formula": "query2 * (query3 + query4) / (query1 + query5)", - "number_format": { - "unit": { - "type": "canonical_unit", - "unit_name": "dollar" - } - } - } - ], - "sort": { - "count": 500, - "order_by": [ - { - "type": "formula", - "index": 0, - "order": "desc" - } - ] - } + "type": "toplist", + "requests": [{ + "queries": [{ + "data_source": "cloud_cost", + "name": "query2", + "query": "sum:custom.cost.amortized{providername:OpenAI,servicename:*gpt*,$api_key,$ml_app,$service,$model,$project}.rollup(sum, daily)", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query3", + "query": "sum:ml_obs.span.llm.input.tokens{$api_key,$ml_app,$service,$model,$project} by {service}.as_count()", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query4", + "query": "sum:ml_obs.span.llm.output.tokens{$api_key,$ml_app,$service,$model,$project} by {service}.as_count()", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query1", + "query": "sum:ml_obs.span.llm.input.tokens{$api_key,$ml_app,$service,$model,$project}.as_count()", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query5", + "query": "sum:ml_obs.span.llm.output.tokens{$api_key,$ml_app,$service,$model,$project}.as_count()", + "aggregator": "sum" + }], + "response_format": "scalar", + "formulas": [{ + "number_format": { + "unit": { + "type": "canonical_unit", + "unit_name": "dollar" } - ], - "style": { - "display": { - "type": "stacked", - "legend": "automatic" - }, - "palette": "datadog16" - } - }, - "layout": { - "x": 0, - "y": 4, - "width": 6, - "height": 3 + }, + "formula": "query2 * (query3 + query4) / (query1 + query5)" + }], + "sort": { + "count": 500, + "order_by": [{ + "type": "formula", + "index": 0, + "order": "desc" + }] } + }], + "style": { + "display": { + "type": "stacked", + "legend": "automatic" + }, + "palette": "datadog16" + } + }, + "layout": { + "x": 0, + "y": 4, + "width": 6, + "height": 3 + } + }, { + "id": 1324979932092638, + "definition": { + "title": "Cost per Env", + "title_size": "16", + "title_align": "left", + "time": { + "type": "live", + "unit": "month", + "value": 1, + "hide_incomplete_cost_data": true }, - { - "id": 1324979932092638, - "definition": { - "title": "Cost per Env", - "title_size": "16", - "title_align": "left", - "time": { - "type": "live", - "unit": "month", - "value": 1, - "hide_incomplete_cost_data": true - }, - "type": "toplist", - "requests": [ - { - "queries": [ - { - "data_source": "cloud_cost", - "name": "query2", - "query": "sum:custom.cost.amortized{providername:OpenAI,servicename:*GPT*,$api_key,$ml_app,$service,$model,$project}.rollup(sum, 86400)", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query3", - "query": "sum:ml_obs.span.llm.input.tokens{$api_key,$ml_app,$service,$model,$project} by {env}.as_count()", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query4", - "query": "sum:ml_obs.span.llm.output.tokens{$api_key,$ml_app,$service,$model,$project} by {env}.as_count()", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query1", - "query": "sum:ml_obs.span.llm.input.tokens{$api_key,$ml_app,$service,$model,$project}.as_count()", - "aggregator": "sum" - }, - { - "data_source": "metrics", - "name": "query5", - "query": "sum:ml_obs.span.llm.output.tokens{$api_key,$ml_app,$service,$model,$project}.as_count()", - "aggregator": "sum" - } - ], - "response_format": "scalar", - "formulas": [ - { - "formula": "query2 * (query3 + query4) / (query1 + query5)", - "number_format": { - "unit": { - "type": "canonical_unit", - "unit_name": "dollar" - } - } - } - ], - "sort": { - "count": 500, - "order_by": [ - { - "type": "formula", - "index": 0, - "order": "desc" - } - ] - } + "type": "toplist", + "requests": [{ + "queries": [{ + "data_source": "cloud_cost", + "name": "query2", + "query": "sum:custom.cost.amortized{providername:OpenAI,servicename:*GPT*,$api_key,$ml_app,$service,$model,$project}.rollup(sum, daily)", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query3", + "query": "sum:ml_obs.span.llm.input.tokens{$api_key,$ml_app,$service,$model,$project} by {env}.as_count()", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query4", + "query": "sum:ml_obs.span.llm.output.tokens{$api_key,$ml_app,$service,$model,$project} by {env}.as_count()", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query1", + "query": "sum:ml_obs.span.llm.input.tokens{$api_key,$ml_app,$service,$model,$project}.as_count()", + "aggregator": "sum" + }, { + "data_source": "metrics", + "name": "query5", + "query": "sum:ml_obs.span.llm.output.tokens{$api_key,$ml_app,$service,$model,$project}.as_count()", + "aggregator": "sum" + }], + "response_format": "scalar", + "formulas": [{ + "number_format": { + "unit": { + "type": "canonical_unit", + "unit_name": "dollar" } - ], - "style": { - "display": { - "type": "stacked", - "legend": "automatic" - }, - "palette": "datadog16" - } - }, - "layout": { - "x": 6, - "y": 4, - "width": 6, - "height": 3 + }, + "formula": "query2 * (query3 + query4) / (query1 + query5)" + }], + "sort": { + "count": 500, + "order_by": [{ + "type": "formula", + "index": 0, + "order": "desc" + }] } + }], + "style": { + "display": { + "type": "stacked", + "legend": "automatic" + }, + "palette": "datadog16" } - ] - }, - "layout": { - "x": 0, - "y": 24, - "width": 12, - "height": 8 - } - } - ], - "template_variables": [ - { - "name": "project", - "prefix": "project", - "available_values": [], - "default": "*" - }, - { - "name": "model", - "prefix": "model", - "available_values": [], - "default": "*" - }, - { - "name": "service", - "prefix": "service", - "available_values": [], - "default": "*" - }, - { - "name": "ml_app", - "prefix": "ml_app", - "available_values": [], - "default": "*" + }, + "layout": { + "x": 6, + "y": 4, + "width": 6, + "height": 3 + } + }] }, - { - "name": "api_key", - "prefix": "api_key", - "available_values": [], - "default": "*" + "layout": { + "x": 0, + "y": 24, + "width": 12, + "height": 8 } - ], + }], + "template_variables": [{ + "name": "project", + "prefix": "project", + "available_values": [], + "default": "*" + }, { + "name": "model", + "prefix": "model", + "available_values": [], + "default": "*" + }, { + "name": "service", + "prefix": "service", + "available_values": [], + "default": "*" + }, { + "name": "ml_app", + "prefix": "ml_app", + "available_values": [], + "default": "*" + }, { + "name": "api_key", + "prefix": "api_key", + "available_values": [], + "default": "*" + }], "layout_type": "ordered", "notify_list": [], "reflow_type": "fixed"