Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing optional field env in DORA API endpoints #1841

Merged
merged 3 commits into from
Jan 19, 2024
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": "2024-01-19 15:18:14.559252",
"spec_repo_commit": "b407748b"
"regenerated": "2024-01-19 16:05:44.924100",
"spec_repo_commit": "20461e26"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-01-19 15:18:14.573971",
"spec_repo_commit": "b407748b"
"regenerated": "2024-01-19 16:05:44.937783",
"spec_repo_commit": "20461e26"
}
}
}
8 changes: 8 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4930,6 +4930,10 @@ components:
DORADeploymentRequestAttributes:
description: Attributes to create a DORA deployment event.
properties:
env:
description: Environment name to where the service was deployed.
example: staging
type: string
finished_at:
description: Unix timestamp in nanoseconds when the deployment finished.
It should not be older than 3 hours.
Expand Down Expand Up @@ -5018,6 +5022,10 @@ components:
DORAIncidentRequestAttributes:
description: Attributes to create a DORA incident event.
properties:
env:
description: Environment name that was impacted by the incident.
example: staging
type: string
finished_at:
description: Unix timestamp in nanoseconds when the incident finished. It
should not be older than 3 hours.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def openapi_types(_):
from datadog_api_client.v2.model.dora_git_info import DORAGitInfo

return {
"env": (str,),
"finished_at": (int,),
"git": (DORAGitInfo,),
"id": (str,),
Expand All @@ -32,6 +33,7 @@ def openapi_types(_):
}

attribute_map = {
"env": "env",
"finished_at": "finished_at",
"git": "git",
"id": "id",
Expand All @@ -45,6 +47,7 @@ def __init__(
finished_at: int,
service: str,
started_at: int,
env: Union[str, UnsetType] = unset,
git: Union[DORAGitInfo, UnsetType] = unset,
id: Union[str, UnsetType] = unset,
version: Union[str, UnsetType] = unset,
Expand All @@ -53,6 +56,9 @@ def __init__(
"""
Attributes to create a DORA deployment event.

:param env: Environment name to where the service was deployed.
:type env: str, optional

:param finished_at: Unix timestamp in nanoseconds when the deployment finished. It should not be older than 3 hours.
:type finished_at: int

Expand All @@ -71,6 +77,8 @@ def __init__(
:param version: Version to correlate with `APM Deployment Tracking <https://docs.datadoghq.com/tracing/services/deployment_tracking/>`_.
:type version: str, optional
"""
if env is not unset:
kwargs["env"] = env
if git is not unset:
kwargs["git"] = git
if id is not unset:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def openapi_types(_):
from datadog_api_client.v2.model.dora_git_info import DORAGitInfo

return {
"env": (str,),
"finished_at": (int,),
"git": (DORAGitInfo,),
"id": (str,),
Expand All @@ -34,6 +35,7 @@ def openapi_types(_):
}

attribute_map = {
"env": "env",
"finished_at": "finished_at",
"git": "git",
"id": "id",
Expand All @@ -48,6 +50,7 @@ def __init__(
self_,
service: str,
started_at: int,
env: Union[str, UnsetType] = unset,
finished_at: Union[int, UnsetType] = unset,
git: Union[DORAGitInfo, UnsetType] = unset,
id: Union[str, UnsetType] = unset,
Expand All @@ -59,6 +62,9 @@ def __init__(
"""
Attributes to create a DORA incident event.

:param env: Environment name that was impacted by the incident.
:type env: str, optional

:param finished_at: Unix timestamp in nanoseconds when the incident finished. It should not be older than 3 hours.
:type finished_at: int, optional

Expand All @@ -83,6 +89,8 @@ def __init__(
:param version: Version to correlate with `APM Deployment Tracking <https://docs.datadoghq.com/tracing/services/deployment_tracking/>`_.
:type version: str, optional
"""
if env is not unset:
kwargs["env"] = env
if finished_at is not unset:
kwargs["finished_at"] = finished_at
if git is not unset:
Expand Down
2 changes: 1 addition & 1 deletion tests/v2/features/dora_metrics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Feature: DORA Metrics
Scenario: Send an incident event for DORA Metrics returns "OK - but delayed due to incident" response
Given operation "CreateDORAIncident" enabled
And new "CreateDORAIncident" request
And body with value {"data": {"attributes": {"finished_at": 1693491984000000000, "git": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_url": "https://github.com/organization/example-repository"}, "name": "Webserver is down failing all requests", "service": "shopist", "severity": "High", "started_at": 1693491974000000000, "version": "v1.12.07"}}}
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", "service": "shopist", "severity": "High", "started_at": 1693491974000000000, "version": "v1.12.07"}}}
When the request is sent
Then the response status is 202 OK - but delayed due to incident

Expand Down
Loading