Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 161 additions & 3 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76024,6 +76024,45 @@ components:
required:
- data
type: object
IssueSnoozeRequest:
description: Snooze issue request payload.
properties:
data:
$ref: "#/components/schemas/IssueSnoozeRequestData"
required:
- data
type: object
IssueSnoozeRequestData:
description: Snooze issue request.
properties:
attributes:
$ref: "#/components/schemas/IssueSnoozeRequestDataAttributes"
id:
description: Issue identifier.
example: "c1726a66-1f64-11ee-b338-da7ad0900002"
type: string
type:
$ref: "#/components/schemas/IssueSnoozeRequestDataType"
required:
- id
- type
- attributes
type: object
IssueSnoozeRequestDataAttributes:
description: Object describing an issue snooze request.
properties:
condition:
$ref: "#/components/schemas/IssueWatchCondition"
required:
- condition
type: object
IssueSnoozeRequestDataType:
description: Type of the object.
enum: ["error_tracking_issue"]
example: "error_tracking_issue"
type: string
x-enum-varnames:
- ERROR_TRACKING_ISSUE
IssueState:
description: State of the issue
enum:
Expand Down Expand Up @@ -76288,26 +76327,39 @@ components:
`ELAPSED_TIME` uses `duration`, and `ANY` and `ALL` use `operands`.
properties:
duration:
description: Time that must elapse before the condition is met, as a Go duration string.
description: |-
Time that must elapse from when the watch started, as a Go duration string, such as `24h`, or `168h` for a
week.
example: "168h0m0s"
type: string
kind:
$ref: "#/components/schemas/IssueWatchConditionKind"
operands:
description: Nested conditions combined by `ANY` or `ALL`.
example:
- duration: 168h
kind: ELAPSED_TIME
- kind: OCCURRENCES
threshold: 100
items:
$ref: "#/components/schemas/IssueWatchCondition"
type: array
projection:
description: Attributes whose distinct values are counted for `CARDINALITY`.
description: |-
Attributes whose distinct values `CARDINALITY` counts, in search syntax: `@` for attributes, such as
`@usr.id` or `@account.id`, and no prefix for tags and reserved fields, such as `org_id` or `service`.
Only use attributes that the issue's errors carry: a condition on an attribute they don't carry is never
met.
example: ["@usr.id"]
items:
description: Attribute path.
example: "@usr.id"
type: string
type: array
threshold:
description: Number of occurrences, or of distinct values for `CARDINALITY`, that triggers the condition.
description: |-
Number of new occurrences, or of distinct values for `CARDINALITY`, that meets the condition, counted from
when the watch started.
example: 100
format: int64
type: integer
Expand Down Expand Up @@ -182656,6 +182708,112 @@ paths:
- Error Tracking
x-unstable: |-
**Note**: This endpoint is in preview and is subject to change.
/api/v2/error-tracking/issues/{issue_id}/snooze:
post:
description: |-
Snooze an issue by `issue_id`: move it to `IGNORED` until a condition is met, then back to `OPEN`.
The condition can be a number of occurrences, a number of distinct values of an attribute such as `@usr.id`,
an elapsed time, or any or all of several conditions.
Snoozing an issue that is already snoozed replaces its snooze. Updating the state of the issue with
`UpdateIssueState` cancels the snooze.
The response includes the watch that reopens the issue.
operationId: SnoozeIssue
parameters:
- $ref: "#/components/parameters/IssueIDPathParameter"
requestBody:
content:
application/json:
examples:
default:
value:
data:
attributes:
condition:
kind: ANY
operands:
- duration: 168h
kind: ELAPSED_TIME
- kind: OCCURRENCES
threshold: 100
id: c1726a66-1f64-11ee-b338-da7ad0900002
type: error_tracking_issue
schema:
$ref: "#/components/schemas/IssueSnoozeRequest"
description: Snooze issue request payload.
required: true
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
attributes:
error_message: "object of type 'NoneType' has no len()"
error_type: builtins.TypeError
service: test-service
state: IGNORED
id: c1726a66-1f64-11ee-b338-da7ad0900002
relationships:
watches:
data:
- id: e7a1c3b5-2d4f-4a6b-8c9d-0e1f2a3b4c5d
type: error_tracking_issue_watch
type: issue
included:
- attributes:
action:
from: IGNORED
kind: CHANGE_ISSUE_STATE
to: OPEN
condition:
kind: ANY
operands:
- duration: 168h0m0s
kind: ELAPSED_TIME
- kind: OCCURRENCES
threshold: 100
started_at: "2025-01-01T00:00:00Z"
status: ACTIVE
id: e7a1c3b5-2d4f-4a6b-8c9d-0e1f2a3b4c5d
type: error_tracking_issue_watch
schema:
$ref: "#/components/schemas/IssueResponse"
description: OK
"400":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Bad Request
"401":
$ref: "#/components/responses/UnauthorizedResponse"
"403":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Forbidden
"404":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Not Found
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- error_tracking_read
- error_tracking_write
summary: Snooze an issue
tags:
- Error Tracking
x-unstable: |-
**Note**: This endpoint is in preview and is subject to change.
/api/v2/error-tracking/issues/{issue_id}/state:
put:
description: Update the state of an issue by `issue_id`. Use this endpoint to move an issue between states such as `OPEN`, `RESOLVED`, or `IGNORED`.
Expand Down
25 changes: 25 additions & 0 deletions examples/v2/error-tracking/SnoozeIssue.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Snooze an issue returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
config.unstable_operations["v2.snooze_issue".to_sym] = true
end
api_instance = DatadogAPIClient::V2::ErrorTrackingAPI.new

