dogapi 1.37.0 → 1.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +58 -69
- data/CHANGELOG.md +6 -1
- data/lib/dogapi/facade.rb +0 -54
- data/lib/dogapi/v1.rb +0 -1
- data/lib/dogapi/version.rb +1 -1
- data/spec/spec_helper.rb +0 -30
- metadata +2 -5
- data/lib/dogapi/v1/service_level_objective.rb +0 -117
- data/spec/integration/service_level_objective_spec.rb +0 -71
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a0e225d4414b99557764e07500fa9d7526691cf6a0316645ec80bab21be47951
|
|
4
|
+
data.tar.gz: 3b95a96e0ea39720d6cf0ef0cc9970371a008a36af076f612c1ff3421048b13f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5523a7f0a3625c83049cd7d3cabd5435fcaaf6193962a2b60b3c7e0694ae4a4d83b28d7f630f983ab0c9f39d69886d0e7da7131b234f548314d22cbe14a0938a
|
|
7
|
+
data.tar.gz: e3a816e30b120f82732a785fad4afbc80d856b3729a7be365f76eb4e84b590ab198dc265784097531386a7b420d426561b9f07d703efcee5c68ca5c0ae83bf5c
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
3
|
+
# on 2018-10-01 12:52:09 +0200 using RuboCop version 0.49.1.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
@@ -51,14 +51,14 @@ Layout/EmptyLines:
|
|
|
51
51
|
- 'lib/capistrano/datadog/v2.rb'
|
|
52
52
|
- 'lib/dogapi/facade.rb'
|
|
53
53
|
|
|
54
|
-
# Offense count:
|
|
54
|
+
# Offense count: 63
|
|
55
55
|
# Cop supports --auto-correct.
|
|
56
56
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
57
57
|
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
|
|
58
58
|
Layout/EmptyLinesAroundClassBody:
|
|
59
59
|
Enabled: false
|
|
60
60
|
|
|
61
|
-
# Offense count:
|
|
61
|
+
# Offense count: 1
|
|
62
62
|
# Cop supports --auto-correct.
|
|
63
63
|
Layout/EmptyLinesAroundMethodBody:
|
|
64
64
|
Exclude:
|
|
@@ -85,20 +85,10 @@ Layout/ExtraSpacing:
|
|
|
85
85
|
|
|
86
86
|
# Offense count: 2
|
|
87
87
|
# Cop supports --auto-correct.
|
|
88
|
-
# Configuration parameters:
|
|
89
|
-
# SupportedStyles: consistent, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
|
90
|
-
Layout/FirstParameterIndentation:
|
|
91
|
-
Exclude:
|
|
92
|
-
- 'spec/spec_helper.rb'
|
|
93
|
-
|
|
94
|
-
# Offense count: 3
|
|
95
|
-
# Cop supports --auto-correct.
|
|
96
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
88
|
+
# Configuration parameters: SupportedStyles, IndentationWidth.
|
|
97
89
|
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
|
98
90
|
Layout/IndentHash:
|
|
99
|
-
|
|
100
|
-
- 'lib/dogapi/v1/event.rb'
|
|
101
|
-
- 'lib/dogapi/v1/service_level_objective.rb'
|
|
91
|
+
EnforcedStyle: consistent
|
|
102
92
|
|
|
103
93
|
# Offense count: 1
|
|
104
94
|
# Cop supports --auto-correct.
|
|
@@ -130,7 +120,7 @@ Layout/SpaceAfterComma:
|
|
|
130
120
|
Exclude:
|
|
131
121
|
- 'examples/custom_metric.rb'
|
|
132
122
|
|
|
133
|
-
# Offense count:
|
|
123
|
+
# Offense count: 75
|
|
134
124
|
# Cop supports --auto-correct.
|
|
135
125
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
136
126
|
# SupportedStyles: space, no_space
|
|
@@ -157,29 +147,12 @@ Layout/SpaceAroundOperators:
|
|
|
157
147
|
- 'examples/custom_metric.rb'
|
|
158
148
|
- 'lib/dogapi/event.rb'
|
|
159
149
|
|
|
160
|
-
# Offense count:
|
|
161
|
-
# Cop supports --auto-correct.
|
|
162
|
-
Layout/SpaceBeforeComma:
|
|
163
|
-
Exclude:
|
|
164
|
-
- 'lib/dogapi/facade.rb'
|
|
165
|
-
- 'lib/dogapi/v1/service_level_objective.rb'
|
|
166
|
-
|
|
167
|
-
# Offense count: 2
|
|
150
|
+
# Offense count: 1
|
|
168
151
|
# Cop supports --auto-correct.
|
|
169
152
|
# Configuration parameters: AllowForAlignment.
|
|
170
153
|
Layout/SpaceBeforeFirstArg:
|
|
171
154
|
Exclude:
|
|
172
155
|
- 'lib/capistrano/datadog/v2.rb'
|
|
173
|
-
- 'lib/dogapi/v1/service_level_objective.rb'
|
|
174
|
-
|
|
175
|
-
# Offense count: 6
|
|
176
|
-
# Cop supports --auto-correct.
|
|
177
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces.
|
|
178
|
-
# SupportedStyles: space, no_space, compact
|
|
179
|
-
# SupportedStylesForEmptyBraces: space, no_space
|
|
180
|
-
Layout/SpaceInsideHashLiteralBraces:
|
|
181
|
-
Exclude:
|
|
182
|
-
- 'spec/integration/service_level_objective_spec.rb'
|
|
183
156
|
|
|
184
157
|
# Offense count: 1
|
|
185
158
|
# Cop supports --auto-correct.
|
|
@@ -228,42 +201,44 @@ Lint/UselessAssignment:
|
|
|
228
201
|
Exclude:
|
|
229
202
|
- 'lib/capistrano/datadog.rb'
|
|
230
203
|
|
|
231
|
-
# Offense count:
|
|
204
|
+
# Offense count: 11
|
|
232
205
|
Metrics/AbcSize:
|
|
233
206
|
Max: 51
|
|
234
207
|
|
|
235
|
-
# Offense count:
|
|
208
|
+
# Offense count: 18
|
|
236
209
|
# Configuration parameters: CountComments, ExcludedMethods.
|
|
237
210
|
Metrics/BlockLength:
|
|
238
|
-
Max:
|
|
211
|
+
Max: 96
|
|
212
|
+
Exclude:
|
|
213
|
+
- 'spec/integration/monitor_spec.rb'
|
|
239
214
|
|
|
240
|
-
# Offense count:
|
|
215
|
+
# Offense count: 2
|
|
241
216
|
Metrics/CyclomaticComplexity:
|
|
242
|
-
Max:
|
|
217
|
+
Max: 8
|
|
243
218
|
|
|
244
|
-
# Offense count:
|
|
219
|
+
# Offense count: 15
|
|
245
220
|
# Configuration parameters: CountComments.
|
|
246
221
|
Metrics/MethodLength:
|
|
247
222
|
Max: 34
|
|
248
223
|
|
|
249
|
-
# Offense count:
|
|
224
|
+
# Offense count: 2
|
|
250
225
|
# Configuration parameters: CountKeywordArgs.
|
|
251
226
|
Metrics/ParameterLists:
|
|
252
|
-
Max:
|
|
227
|
+
Max: 7
|
|
253
228
|
|
|
254
|
-
# Offense count:
|
|
229
|
+
# Offense count: 1
|
|
255
230
|
Metrics/PerceivedComplexity:
|
|
256
|
-
Max:
|
|
231
|
+
Max: 9
|
|
257
232
|
|
|
258
|
-
# Offense count:
|
|
233
|
+
# Offense count: 11
|
|
259
234
|
Style/AccessorMethodName:
|
|
260
235
|
Exclude:
|
|
261
236
|
- 'lib/dogapi/facade.rb'
|
|
262
237
|
- 'lib/dogapi/v1/alert.rb'
|
|
263
238
|
- 'lib/dogapi/v1/dash.rb'
|
|
264
|
-
- 'lib/dogapi/v1/dashboard.rb'
|
|
265
239
|
- 'lib/dogapi/v1/embed.rb'
|
|
266
240
|
- 'lib/dogapi/v1/screenboard.rb'
|
|
241
|
+
- 'lib/dogapi/v1/dashboard.rb'
|
|
267
242
|
- 'lib/dogapi/v1/user.rb'
|
|
268
243
|
|
|
269
244
|
# Offense count: 1
|
|
@@ -308,7 +283,7 @@ Style/ClassMethods:
|
|
|
308
283
|
Exclude:
|
|
309
284
|
- 'lib/dogapi/common.rb'
|
|
310
285
|
|
|
311
|
-
# Offense count:
|
|
286
|
+
# Offense count: 2
|
|
312
287
|
Style/ClassVars:
|
|
313
288
|
Exclude:
|
|
314
289
|
- 'lib/dogapi/common.rb'
|
|
@@ -320,24 +295,24 @@ Style/ColonMethodCall:
|
|
|
320
295
|
- 'lib/capistrano/datadog.rb'
|
|
321
296
|
- 'lib/capistrano/datadog/v2.rb'
|
|
322
297
|
|
|
323
|
-
# Offense count:
|
|
298
|
+
# Offense count: 2
|
|
324
299
|
# Cop supports --auto-correct.
|
|
325
300
|
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerBackticks.
|
|
326
301
|
# SupportedStyles: backticks, percent_x, mixed
|
|
327
302
|
Style/CommandLiteral:
|
|
328
303
|
Exclude:
|
|
304
|
+
- 'lib/capistrano/datadog.rb'
|
|
329
305
|
- 'lib/dogapi/common.rb'
|
|
330
306
|
|
|
331
|
-
# Offense count:
|
|
307
|
+
# Offense count: 1
|
|
332
308
|
# Cop supports --auto-correct.
|
|
333
309
|
# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly, IncludeTernaryExpressions.
|
|
334
310
|
# SupportedStyles: assign_to_condition, assign_inside_condition
|
|
335
311
|
Style/ConditionalAssignment:
|
|
336
312
|
Exclude:
|
|
337
313
|
- 'lib/capistrano/datadog.rb'
|
|
338
|
-
- 'lib/dogapi/v1/service_level_objective.rb'
|
|
339
314
|
|
|
340
|
-
# Offense count:
|
|
315
|
+
# Offense count: 20
|
|
341
316
|
# Cop supports --auto-correct.
|
|
342
317
|
Style/DefWithParentheses:
|
|
343
318
|
Exclude:
|
|
@@ -347,9 +322,28 @@ Style/DefWithParentheses:
|
|
|
347
322
|
- 'lib/dogapi/v1/metric.rb'
|
|
348
323
|
- 'lib/dogapi/v1/screenboard.rb'
|
|
349
324
|
|
|
350
|
-
# Offense count:
|
|
325
|
+
# Offense count: 21
|
|
351
326
|
Style/Documentation:
|
|
352
|
-
|
|
327
|
+
Exclude:
|
|
328
|
+
- 'spec/**/*'
|
|
329
|
+
- 'test/**/*'
|
|
330
|
+
- 'lib/capistrano/datadog.rb'
|
|
331
|
+
- 'lib/capistrano/datadog/v2.rb'
|
|
332
|
+
- 'lib/capistrano/datadog/v3.rb'
|
|
333
|
+
- 'lib/dogapi/common.rb'
|
|
334
|
+
- 'lib/dogapi/v1/alert.rb'
|
|
335
|
+
- 'lib/dogapi/v1/comment.rb'
|
|
336
|
+
- 'lib/dogapi/v1/dash.rb'
|
|
337
|
+
- 'lib/dogapi/v1/metadata.rb'
|
|
338
|
+
- 'lib/dogapi/v1/monitor.rb'
|
|
339
|
+
- 'lib/dogapi/v1/screenboard.rb'
|
|
340
|
+
- 'lib/dogapi/v1/search.rb'
|
|
341
|
+
- 'lib/dogapi/v1/service_check.rb'
|
|
342
|
+
- 'lib/dogapi/v1/snapshot.rb'
|
|
343
|
+
- 'lib/dogapi/v1/user.rb'
|
|
344
|
+
- 'lib/dogapi/v1/integration.rb'
|
|
345
|
+
- 'lib/dogapi/v1/usage.rb'
|
|
346
|
+
- 'lib/dogapi/v1/metric.rb'
|
|
353
347
|
|
|
354
348
|
# Offense count: 1
|
|
355
349
|
# Cop supports --auto-correct.
|
|
@@ -357,7 +351,7 @@ Style/EmptyLiteral:
|
|
|
357
351
|
Exclude:
|
|
358
352
|
- 'lib/dogapi/v1/metric.rb'
|
|
359
353
|
|
|
360
|
-
# Offense count:
|
|
354
|
+
# Offense count: 2
|
|
361
355
|
# Configuration parameters: MinBodyLength.
|
|
362
356
|
Style/GuardClause:
|
|
363
357
|
Exclude:
|
|
@@ -405,7 +399,7 @@ Style/LineEndConcatenation:
|
|
|
405
399
|
Exclude:
|
|
406
400
|
- 'dogapi.gemspec'
|
|
407
401
|
|
|
408
|
-
# Offense count:
|
|
402
|
+
# Offense count: 15
|
|
409
403
|
# Cop supports --auto-correct.
|
|
410
404
|
Style/MethodCallWithoutArgsParentheses:
|
|
411
405
|
Exclude:
|
|
@@ -420,7 +414,7 @@ Style/MultilineIfThen:
|
|
|
420
414
|
Exclude:
|
|
421
415
|
- 'lib/capistrano/datadog.rb'
|
|
422
416
|
|
|
423
|
-
# Offense count:
|
|
417
|
+
# Offense count: 21
|
|
424
418
|
# Cop supports --auto-correct.
|
|
425
419
|
Style/MutableConstant:
|
|
426
420
|
Enabled: false
|
|
@@ -440,17 +434,12 @@ Style/Not:
|
|
|
440
434
|
Exclude:
|
|
441
435
|
- 'lib/dogapi/v1/metric.rb'
|
|
442
436
|
|
|
443
|
-
# Offense count:
|
|
444
|
-
# Cop supports --auto-correct.
|
|
445
|
-
# Configuration parameters: Strict.
|
|
446
|
-
Style/NumericLiterals:
|
|
447
|
-
MinDigits: 8
|
|
448
|
-
|
|
449
|
-
# Offense count: 4
|
|
437
|
+
# Offense count: 5
|
|
450
438
|
# Cop supports --auto-correct.
|
|
451
439
|
# Configuration parameters: PreferredDelimiters.
|
|
452
440
|
Style/PercentLiteralDelimiters:
|
|
453
441
|
Exclude:
|
|
442
|
+
- 'lib/capistrano/datadog.rb'
|
|
454
443
|
- 'lib/dogapi/common.rb'
|
|
455
444
|
- 'spec/integration/event_spec.rb'
|
|
456
445
|
- 'spec/integration/monitor_spec.rb'
|
|
@@ -463,11 +452,12 @@ Style/PreferredHashMethods:
|
|
|
463
452
|
Exclude:
|
|
464
453
|
- 'lib/dogapi/common.rb'
|
|
465
454
|
|
|
466
|
-
# Offense count:
|
|
455
|
+
# Offense count: 3
|
|
467
456
|
# Cop supports --auto-correct.
|
|
468
457
|
Style/RedundantBegin:
|
|
469
458
|
Exclude:
|
|
470
459
|
- 'lib/capistrano/datadog.rb'
|
|
460
|
+
- 'lib/dogapi/common.rb'
|
|
471
461
|
- 'lib/dogapi/v1/metric.rb'
|
|
472
462
|
|
|
473
463
|
# Offense count: 2
|
|
@@ -507,7 +497,7 @@ Style/SpecialGlobalVars:
|
|
|
507
497
|
Exclude:
|
|
508
498
|
- 'dogapi.gemspec'
|
|
509
499
|
|
|
510
|
-
# Offense count:
|
|
500
|
+
# Offense count: 22
|
|
511
501
|
# Cop supports --auto-correct.
|
|
512
502
|
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
|
|
513
503
|
# SupportedStyles: single_quotes, double_quotes
|
|
@@ -519,7 +509,6 @@ Style/StringLiterals:
|
|
|
519
509
|
- 'examples/Capfile'
|
|
520
510
|
- 'examples/custom_event.rb'
|
|
521
511
|
- 'lib/dogapi/event.rb'
|
|
522
|
-
- 'spec/integration/service_level_objective_spec.rb'
|
|
523
512
|
|
|
524
513
|
# Offense count: 10
|
|
525
514
|
# Cop supports --auto-correct.
|
|
@@ -537,11 +526,11 @@ Style/TrailingCommaInLiteral:
|
|
|
537
526
|
|
|
538
527
|
# Offense count: 2
|
|
539
528
|
# Cop supports --auto-correct.
|
|
540
|
-
# Configuration parameters: SupportedStyles, WordRegex.
|
|
529
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, MinSize, WordRegex.
|
|
541
530
|
# SupportedStyles: percent, brackets
|
|
542
531
|
Style/WordArray:
|
|
543
|
-
|
|
544
|
-
|
|
532
|
+
Exclude:
|
|
533
|
+
- 'examples/custom_event.rb'
|
|
545
534
|
|
|
546
535
|
# Offense count: 1
|
|
547
536
|
# Cop supports --auto-correct.
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 1.37.1 / 2019-11-04
|
|
4
|
+
|
|
5
|
+
* [BUGFIX] Revert the Service Level Objective feature to remove an issue with older versions of Ruby < 2.0. See [#198][]
|
|
6
|
+
|
|
3
7
|
## 1.37.0 / 2019-11-04
|
|
4
8
|
|
|
5
9
|
* [FEATURE] Add Service Level Objectives support. See [#188][], thanks [@platinummonkey][]
|
|
@@ -257,6 +261,7 @@ This is the last release compatible with Ruby 1.8. ([EOL 2013-06-30](https://www
|
|
|
257
261
|
[#188]: https://github.com/DataDog/dogapi-rb/issues/188
|
|
258
262
|
[#189]: https://github.com/DataDog/dogapi-rb/issues/189
|
|
259
263
|
[#192]: https://github.com/DataDog/dogapi-rb/issues/192
|
|
264
|
+
[#198]: https://github.com/DataDog/dogapi-rb/issues/198
|
|
260
265
|
[@ArjenSchwarz]: https://github.com/ArjenSchwarz
|
|
261
266
|
[@Kaixiang]: https://github.com/Kaixiang
|
|
262
267
|
[@TaylURRE]: https://github.com/TaylURRE
|
|
@@ -284,4 +289,4 @@ This is the last release compatible with Ruby 1.8. ([EOL 2013-06-30](https://www
|
|
|
284
289
|
[@unclebconnor]: https://github.com/unclebconnor
|
|
285
290
|
[@winebarrel]: https://github.com/winebarrel
|
|
286
291
|
[@wonko]: https://github.com/wonko
|
|
287
|
-
[@yyuu]: https://github.com/yyuu
|
|
292
|
+
[@yyuu]: https://github.com/yyuu
|
data/lib/dogapi/facade.rb
CHANGED
|
@@ -95,8 +95,6 @@ module Dogapi
|
|
|
95
95
|
@hosts_svc = Dogapi::V1::HostsService.new(@api_key, @application_key, silent, timeout, @datadog_host)
|
|
96
96
|
@integration_svc = Dogapi::V1::IntegrationService.new(@api_key, @application_key, silent, timeout, @datadog_host)
|
|
97
97
|
@usage_svc = Dogapi::V1::UsageService.new(@api_key, @application_key, silent, timeout, @datadog_host)
|
|
98
|
-
@service_level_objective_svc = Dogapi::V1::ServiceLevelObjectiveService.new(@api_key, @application_key, silent,
|
|
99
|
-
timeout, @datadog_host)
|
|
100
98
|
|
|
101
99
|
# Support for Dashboard List API v2.
|
|
102
100
|
@v2 = Dogapi::ClientV2.new(@api_key, @application_key, true, true, @datadog_host)
|
|
@@ -618,58 +616,6 @@ module Dogapi
|
|
|
618
616
|
@monitor_svc.unmute_host(hostname)
|
|
619
617
|
end
|
|
620
618
|
|
|
621
|
-
#
|
|
622
|
-
# SERVICE LEVEL OBJECTIVES
|
|
623
|
-
#
|
|
624
|
-
|
|
625
|
-
def create_service_level_objective(type: , name: , description: nil, tags: nil, thresholds: nil, numerator: nil,
|
|
626
|
-
denominator: nil, monitor_ids: nil, monitor_search: nil, groups: nil)
|
|
627
|
-
@service_level_objective_svc.create_service_level_objective(type: type, name: name, description: description,
|
|
628
|
-
tags: tags, thresholds: thresholds,
|
|
629
|
-
numerator: numerator, denominator: denominator,
|
|
630
|
-
monitor_ids: monitor_ids,
|
|
631
|
-
monitor_search: monitor_search, groups: groups)
|
|
632
|
-
end
|
|
633
|
-
|
|
634
|
-
def update_service_level_objective(slo_id: , type: , name: nil, description: nil, tags: nil, thresholds: nil,
|
|
635
|
-
numerator: nil, denominator: nil, monitor_ids: nil, monitor_search: nil,
|
|
636
|
-
groups: nil)
|
|
637
|
-
@service_level_objective_svc.update_service_level_objective(slo_id: slo_id, type: type, name: name,
|
|
638
|
-
description: description, tags: tags,
|
|
639
|
-
thresholds: thresholds, numerator: numerator,
|
|
640
|
-
denominator: denominator, monitor_ids: monitor_ids,
|
|
641
|
-
monitor_search: monitor_search, groups: groups)
|
|
642
|
-
end
|
|
643
|
-
|
|
644
|
-
def get_service_level_objective(slo_id)
|
|
645
|
-
@service_level_objective_svc.get_service_level_objective(slo_id)
|
|
646
|
-
end
|
|
647
|
-
|
|
648
|
-
def get_service_level_objective_history(slo_id, from_ts, to_ts)
|
|
649
|
-
@service_level_objective_svc.get_service_level_objective_history(slo_id, from_ts, to_ts)
|
|
650
|
-
end
|
|
651
|
-
|
|
652
|
-
def search_service_level_objective(slo_ids: nil, query: nil, offset: nil, limit: nil)
|
|
653
|
-
@service_level_objective_svc.search_service_level_objective(slo_ids: slo_ids, query: query, offset: offset,
|
|
654
|
-
limit: limit)
|
|
655
|
-
end
|
|
656
|
-
|
|
657
|
-
def can_delete_service_level_objective(slo_ids)
|
|
658
|
-
@service_level_objective_svc.can_delete_service_level_objective(slo_ids)
|
|
659
|
-
end
|
|
660
|
-
|
|
661
|
-
def delete_service_level_objective(slo_id)
|
|
662
|
-
@service_level_objective_svc.delete_service_level_objective(slo_id)
|
|
663
|
-
end
|
|
664
|
-
|
|
665
|
-
def delete_many_service_level_objective(slo_ids)
|
|
666
|
-
@service_level_objective_svc.delete_many_service_level_objective(slo_ids)
|
|
667
|
-
end
|
|
668
|
-
|
|
669
|
-
def delete_timeframes_service_level_objective(ops)
|
|
670
|
-
@service_level_objective_svc.delete_timeframes_service_level_objective(ops)
|
|
671
|
-
end
|
|
672
|
-
|
|
673
619
|
#
|
|
674
620
|
# SERVICE CHECKS
|
|
675
621
|
#
|
data/lib/dogapi/v1.rb
CHANGED
|
@@ -11,7 +11,6 @@ require 'dogapi/v1/monitor'
|
|
|
11
11
|
require 'dogapi/v1/screenboard'
|
|
12
12
|
require 'dogapi/v1/search'
|
|
13
13
|
require 'dogapi/v1/service_check'
|
|
14
|
-
require 'dogapi/v1/service_level_objective'
|
|
15
14
|
require 'dogapi/v1/snapshot'
|
|
16
15
|
require 'dogapi/v1/tag'
|
|
17
16
|
require 'dogapi/v1/user'
|
data/lib/dogapi/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
|
@@ -42,22 +42,6 @@ module SpecDog
|
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
shared_examples 'an api method with named args' do |command, args, request, endpoint, body|
|
|
46
|
-
it 'queries the api' do
|
|
47
|
-
url = api_url + endpoint
|
|
48
|
-
old_url = old_api_url + endpoint
|
|
49
|
-
stub_request(request, /#{url}|#{old_url}/).to_return(body: '{}').then.to_raise(StandardError)
|
|
50
|
-
expect(dog.send(command, **args)).to eq ['200', {}]
|
|
51
|
-
|
|
52
|
-
body = MultiJson.dump(body) if body
|
|
53
|
-
|
|
54
|
-
expect(WebMock).to have_requested(request, /#{url}|#{old_url}/).with(
|
|
55
|
-
# ignore query: default_query -- here as in the test it's never properly included
|
|
56
|
-
body: body
|
|
57
|
-
)
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
45
|
shared_examples 'an api method with options' do |command, args, request, endpoint, body|
|
|
62
46
|
include_examples 'an api method', command, args, request, endpoint, body
|
|
63
47
|
it 'queries the api with options' do
|
|
@@ -89,20 +73,6 @@ module SpecDog
|
|
|
89
73
|
end
|
|
90
74
|
end
|
|
91
75
|
|
|
92
|
-
shared_examples 'an api method with named args making params' do |command, args, request, endpoint, params|
|
|
93
|
-
it 'queries the api with params' do
|
|
94
|
-
url = api_url + endpoint
|
|
95
|
-
stub_request(request, /#{url}/).to_return(body: '{}').then.to_raise(StandardError)
|
|
96
|
-
expect(dog.send(command, **args)).to eq ['200', {}]
|
|
97
|
-
params.each { |k, v| params[k] = v.join(',') if v.is_a? Array }
|
|
98
|
-
# hack/note: do not merge with default_query for this test case
|
|
99
|
-
|
|
100
|
-
expect(WebMock).to have_requested(request, url).with(
|
|
101
|
-
query: params
|
|
102
|
-
)
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
|
|
106
76
|
shared_examples 'an api method with optional params' do |command, args, request, endpoint, opt_params|
|
|
107
77
|
include_examples 'an api method', command, args, request, endpoint
|
|
108
78
|
it 'queries the api with optional params' do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dogapi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.37.
|
|
4
|
+
version: 1.37.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Datadog, Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-11-
|
|
11
|
+
date: 2019-11-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: multi_json
|
|
@@ -114,7 +114,6 @@ files:
|
|
|
114
114
|
- lib/dogapi/v1/screenboard.rb
|
|
115
115
|
- lib/dogapi/v1/search.rb
|
|
116
116
|
- lib/dogapi/v1/service_check.rb
|
|
117
|
-
- lib/dogapi/v1/service_level_objective.rb
|
|
118
117
|
- lib/dogapi/v1/snapshot.rb
|
|
119
118
|
- lib/dogapi/v1/tag.rb
|
|
120
119
|
- lib/dogapi/v1/usage.rb
|
|
@@ -137,7 +136,6 @@ files:
|
|
|
137
136
|
- spec/integration/screenboard_spec.rb
|
|
138
137
|
- spec/integration/search_spec.rb
|
|
139
138
|
- spec/integration/service_check_spec.rb
|
|
140
|
-
- spec/integration/service_level_objective_spec.rb
|
|
141
139
|
- spec/integration/snapshot_spec.rb
|
|
142
140
|
- spec/integration/tag_spec.rb
|
|
143
141
|
- spec/integration/usage_spec.rb
|
|
@@ -196,7 +194,6 @@ test_files:
|
|
|
196
194
|
- spec/integration/screenboard_spec.rb
|
|
197
195
|
- spec/integration/search_spec.rb
|
|
198
196
|
- spec/integration/service_check_spec.rb
|
|
199
|
-
- spec/integration/service_level_objective_spec.rb
|
|
200
197
|
- spec/integration/snapshot_spec.rb
|
|
201
198
|
- spec/integration/tag_spec.rb
|
|
202
199
|
- spec/integration/usage_spec.rb
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
require 'dogapi'
|
|
2
|
-
|
|
3
|
-
module Dogapi
|
|
4
|
-
class V1 # for namespacing
|
|
5
|
-
|
|
6
|
-
# Implements Service Level Objectives endpoints
|
|
7
|
-
class ServiceLevelObjectiveService < Dogapi::APIService
|
|
8
|
-
|
|
9
|
-
API_VERSION = 'v1'
|
|
10
|
-
|
|
11
|
-
def create_service_level_objective(type: , name: , description: nil, tags: nil, thresholds: nil,
|
|
12
|
-
numerator: nil, denominator: nil, monitor_ids: nil, monitor_search: nil,
|
|
13
|
-
groups: nil)
|
|
14
|
-
body = {
|
|
15
|
-
type: type,
|
|
16
|
-
name: name,
|
|
17
|
-
thresholds: thresholds
|
|
18
|
-
}
|
|
19
|
-
if type == 'metric'
|
|
20
|
-
body[:query] = {
|
|
21
|
-
numerator: numerator,
|
|
22
|
-
denominator: denominator
|
|
23
|
-
}
|
|
24
|
-
else
|
|
25
|
-
body[:monitor_search] = monitor_search unless monitor_search.nil?
|
|
26
|
-
body[:monitor_ids] = monitor_ids unless monitor_ids.nil?
|
|
27
|
-
body[:groups] = groups unless groups.nil?
|
|
28
|
-
end
|
|
29
|
-
body[:tags] = tags unless tags.nil?
|
|
30
|
-
body[:description] = description unless description.nil?
|
|
31
|
-
|
|
32
|
-
request(Net::HTTP::Post, "/api/#{API_VERSION}/slo", nil, body, true)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def update_service_level_objective(slo_id: , type: , name: nil, description: nil, tags: nil,
|
|
36
|
-
thresholds: nil, numerator: nil, denominator: nil, monitor_ids: nil,
|
|
37
|
-
monitor_search: nil, groups: nil)
|
|
38
|
-
body = {
|
|
39
|
-
type: type
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
body[:name] = name unless name.nil?
|
|
43
|
-
|
|
44
|
-
body[:thresholds] = thresholds unless thresholds.nil?
|
|
45
|
-
|
|
46
|
-
if type == 'metric'
|
|
47
|
-
if !numerator.nil? && !denominator.nil?
|
|
48
|
-
body[:query] = {
|
|
49
|
-
numerator: numerator,
|
|
50
|
-
denominator: denominator
|
|
51
|
-
}
|
|
52
|
-
end
|
|
53
|
-
else
|
|
54
|
-
body[:monitor_search] = monitor_search unless monitor_search.nil?
|
|
55
|
-
body[:monitor_ids] = monitor_ids unless monitor_ids.nil?
|
|
56
|
-
body[:groups] = groups unless groups.nil?
|
|
57
|
-
end
|
|
58
|
-
body[:tags] = tags unless tags.nil?
|
|
59
|
-
body[:description] = description unless description.nil?
|
|
60
|
-
|
|
61
|
-
request(Net::HTTP::Put, "/api/#{API_VERSION}/slo/#{slo_id}", nil, body, true)
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def get_service_level_objective(slo_id)
|
|
65
|
-
request(Net::HTTP::Get, "/api/#{API_VERSION}/slo/#{slo_id}", nil, nil, false)
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def search_service_level_objective(slo_ids: nil, query: nil, offset: nil, limit: nil)
|
|
69
|
-
params = {}
|
|
70
|
-
params[:offset] = offset unless offset.nil?
|
|
71
|
-
params[:limit] = limit unless limit.nil?
|
|
72
|
-
if !slo_ids.nil?
|
|
73
|
-
params[:ids] = slo_ids.join(',')
|
|
74
|
-
else
|
|
75
|
-
params[:query] = query
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
request(Net::HTTP::Get, "/api/#{API_VERSION}/slo/", params, nil, false)
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
def delete_service_level_objective(slo_id)
|
|
82
|
-
request(Net::HTTP::Delete, "/api/#{API_VERSION}/slo/#{slo_id}", nil, nil, false)
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
def delete_many_service_level_objective(slo_ids)
|
|
86
|
-
body = {
|
|
87
|
-
ids: slo_ids
|
|
88
|
-
}
|
|
89
|
-
request(Net::HTTP::Delete, "/api/#{API_VERSION}/slo/", nil, body, true)
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def delete_timeframes_service_level_objective(ops)
|
|
93
|
-
# ops is a hash of slo_id: [<timeframe>] to delete
|
|
94
|
-
request(Net::HTTP::Post, "/api/#{API_VERSION}/slo/bulk_delete", nil, ops, true)
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
def get_service_level_objective_history(slo_id, from_ts, to_ts)
|
|
98
|
-
params = {
|
|
99
|
-
from_ts: from_ts,
|
|
100
|
-
to_ts: to_ts
|
|
101
|
-
}
|
|
102
|
-
request(Net::HTTP::Get, "/api/#{API_VERSION}/slo/#{slo_id}/history", params, nil, false)
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
def can_delete_service_level_objective(slo_ids)
|
|
106
|
-
params = {}
|
|
107
|
-
if slo_ids.is_a?Array
|
|
108
|
-
params[:ids] = slo_ids.join(',')
|
|
109
|
-
else
|
|
110
|
-
params[:ids] = slo_ids
|
|
111
|
-
end
|
|
112
|
-
request(Net::HTTP::Get, "/api/#{API_VERSION}/slo/can_delete", params, nil, false)
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
end
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
require_relative '../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe Dogapi::Client do
|
|
4
|
-
SLO_ID = '42424242424242424242424242424242'.freeze
|
|
5
|
-
SLO_TYPE = 'metric'.freeze
|
|
6
|
-
SLO_NAME = 'test slo'.freeze
|
|
7
|
-
SLO_DESCRIPTION = 'test slo description'.freeze
|
|
8
|
-
SLO_QUERY_NUMERATOR = 'sum:test.metric.metric{type:good}.as_count()'.freeze
|
|
9
|
-
SLO_QUERY_DENOMINATOR = 'sum:test.metric.metric{*}.as_count()'.freeze
|
|
10
|
-
SLO_TAGS = ['type:test'].freeze
|
|
11
|
-
SLO_THRESHOLDS = [{ timeframe: '7d', target: 90 }, { timeframe: '30d', target: 95 }].freeze
|
|
12
|
-
|
|
13
|
-
describe '#create_service_level_objective' do
|
|
14
|
-
it_behaves_like 'an api method with named args',
|
|
15
|
-
:create_service_level_objective, {type: SLO_TYPE, name: SLO_NAME, description: SLO_DESCRIPTION,
|
|
16
|
-
tags: SLO_TAGS, thresholds: SLO_THRESHOLDS,
|
|
17
|
-
numerator: SLO_QUERY_NUMERATOR,
|
|
18
|
-
denominator: SLO_QUERY_DENOMINATOR},
|
|
19
|
-
:post, '/slo', 'type' => SLO_TYPE, 'name' => SLO_NAME, 'thresholds' => SLO_THRESHOLDS,
|
|
20
|
-
'query' => { numerator: SLO_QUERY_NUMERATOR, denominator: SLO_QUERY_DENOMINATOR },
|
|
21
|
-
'tags' => SLO_TAGS, 'description' => SLO_DESCRIPTION
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
describe '#update_service_level_objective' do
|
|
25
|
-
it_behaves_like 'an api method with named args',
|
|
26
|
-
:update_service_level_objective, {slo_id: SLO_ID, type: SLO_TYPE, name: SLO_NAME},
|
|
27
|
-
:put, "/slo/#{SLO_ID}", 'type' => SLO_TYPE, 'name' => SLO_NAME
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
describe '#get_service_level_objective' do
|
|
31
|
-
it_behaves_like 'an api method',
|
|
32
|
-
:get_service_level_objective, [SLO_ID],
|
|
33
|
-
:get, "/slo/#{SLO_ID}"
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
describe '#get_service_level_objective_history' do
|
|
37
|
-
it_behaves_like 'an api method with params',
|
|
38
|
-
:get_service_level_objective_history, [SLO_ID],
|
|
39
|
-
:get, "/slo/#{SLO_ID}/history", 'from_ts' => 0, 'to_ts' => 1000000
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
describe '#can_delete_service_level_objective' do
|
|
43
|
-
it_behaves_like 'an api method with params',
|
|
44
|
-
:can_delete_service_level_objective, [],
|
|
45
|
-
:get, "/slo/can_delete", 'ids' => [SLO_ID]
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
describe '#search_service_level_objective' do
|
|
49
|
-
it_behaves_like 'an api method with named args making params',
|
|
50
|
-
:search_service_level_objective, {slo_ids: [SLO_ID]},
|
|
51
|
-
:get, '/slo/', 'ids' => SLO_ID
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
describe '#delete_service_level_objective' do
|
|
55
|
-
it_behaves_like 'an api method',
|
|
56
|
-
:delete_service_level_objective, [SLO_ID],
|
|
57
|
-
:delete, "/slo/#{SLO_ID}"
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
describe '#delete_many_service_level_objective' do
|
|
61
|
-
it_behaves_like 'an api method',
|
|
62
|
-
:delete_many_service_level_objective, [[SLO_ID]],
|
|
63
|
-
:delete, '/slo/', 'ids' => [SLO_ID]
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
describe '#delete_timeframes_service_level_objective' do
|
|
67
|
-
it_behaves_like 'an api method',
|
|
68
|
-
:delete_timeframes_service_level_objective, [{ SLO_ID => ['7d'] }],
|
|
69
|
-
:post, '/slo/bulk_delete', SLO_ID => ['7d']
|
|
70
|
-
end
|
|
71
|
-
end
|