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

Expose database-monitoring monitor type #1885

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.4",
"regenerated": "2023-06-08 18:39:07.897421",
"spec_repo_commit": "0df91379"
"regenerated": "2023-06-08 19:45:33.967915",
"spec_repo_commit": "f3dd285f"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2023-06-08 18:39:07.914115",
"spec_repo_commit": "0df91379"
"regenerated": "2023-06-08 19:45:33.984048",
"spec_repo_commit": "f3dd285f"
}
}
}
31 changes: 30 additions & 1 deletion .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7168,6 +7168,7 @@ components:
- ci-pipelines alert
- ci-tests alert
- error-tracking alert
- database-monitoring alert
example: query alert
type: string
x-enum-varnames:
Expand All @@ -7187,6 +7188,7 @@ components:
- CI_PIPELINES_ALERT
- CI_TESTS_ALERT
- ERROR_TRACKING_ALERT
- DATABASE_MONITORING_ALERT
MonitorUpdateRequest:
description: Object describing a monitor update request.
properties:
Expand Down Expand Up @@ -24698,6 +24700,8 @@ paths:

- error-tracking: `error-tracking alert`

- database-monitoring: `database-monitoring alert`


**Note**: Synthetic monitors are created through the Synthetics API. See the
[Synthetics API] (https://docs.datadoghq.com/api/latest/synthetics/) documentation
Expand Down Expand Up @@ -25023,7 +25027,32 @@ paths:

- `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`.

- `#` an integer or decimal number used to set the threshold.'
- `#` an integer or decimal number used to set the threshold.


**Database Monitoring Alert Query**


Example: `database-monitoring(query).rollup(rollup_method[, measure]).last(time_window)
operator #`


- `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/).

- `rollup_method` The stats roll-up method - supports `count`, `avg`, and
`cardinality`.

- `measure` For `avg` and cardinality `rollup_method` - specify the measure
or the facet name you want to use.

- `time_window` #m (between 1 and 2880), #h (between 1 and 48).

- `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`.

- `#` an integer or decimal number used to set the threshold.


**NOTE** Database Monitoring monitors are in alpha on US1.'
operationId: CreateMonitor
requestBody:
content:
Expand Down
14 changes: 14 additions & 0 deletions api/datadogV1/api_monitors.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func (a *MonitorsApi) CheckCanDeleteMonitor(ctx _context.Context, monitorIds []i
// - event-v2: `event-v2 alert`
// - audit: `audit alert`
// - error-tracking: `error-tracking alert`
// - database-monitoring: `database-monitoring alert`
//
// **Note**: Synthetic monitors are created through the Synthetics API. See the [Synthetics API] (https://docs.datadoghq.com/api/latest/synthetics/) documentation for more information.
//
Expand Down Expand Up @@ -282,6 +283,19 @@ func (a *MonitorsApi) CheckCanDeleteMonitor(ctx _context.Context, monitorIds []i
// - `time_window` #m (between 1 and 2880), #h (between 1 and 48).
// - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`.
// - `#` an integer or decimal number used to set the threshold.
//
// **Database Monitoring Alert Query**
//
// Example: `database-monitoring(query).rollup(rollup_method[, measure]).last(time_window) operator #`
//
// - `query` The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/).
// - `rollup_method` The stats roll-up method - supports `count`, `avg`, and `cardinality`.
// - `measure` For `avg` and cardinality `rollup_method` - specify the measure or the facet name you want to use.
// - `time_window` #m (between 1 and 2880), #h (between 1 and 48).
// - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`.
// - `#` an integer or decimal number used to set the threshold.
//
// **NOTE** Database Monitoring monitors are in alpha on US1.
func (a *MonitorsApi) CreateMonitor(ctx _context.Context, body Monitor) (Monitor, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
Expand Down
34 changes: 18 additions & 16 deletions api/datadogV1/model_monitor_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,23 @@ type MonitorType string

// List of MonitorType.
const (
MONITORTYPE_COMPOSITE MonitorType = "composite"
MONITORTYPE_EVENT_ALERT MonitorType = "event alert"
MONITORTYPE_LOG_ALERT MonitorType = "log alert"
MONITORTYPE_METRIC_ALERT MonitorType = "metric alert"
MONITORTYPE_PROCESS_ALERT MonitorType = "process alert"
MONITORTYPE_QUERY_ALERT MonitorType = "query alert"
MONITORTYPE_RUM_ALERT MonitorType = "rum alert"
MONITORTYPE_SERVICE_CHECK MonitorType = "service check"
MONITORTYPE_SYNTHETICS_ALERT MonitorType = "synthetics alert"
MONITORTYPE_TRACE_ANALYTICS_ALERT MonitorType = "trace-analytics alert"
MONITORTYPE_SLO_ALERT MonitorType = "slo alert"
MONITORTYPE_EVENT_V2_ALERT MonitorType = "event-v2 alert"
MONITORTYPE_AUDIT_ALERT MonitorType = "audit alert"
MONITORTYPE_CI_PIPELINES_ALERT MonitorType = "ci-pipelines alert"
MONITORTYPE_CI_TESTS_ALERT MonitorType = "ci-tests alert"
MONITORTYPE_ERROR_TRACKING_ALERT MonitorType = "error-tracking alert"
MONITORTYPE_COMPOSITE MonitorType = "composite"
MONITORTYPE_EVENT_ALERT MonitorType = "event alert"
MONITORTYPE_LOG_ALERT MonitorType = "log alert"
MONITORTYPE_METRIC_ALERT MonitorType = "metric alert"
MONITORTYPE_PROCESS_ALERT MonitorType = "process alert"
MONITORTYPE_QUERY_ALERT MonitorType = "query alert"
MONITORTYPE_RUM_ALERT MonitorType = "rum alert"
MONITORTYPE_SERVICE_CHECK MonitorType = "service check"
MONITORTYPE_SYNTHETICS_ALERT MonitorType = "synthetics alert"
MONITORTYPE_TRACE_ANALYTICS_ALERT MonitorType = "trace-analytics alert"
MONITORTYPE_SLO_ALERT MonitorType = "slo alert"
MONITORTYPE_EVENT_V2_ALERT MonitorType = "event-v2 alert"
MONITORTYPE_AUDIT_ALERT MonitorType = "audit alert"
MONITORTYPE_CI_PIPELINES_ALERT MonitorType = "ci-pipelines alert"
MONITORTYPE_CI_TESTS_ALERT MonitorType = "ci-tests alert"
MONITORTYPE_ERROR_TRACKING_ALERT MonitorType = "error-tracking alert"
MONITORTYPE_DATABASE_MONITORING_ALERT MonitorType = "database-monitoring alert"
)

var allowedMonitorTypeEnumValues = []MonitorType{
Expand All @@ -49,6 +50,7 @@ var allowedMonitorTypeEnumValues = []MonitorType{
MONITORTYPE_CI_PIPELINES_ALERT,
MONITORTYPE_CI_TESTS_ALERT,
MONITORTYPE_ERROR_TRACKING_ALERT,
MONITORTYPE_DATABASE_MONITORING_ALERT,
}

// GetAllowedValues reeturns the list of possible values.
Expand Down