# there is a valid "issue" in the system
ISSUE_ID = ENV["ISSUE_ID"]

body = DatadogAPIClient::V2::IssueSnoozeRequest.new({
data: DatadogAPIClient::V2::IssueSnoozeRequestData.new({
attributes: DatadogAPIClient::V2::IssueSnoozeRequestDataAttributes.new({
condition: DatadogAPIClient::V2::IssueWatchCondition.new({
kind: DatadogAPIClient::V2::IssueWatchConditionKind::ELAPSED_TIME,
duration: "168h",
}),
}),
id: ISSUE_ID,
type: DatadogAPIClient::V2::IssueSnoozeRequestDataType::ERROR_TRACKING_ISSUE,
}),
})
p api_instance.snooze_issue(ISSUE_ID, body)
4 changes: 4 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3821,6 +3821,10 @@
"filter_from" => "Integer",
"filter_to" => "Integer",
},
"v2.SnoozeIssue" => {
"issue_id" => "String",
"body" => "IssueSnoozeRequest",
},
"v2.UpdateIssueState" => {
"issue_id" => "String",
"body" => "IssueUpdateStateRequest",
Expand Down
32 changes: 32 additions & 0 deletions features/v2/error_tracking.feature
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,38 @@ Feature: Error Tracking
When the request is sent
Then the response status is 200 OK

@skip @team:ddoghq/error-tracking
Scenario: Snooze an issue returns "Bad Request" response
Given operation "SnoozeIssue" enabled
And new "SnoozeIssue" request
And there is a valid "issue" in the system
And request contains "issue_id" parameter from "issue.id"
And body with value {"data": {"attributes": {"condition": {"kind": "OCCURRENCES"}}, "id": "{{ issue.id }}", "type": "error_tracking_issue"}}
When the request is sent
Then the response status is 400 Bad Request

@skip @team:ddoghq/error-tracking
Scenario: Snooze an issue returns "Not Found" response
Given operation "SnoozeIssue" enabled
And new "SnoozeIssue" request
And request contains "issue_id" parameter with value "67d80aa3-36ff-44b9-a694-c501a7591737"
And body with value {"data": {"attributes": {"condition": {"kind": "ELAPSED_TIME", "duration": "168h"}}, "id": "67d80aa3-36ff-44b9-a694-c501a7591737", "type": "error_tracking_issue"}}
When the request is sent
Then the response status is 404 Not Found

@skip @team:ddoghq/error-tracking
Scenario: Snooze an issue returns "OK" response
Given operation "SnoozeIssue" enabled
And new "SnoozeIssue" request
And there is a valid "issue" in the system
And request contains "issue_id" parameter from "issue.id"
And body with value {"data": {"attributes": {"condition": {"kind": "ELAPSED_TIME", "duration": "168h"}}, "id": "{{ issue.id }}", "type": "error_tracking_issue"}}
When the request is sent
Then the response status is 200 OK
And the response "data.id" is equal to "{{ issue.id }}"
And the response "data.attributes.state" is equal to "IGNORED"
And the response "data.relationships" has field "watches"

@team:ddoghq/error-tracking
Scenario: Update the assignee of an issue returns "Bad Request" response
Given new "UpdateIssueAssignee" request
Expand Down
17 changes: 17 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2789,6 +2789,23 @@
"type": "safe"
}
},
"SnoozeIssue": {
"tag": "Error Tracking",
"undo": {
"operationId": "UpdateIssueState",
"parameters": [
{
"name": "issue_id",
"source": "data.id"
},
{
"name": "body",
"template": "{\"data\": {\"type\": \"error_tracking_issue\", \"id\": \"{{ data.id }}\", \"attributes\": {\"state\": \"OPEN\"}}}"
}
],
"type": "unsafe"
}
},
"UpdateIssueState": {
"tag": "Error Tracking",
"undo": {
Expand Down
1 change: 1 addition & 0 deletions lib/datadog_api_client/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ def initialize
"v2.update_deployment_gate": false,
"v2.update_deployment_rule": false,
"v2.get_issue_impact": false,
"v2.snooze_issue": false,
"v2.get_eudm_device": false,
"v2.get_eudm_devices": false,
"v2.clone_form": false,
Expand Down
4 changes: 4 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5410,6 +5410,10 @@ def overrides
"v2.issue_samples_relationship" => "IssueSamplesRelationship",
"v2.issue_sample_stack_frame" => "IssueSampleStackFrame",
"v2.issue_sample_type" => "IssueSampleType",
"v2.issue_snooze_request" => "IssueSnoozeRequest",
"v2.issue_snooze_request_data" => "IssueSnoozeRequestData",
"v2.issue_snooze_request_data_attributes" => "IssueSnoozeRequestDataAttributes",
"v2.issue_snooze_request_data_type" => "IssueSnoozeRequestDataType",
"v2.issues_search_request" => "IssuesSearchRequest",
"v2.issues_search_request_data" => "IssuesSearchRequestData",
"v2.issues_search_request_data_attributes" => "IssuesSearchRequestDataAttributes",
Expand Down
Loading
Loading