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

Adding SLO Reporting API Documentation #50

Merged
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-04-08 20:24:02.356402",
"spec_repo_commit": "037e376a"
"regenerated": "2024-04-09 18:05:58.525342",
"spec_repo_commit": "fc718bc2"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-04-08 20:24:02.377503",
"spec_repo_commit": "037e376a"
"regenerated": "2024-04-09 18:05:58.544180",
"spec_repo_commit": "fc718bc2"
}
}
}
277 changes: 277 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,13 @@ components:
required: true
schema:
type: string
ReportID:
description: The ID of the report job.
in: path
name: report_id
required: true
schema:
type: string
ResourceID:
description: 'Identifier, formatted as `type:id`. Supported types: `connection`,
`dashboard`, `notebook`, `security-rule`, `slo`.'
Expand Down Expand Up @@ -16574,6 +16581,74 @@ components:
type: string
x-enum-varnames:
- SAML_ASSERTION_ATTRIBUTES
SLOReportInterval:
description: The frequency at which report data is to be generated.
enum:
- weekly
- monthly
example: weekly
type: string
x-enum-varnames:
- WEEKLY
- MONTHLY
SLOReportPostResponse:
description: The SLO report response.
properties:
data:
$ref: '#/components/schemas/SLOReportPostResponseData'
type: object
SLOReportPostResponseData:
description: The data portion of the SLO report response.
properties:
id:
description: The ID of the report job.
example: dc8d92aa-e0af-11ee-af21-1feeaccaa3a3
type: string
type:
description: The type of ID.
example: report_id
type: string
type: object
SLOReportStatus:
description: The status of the SLO report job.
enum:
- in_progress
- completed
- completed_with_errors
- failed
example: completed
type: string
x-enum-varnames:
- IN_PROGRESS
- COMPLETED
- COMPLETED_WITH_ERRORS
- FAILED
SLOReportStatusGetResponse:
description: The SLO report status response.
properties:
data:
$ref: '#/components/schemas/SLOReportStatusGetResponseData'
type: object
SLOReportStatusGetResponseAttributes:
description: The attributes portion of the SLO report status response.
properties:
status:
$ref: '#/components/schemas/SLOReportStatus'
type: object
SLOReportStatusGetResponseData:
description: The data portion of the SLO report status response.
properties:
attributes:
$ref: '#/components/schemas/SLOReportStatusGetResponseAttributes'
id:
description: The ID of the report job.
example: dc8d92aa-e0af-11ee-af21-1feeaccaa3a3
type: string
type:
description: The type of ID.
example: report_id
type: string
type: object
ScalarColumn:
description: A single column in a scalar query response.
oneOf:
Expand Down Expand Up @@ -20216,6 +20291,53 @@ components:
- channel_name
- redirect_url
type: object
SloReportCreateRequest:
description: The SLO report request body.
properties:
data:
$ref: '#/components/schemas/SloReportCreateRequestData'
required:
- data
type: object
SloReportCreateRequestAttributes:
description: The attributes portion of the SLO report request.
properties:
from_ts:
description: The `from` timestamp for the report in epoch seconds.
example: 1690901870
format: int64
type: integer
interval:
$ref: '#/components/schemas/SLOReportInterval'
query:
description: The query string used to filter SLO results. Some examples
of queries include `service:<service-name>` and `slo-name`.
example: slo_type:metric
type: string
timezone:
description: The timezone used to determine the start and end of each interval.
For example, weekly intervals start at 12am on Sunday in the specified
timezone.
example: America/New_York
type: string
to_ts:
description: The `to` timestamp for the report in epoch seconds.
example: 1706803070
format: int64
type: integer
required:
- query
- from_ts
- to_ts
type: object
SloReportCreateRequestData:
description: The data portion of the SLO report request.
properties:
attributes:
$ref: '#/components/schemas/SloReportCreateRequestAttributes'
required:
- attributes
type: object
SortDirection:
default: desc
description: The direction to sort by.
Expand Down Expand Up @@ -33715,6 +33837,149 @@ paths:
- Incident Services
x-codegen-request-body-name: body
x-unstable: '**Note**: This endpoint is deprecated.'
/api/v2/slo/report:
post:
description: 'Create a job to generate an SLO report. The report job is processed
asynchronously and eventually results in a CSV report being available for
download.


