diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 7e53bd7654..39454b02d9 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -10153,6 +10153,7 @@ components: - "data-quality alert" - "network-path alert" - "data-jobs alert" + - "llm-observability alert" example: "query alert" type: string x-enum-varnames: @@ -10178,6 +10179,7 @@ components: - DATA_QUALITY_ALERT - NETWORK_PATH_ALERT - DATA_JOBS_ALERT + - LLM_OBSERVABILITY_ALERT MonitorUpdateRequest: description: Object describing a monitor update request. properties: diff --git a/examples/v1/monitors/CreateMonitor_1348801712.py b/examples/v1/monitors/CreateMonitor_1348801712.py new file mode 100644 index 0000000000..3ac188c6d6 --- /dev/null +++ b/examples/v1/monitors/CreateMonitor_1348801712.py @@ -0,0 +1,35 @@ +""" +Create an LLM Observability monitor returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v1.api.monitors_api import MonitorsApi +from datadog_api_client.v1.model.monitor import Monitor +from datadog_api_client.v1.model.monitor_options import MonitorOptions +from datadog_api_client.v1.model.monitor_thresholds import MonitorThresholds +from datadog_api_client.v1.model.monitor_type import MonitorType + +body = Monitor( + name="Example-Monitor", + type=MonitorType.LLM_OBSERVABILITY_ALERT, + query='llm-observability("*").rollup("count").last("2h") > 0', + message="LLM observability alert triggered", + tags=[ + "test:examplemonitor", + "env:ci", + ], + options=MonitorOptions( + thresholds=MonitorThresholds( + critical=0.0, + ), + include_tags=True, + notify_audit=False, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = MonitorsApi(api_client) + response = api_instance.create_monitor(body=body) + + print(response) diff --git a/src/datadog_api_client/v1/model/monitor_type.py b/src/datadog_api_client/v1/model/monitor_type.py index a7683ef1c6..ed4f12837f 100644 --- a/src/datadog_api_client/v1/model/monitor_type.py +++ b/src/datadog_api_client/v1/model/monitor_type.py @@ -16,7 +16,7 @@ class MonitorType(ModelSimple): """ The type of the monitor. For more information about `type`, see the [monitor options](https://docs.datadoghq.com/monitors/guide/monitor_api_options/) docs. - :param value: Must be one of ["composite", "event alert", "log alert", "metric alert", "process alert", "query alert", "rum alert", "service check", "synthetics alert", "trace-analytics alert", "slo alert", "event-v2 alert", "audit alert", "ci-pipelines alert", "ci-tests alert", "error-tracking alert", "database-monitoring alert", "network-performance alert", "cost alert", "data-quality alert", "network-path alert", "data-jobs alert"]. + :param value: Must be one of ["composite", "event alert", "log alert", "metric alert", "process alert", "query alert", "rum alert", "service check", "synthetics alert", "trace-analytics alert", "slo alert", "event-v2 alert", "audit alert", "ci-pipelines alert", "ci-tests alert", "error-tracking alert", "database-monitoring alert", "network-performance alert", "cost alert", "data-quality alert", "network-path alert", "data-jobs alert", "llm-observability alert"]. :type value: str """ @@ -43,6 +43,7 @@ class MonitorType(ModelSimple): "data-quality alert", "network-path alert", "data-jobs alert", + "llm-observability alert", } COMPOSITE: ClassVar["MonitorType"] EVENT_ALERT: ClassVar["MonitorType"] @@ -66,6 +67,7 @@ class MonitorType(ModelSimple): DATA_QUALITY_ALERT: ClassVar["MonitorType"] NETWORK_PATH_ALERT: ClassVar["MonitorType"] DATA_JOBS_ALERT: ClassVar["MonitorType"] + LLM_OBSERVABILITY_ALERT: ClassVar["MonitorType"] @cached_property def openapi_types(_): @@ -96,3 +98,4 @@ def openapi_types(_): MonitorType.DATA_QUALITY_ALERT = MonitorType("data-quality alert") MonitorType.NETWORK_PATH_ALERT = MonitorType("network-path alert") MonitorType.DATA_JOBS_ALERT = MonitorType("data-jobs alert") +MonitorType.LLM_OBSERVABILITY_ALERT = MonitorType("llm-observability alert") diff --git a/tests/v1/cassettes/test_scenarios/test_create_an_llm_observability_monitor_returns_ok_response.frozen b/tests/v1/cassettes/test_scenarios/test_create_an_llm_observability_monitor_returns_ok_response.frozen new file mode 100644 index 0000000000..f869233356 --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_an_llm_observability_monitor_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-08-11T15:01:12.326Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_an_llm_observability_monitor_returns_ok_response.yaml b/tests/v1/cassettes/test_scenarios/test_create_an_llm_observability_monitor_returns_ok_response.yaml new file mode 100644 index 0000000000..435047b6d0 --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_an_llm_observability_monitor_returns_ok_response.yaml @@ -0,0 +1,45 @@ +interactions: +- request: + body: '{"message":"LLM observability alert triggered","name":"Test-Create_an_LLM_Observability_monitor_returns_OK_response-1786460472","options":{"include_tags":true,"notify_audit":false,"thresholds":{"critical":0}},"query":"llm-observability(\"*\").rollup(\"count\").last(\"2h\") + > 0","tags":["test:testcreateanllmobservabilitymonitorreturnsokresponse1786460472","env:ci"],"type":"llm-observability + alert"}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/monitor + response: + body: + string: '{"id":312833678,"org_id":321813,"type":"llm-observability alert","name":"Test-Create_an_LLM_Observability_monitor_returns_OK_response-1786460472","message":"LLM + observability alert triggered","tags":["test:testcreateanllmobservabilitymonitorreturnsokresponse1786460472","env:ci"],"query":"llm-observability(\"*\").rollup(\"count\").last(\"2h\") + > 0","options":{"include_tags":true,"notify_audit":false,"thresholds":{"critical":0.0},"notify_no_data":false,"new_host_delay":300,"groupby_simple_monitor":false,"silenced":{}},"multi":false,"created_at":1786460473000,"created":"2026-08-11T15:01:13.078330+00:00","modified":"2026-08-11T15:01:13.078330+00:00","deleted":null,"priority":null,"restricted_roles":null,"restriction_policy":null,"draft_status":"published","assets":[],"overall_state_modified":null,"overall_state":"No + Data","creator":{"name":"Francesco Pighi","handle":"francesco.pighi@datadoghq.com","email":"francesco.pighi@datadoghq.com","id":21235577}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/monitor/312833678 + response: + body: + string: '{"deleted_monitor_id":312833678} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v1/features/monitors.feature b/tests/v1/features/monitors.feature index 49f446a95a..9fc73243c7 100644 --- a/tests/v1/features/monitors.feature +++ b/tests/v1/features/monitors.feature @@ -202,6 +202,15 @@ Feature: Monitors And the response "query" is equal to "error-tracking-rum(\"service:foo AND @error.source:source\").rollup(\"count\").by(\"@issue.id\").last(\"1h\") >= 1" And the response "draft_status" is equal to "draft" + @team:DataDog/monitor-app + Scenario: Create an LLM Observability monitor returns "OK" response + Given new "CreateMonitor" request + And body with value {"name": "{{ unique }}", "type": "llm-observability alert", "query": "llm-observability(\"*\").rollup(\"count\").last(\"2h\") > 0", "message": "LLM observability alert triggered", "tags": ["test:{{ unique_lower_alnum }}", "env:ci"], "options": {"thresholds": {"critical": 0}, "include_tags": true, "notify_audit": false}} + When the request is sent + Then the response status is 200 OK + And the response "name" is equal to "{{ unique }}" + And the response "type" is equal to "llm-observability alert" + @generated @skip @team:DataDog/monitor-app Scenario: Delete a monitor returns "Bad Request" response Given new "DeleteMonitor" request