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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-06-13 19:38:19.691417",
"spec_repo_commit": "6eb36f2b"
"regenerated": "2025-06-16 08:24:57.259638",
"spec_repo_commit": "b2c4e7e8"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-06-13 19:38:19.708710",
"spec_repo_commit": "6eb36f2b"
"regenerated": "2025-06-16 08:24:57.275017",
"spec_repo_commit": "b2c4e7e8"
}
}
}
15 changes: 15 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11095,6 +11095,17 @@ components:
- version
- name
type: object
DORACustomTags:
description: A list of user-defined tags. The tags must follow the `key:value`
pattern. Up to 100 may be added per event.
example:
- language:java
- department:engineering
items:
description: Tags in the form of `key:value`.
type: string
nullable: true
type: array
DORADeploymentRequest:
description: Request to create a DORA deployment event.
properties:
Expand All @@ -11106,6 +11117,8 @@ components:
DORADeploymentRequestAttributes:
description: Attributes to create a DORA deployment event.
properties:
custom_tags:
$ref: '#/components/schemas/DORACustomTags'
env:
description: Environment name to where the service was deployed.
example: staging
Expand Down Expand Up @@ -11208,6 +11221,8 @@ components:
DORAFailureRequestAttributes:
description: Attributes to create a DORA failure event.
properties:
custom_tags:
$ref: '#/components/schemas/DORACustomTags'
env:
description: Environment name that was impacted by the failure.
example: staging
Expand Down
4 changes: 4 additions & 0 deletions examples/v2/dora-metrics/CreateDORAFailure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
body = DatadogAPIClient::V2::DORAFailureRequest.new({
data: DatadogAPIClient::V2::DORAFailureRequestData.new({
attributes: DatadogAPIClient::V2::DORAFailureRequestAttributes.new({
custom_tags: [
"language:java",
"department:engineering",
],
env: "staging",
finished_at: 1693491984000000000,
git: DatadogAPIClient::V2::DORAGitInfo.new({
Expand Down
4 changes: 4 additions & 0 deletions examples/v2/dora-metrics/CreateDORAIncident.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
body = DatadogAPIClient::V2::DORAFailureRequest.new({
data: DatadogAPIClient::V2::DORAFailureRequestData.new({
attributes: DatadogAPIClient::V2::DORAFailureRequestAttributes.new({
custom_tags: [
"language:java",
"department:engineering",
],
env: "staging",
finished_at: 1693491984000000000,
git: DatadogAPIClient::V2::DORAGitInfo.new({
Expand Down
10 changes: 5 additions & 5 deletions features/v2/dora_metrics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Feature: DORA Metrics
@generated @skip @team:DataDog/ci-app-backend
Scenario: Send a deployment event for DORA Metrics returns "OK - but delayed due to incident" response
Given new "CreateDORADeployment" request
And body with value {"data": {"attributes": {"env": "staging", "finished_at": 1693491984000000000, "git": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_url": "https://github.com/organization/example-repository"}, "service": "shopist", "started_at": 1693491974000000000, "team": "backend", "version": "v1.12.07"}}}
And body with value {"data": {"attributes": {"custom_tags": ["language:java", "department:engineering"], "env": "staging", "finished_at": 1693491984000000000, "git": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_url": "https://github.com/organization/example-repository"}, "service": "shopist", "started_at": 1693491974000000000, "team": "backend", "version": "v1.12.07"}}}
When the request is sent
Then the response status is 202 OK - but delayed due to incident

Expand All @@ -100,7 +100,7 @@ Feature: DORA Metrics
@generated @skip @team:DataDog/ci-app-backend
Scenario: Send a failure event for DORA Metrics returns "OK - but delayed due to incident" response
Given new "CreateDORAFailure" request
And body with value {"data": {"attributes": {"env": "staging", "finished_at": 1693491984000000000, "git": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_url": "https://github.com/organization/example-repository"}, "name": "Webserver is down failing all requests.", "services": ["shopist"], "severity": "High", "started_at": 1693491974000000000, "team": "backend", "version": "v1.12.07"}}}
And body with value {"data": {"attributes": {"custom_tags": ["language:java", "department:engineering"], "env": "staging", "finished_at": 1693491984000000000, "git": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_url": "https://github.com/organization/example-repository"}, "name": "Webserver is down failing all requests.", "services": ["shopist"], "severity": "High", "started_at": 1693491974000000000, "team": "backend", "version": "v1.12.07"}}}
When the request is sent
Then the response status is 202 OK - but delayed due to incident

Expand All @@ -114,20 +114,20 @@ Feature: DORA Metrics
@generated @skip @team:DataDog/ci-app-backend
Scenario: Send an incident event for DORA Metrics returns "Bad Request" response
Given new "CreateDORAIncident" request
And body with value {"data": {"attributes": {"env": "staging", "finished_at": 1693491984000000000, "git": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_url": "https://github.com/organization/example-repository"}, "name": "Webserver is down failing all requests.", "services": ["shopist"], "severity": "High", "started_at": 1693491974000000000, "team": "backend", "version": "v1.12.07"}}}
And body with value {"data": {"attributes": {"custom_tags": ["language:java", "department:engineering"], "env": "staging", "finished_at": 1693491984000000000, "git": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_url": "https://github.com/organization/example-repository"}, "name": "Webserver is down failing all requests.", "services": ["shopist"], "severity": "High", "started_at": 1693491974000000000, "team": "backend", "version": "v1.12.07"}}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/ci-app-backend
Scenario: Send an incident event for DORA Metrics returns "OK - but delayed due to incident" response
Given new "CreateDORAIncident" request
And body with value {"data": {"attributes": {"env": "staging", "finished_at": 1693491984000000000, "git": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_url": "https://github.com/organization/example-repository"}, "name": "Webserver is down failing all requests.", "services": ["shopist"], "severity": "High", "started_at": 1693491974000000000, "team": "backend", "version": "v1.12.07"}}}
And body with value {"data": {"attributes": {"custom_tags": ["language:java", "department:engineering"], "env": "staging", "finished_at": 1693491984000000000, "git": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_url": "https://github.com/organization/example-repository"}, "name": "Webserver is down failing all requests.", "services": ["shopist"], "severity": "High", "started_at": 1693491974000000000, "team": "backend", "version": "v1.12.07"}}}
When the request is sent
Then the response status is 202 OK - but delayed due to incident

@generated @skip @team:DataDog/ci-app-backend
Scenario: Send an incident event for DORA Metrics returns "OK" response
Given new "CreateDORAIncident" request
And body with value {"data": {"attributes": {"env": "staging", "finished_at": 1693491984000000000, "git": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_url": "https://github.com/organization/example-repository"}, "name": "Webserver is down failing all requests.", "services": ["shopist"], "severity": "High", "started_at": 1693491974000000000, "team": "backend", "version": "v1.12.07"}}}
And body with value {"data": {"attributes": {"custom_tags": ["language:java", "department:engineering"], "env": "staging", "finished_at": 1693491984000000000, "git": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_url": "https://github.com/organization/example-repository"}, "name": "Webserver is down failing all requests.", "services": ["shopist"], "severity": "High", "started_at": 1693491974000000000, "team": "backend", "version": "v1.12.07"}}}
When the request is sent
Then the response status is 200 OK
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module DatadogAPIClient::V2
class DORADeploymentRequestAttributes
include BaseGenericModel

# A list of user-defined tags. The tags must follow the `key:value` pattern. Up to 100 may be added per event.
attr_accessor :custom_tags

# Environment name to where the service was deployed.
attr_accessor :env

Expand Down Expand Up @@ -51,6 +54,7 @@ class DORADeploymentRequestAttributes
# @!visibility private
def self.attribute_map
{
:'custom_tags' => :'custom_tags',
:'env' => :'env',
:'finished_at' => :'finished_at',
:'git' => :'git',
Expand All @@ -66,6 +70,7 @@ def self.attribute_map
# @!visibility private
def self.openapi_types
{
:'custom_tags' => :'Array<String>',
:'env' => :'String',
:'finished_at' => :'Integer',
:'git' => :'DORAGitInfo',
Expand All @@ -77,6 +82,14 @@ def self.openapi_types
}
end

# List of attributes with nullable: true
# @!visibility private
def self.openapi_nullable
Set.new([
:'custom_tags',
])
end

# Initializes the object
# @param attributes [Hash] Model attributes in the form of hash
# @!visibility private
Expand All @@ -95,6 +108,12 @@ def initialize(attributes = {})
end
}

if attributes.key?(:'custom_tags')
if (value = attributes[:'custom_tags']).is_a?(Array)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Quality Violation

Consider using Array() to ensure the type is that of an array (...read more)

The rule "Use Array() to ensure your variable is an array" is important for ensuring your code behaves as expected, regardless of the type of data it receives. It is common in Ruby to need to iterate through an array of items. However, if the variable is not an array, this can lead to unexpected behavior or errors.

The Array() method in Ruby is a Kernel method that converts its argument to an Array. If the argument is already an Array, it returns the argument. If the argument is nil, it returns an empty Array. This can be used to ensure that a variable is an array before trying to iterate over it, preventing potential errors or unexpected behavior.

By using Array(foos), you can ensure that foos is an array before you try to iterate over it with each. This prevents the need to check if foos is an array with foos.is_a?(Array) and makes your code cleaner and easier to understand.

View in Datadog  Leave us feedback  Documentation

self.custom_tags = value
end
end

if attributes.key?(:'env')
self.env = attributes[:'env']
end
Expand Down Expand Up @@ -194,6 +213,7 @@ def to_hash
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
custom_tags == o.custom_tags &&
env == o.env &&
finished_at == o.finished_at &&
git == o.git &&
Expand All @@ -209,7 +229,7 @@ def ==(o)
# @return [Integer] Hash code
# @!visibility private
def hash
[env, finished_at, git, id, service, started_at, team, version, additional_properties].hash
[custom_tags, env, finished_at, git, id, service, started_at, team, version, additional_properties].hash
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module DatadogAPIClient::V2
class DORAFailureRequestAttributes
include BaseGenericModel

# A list of user-defined tags. The tags must follow the `key:value` pattern. Up to 100 may be added per event.
attr_accessor :custom_tags

# Environment name that was impacted by the failure.
attr_accessor :env

Expand Down Expand Up @@ -57,6 +60,7 @@ class DORAFailureRequestAttributes
# @!visibility private
def self.attribute_map
{
:'custom_tags' => :'custom_tags',
:'env' => :'env',
:'finished_at' => :'finished_at',
:'git' => :'git',
Expand All @@ -74,6 +78,7 @@ def self.attribute_map
# @!visibility private
def self.openapi_types
{
:'custom_tags' => :'Array<String>',
:'env' => :'String',
:'finished_at' => :'Integer',
:'git' => :'DORAGitInfo',
Expand All @@ -87,6 +92,14 @@ def self.openapi_types
}
end

# List of attributes with nullable: true
# @!visibility private
def self.openapi_nullable
Set.new([
:'custom_tags',
])
end

# Initializes the object
# @param attributes [Hash] Model attributes in the form of hash
# @!visibility private
Expand All @@ -105,6 +118,12 @@ def initialize(attributes = {})
end
}

if attributes.key?(:'custom_tags')
if (value = attributes[:'custom_tags']).is_a?(Array)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Quality Violation

Consider using Array() to ensure the type is that of an array (...read more)

The rule "Use Array() to ensure your variable is an array" is important for ensuring your code behaves as expected, regardless of the type of data it receives. It is common in Ruby to need to iterate through an array of items. However, if the variable is not an array, this can lead to unexpected behavior or errors.

The Array() method in Ruby is a Kernel method that converts its argument to an Array. If the argument is already an Array, it returns the argument. If the argument is nil, it returns an empty Array. This can be used to ensure that a variable is an array before trying to iterate over it, preventing potential errors or unexpected behavior.

By using Array(foos), you can ensure that foos is an array before you try to iterate over it with each. This prevents the need to check if foos is an array with foos.is_a?(Array) and makes your code cleaner and easier to understand.

View in Datadog  Leave us feedback  Documentation

self.custom_tags = value
end
end

if attributes.key?(:'env')
self.env = attributes[:'env']
end
Expand Down Expand Up @@ -192,6 +211,7 @@ def to_hash
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
custom_tags == o.custom_tags &&
env == o.env &&
finished_at == o.finished_at &&
git == o.git &&
Expand All @@ -209,7 +229,7 @@ def ==(o)
# @return [Integer] Hash code
# @!visibility private
def hash
[env, finished_at, git, id, name, services, severity, started_at, team, version, additional_properties].hash
[custom_tags, env, finished_at, git, id, name, services, severity, started_at, team, version, additional_properties].hash
end
end
end
Loading