Check the status of the job and download the CSV report using the returned
`report_id`.'
operationId: CreateSLOReportJob
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SloReportCreateRequest'
description: Create SLO report job request body.
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/SLOReportPostResponse'
description: OK
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Bad Request
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Forbidden
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- slos_read
summary: Create a new SLO report
tags:
- Service Level Objectives
x-codegen-request-body-name: body
x-unstable: '**Note**: This feature is in private beta. To request access, use
the request access form in the [Service Level Objectives](https://docs.datadoghq.com/service_management/service_level_objectives/#slo-csv-export)
docs.'
/api/v2/slo/report/{report_id}/download:
get:
description: 'Download an SLO report. This can only be performed after the report
job has completed.


Reports are not guaranteed to exist indefinitely. Datadog recommends that
you download the report as soon as it is available.'
operationId: GetSLOReport
parameters:
- $ref: '#/components/parameters/ReportID'
responses:
'200':
content:
text/csv:
schema:
type: string
description: OK
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Bad Request
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Not Found
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- slos_read
summary: Get SLO report
tags:
- Service Level Objectives
x-unstable: '**Note**: This feature is in private beta. To request access, use
the request access form in the [Service Level Objectives](https://docs.datadoghq.com/service_management/service_level_objectives/#slo-csv-export)
docs.'
/api/v2/slo/report/{report_id}/status:
get:
description: Get the status of the SLO report job.
operationId: GetSLOReportJobStatus
parameters:
- $ref: '#/components/parameters/ReportID'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/SLOReportStatusGetResponse'
description: OK
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Bad Request
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Not Found
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- slos_read
summary: Get SLO report status
tags:
- Service Level Objectives
x-unstable: '**Note**: This feature is in private beta. To request access, use
the request access form in the [Service Level Objectives](https://docs.datadoghq.com/service_management/service_level_objectives/#slo-csv-export)
docs.'
/api/v2/spans/analytics/aggregate:
post:
description: 'The API endpoint to aggregate spans into buckets and compute metrics
Expand Down Expand Up @@ -36129,6 +36394,18 @@ tags:
externalDocs:
url: https://docs.datadoghq.com/tracing/service_catalog/
name: Service Definition
- description: '[Service Level Objectives](https://docs.datadoghq.com/monitors/service_level_objectives/#configuration)

(SLOs) are a key part of the site reliability engineering toolkit.

SLOs provide a framework for defining clear targets around application performance,

which ultimately help teams provide a consistent customer experience,

balance feature development with platform stability,

and improve communication with internal and external users.'
name: Service Level Objectives
- description: 'API to create, update scorecard rules and outcomes. See [Service Scorecards](https://docs.datadoghq.com/service_catalog/scorecards)
for more information.

Expand Down
29 changes: 29 additions & 0 deletions examples/v2_service-level-objectives_create_slo_report_job.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Create a new SLO report returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_service_level_objectives::ServiceLevelObjectivesAPI;
use datadog_api_client::datadogV2::model::SLOReportInterval;
use datadog_api_client::datadogV2::model::SloReportCreateRequest;
use datadog_api_client::datadogV2::model::SloReportCreateRequestAttributes;
use datadog_api_client::datadogV2::model::SloReportCreateRequestData;

#[tokio::main]
async fn main() {
let body = SloReportCreateRequest::new(SloReportCreateRequestData::new(
SloReportCreateRequestAttributes::new(
1690901870,
r#"slo_type:metric "SLO Reporting Test""#.to_string(),
1706803070,
)
.interval(SLOReportInterval::MONTHLY)
.timezone("America/New_York".to_string()),
));
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.CreateSLOReportJob", true);
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api.create_slo_report_job(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
18 changes: 18 additions & 0 deletions examples/v2_service-level-objectives_get_slo_report.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Get SLO report returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_service_level_objectives::ServiceLevelObjectivesAPI;

#[tokio::main]
async fn main() {
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.GetSLOReport", true);
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api
.get_slo_report("9fb2dc2a-ead0-11ee-a174-9fe3a9d7627f".to_string())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Get SLO report status returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_service_level_objectives::ServiceLevelObjectivesAPI;

#[tokio::main]
async fn main() {
// there is a valid "report" in the system
let report_data_id = std::env::var("REPORT_DATA_ID").unwrap();
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.GetSLOReportJobStatus", true);
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api.get_slo_report_job_status(report_data_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Loading
Loading