dogapi 1.37.1 → 1.42.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.azure-pipelines/all.yml +16 -7
  3. data/.github/CODEOWNERS +10 -0
  4. data/.github/ISSUE_TEMPLATE/bug_report.md +36 -0
  5. data/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
  6. data/.github/PULL_REQUEST_TEMPLATE.md +77 -0
  7. data/.github/labeler.yml +5 -0
  8. data/.github/workflows/labeler.yml +11 -0
  9. data/.github/workflows/stale.yml +39 -0
  10. data/.rubocop_todo.yml +51 -71
  11. data/CHANGELOG.md +37 -0
  12. data/CONTRIBUTING.md +111 -0
  13. data/DEVELOPMENT.md +11 -0
  14. data/Gemfile +2 -0
  15. data/Gemfile_1.9 +13 -0
  16. data/LICENSE +21 -20
  17. data/LICENSE-3rdparty.csv +6 -0
  18. data/README.rdoc +14 -0
  19. data/RELEASING.md +46 -0
  20. data/SUPPORT.md +9 -0
  21. data/dogapi.gemspec +2 -0
  22. data/examples/custom_metric.rb +1 -1
  23. data/lib/capistrano/README.md +4 -1
  24. data/lib/capistrano/datadog.rb +8 -4
  25. data/lib/capistrano/datadog/v2.rb +9 -1
  26. data/lib/capistrano/datadog/v3.rb +10 -1
  27. data/lib/dogapi.rb +4 -0
  28. data/lib/dogapi/common.rb +90 -35
  29. data/lib/dogapi/event.rb +4 -0
  30. data/lib/dogapi/facade.rb +212 -10
  31. data/lib/dogapi/metric.rb +4 -0
  32. data/lib/dogapi/v1.rb +10 -0
  33. data/lib/dogapi/v1/alert.rb +4 -0
  34. data/lib/dogapi/v1/aws_integration.rb +117 -0
  35. data/lib/dogapi/v1/aws_logs.rb +107 -0
  36. data/lib/dogapi/v1/azure_integration.rb +85 -0
  37. data/lib/dogapi/v1/comment.rb +4 -0
  38. data/lib/dogapi/v1/dash.rb +10 -4
  39. data/lib/dogapi/v1/dashboard.rb +16 -0
  40. data/lib/dogapi/v1/dashboard_list.rb +4 -0
  41. data/lib/dogapi/v1/embed.rb +4 -0
  42. data/lib/dogapi/v1/event.rb +4 -0
  43. data/lib/dogapi/v1/gcp_integration.rb +76 -0
  44. data/lib/dogapi/v1/hosts.rb +4 -0
  45. data/lib/dogapi/v1/integration.rb +4 -0
  46. data/lib/dogapi/v1/metadata.rb +4 -0
  47. data/lib/dogapi/v1/metric.rb +4 -0
  48. data/lib/dogapi/v1/monitor.rb +20 -7
  49. data/lib/dogapi/v1/screenboard.rb +4 -0
  50. data/lib/dogapi/v1/search.rb +4 -0
  51. data/lib/dogapi/v1/service_check.rb +4 -0
  52. data/lib/dogapi/v1/service_level_objective.rb +113 -0
  53. data/lib/dogapi/v1/snapshot.rb +4 -0
  54. data/lib/dogapi/v1/synthetics.rb +80 -0
  55. data/lib/dogapi/v1/tag.rb +4 -0
  56. data/lib/dogapi/v1/usage.rb +4 -0
  57. data/lib/dogapi/v1/user.rb +4 -0
  58. data/lib/dogapi/v2.rb +4 -0
  59. data/lib/dogapi/v2/dashboard_list.rb +4 -0
  60. data/lib/dogapi/version.rb +5 -1
  61. data/spec/integration/alert_spec.rb +4 -0
  62. data/spec/integration/aws_integration_spec.rb +55 -0
  63. data/spec/integration/aws_logs_spec.rb +59 -0
  64. data/spec/integration/azure_integration_spec.rb +63 -0
  65. data/spec/integration/comment_spec.rb +5 -0
  66. data/spec/integration/common_spec.rb +4 -0
  67. data/spec/integration/dash_spec.rb +7 -1
  68. data/spec/integration/dashboard_list_spec.rb +4 -0
  69. data/spec/integration/dashboard_spec.rb +15 -1
  70. data/spec/integration/embed_spec.rb +4 -0
  71. data/spec/integration/event_spec.rb +5 -0
  72. data/spec/integration/gcp_integration_spec.rb +57 -0
  73. data/spec/integration/integration_spec.rb +4 -0
  74. data/spec/integration/metadata_spec.rb +4 -0
  75. data/spec/integration/metric_spec.rb +4 -0
  76. data/spec/integration/monitor_spec.rb +30 -1
  77. data/spec/integration/screenboard_spec.rb +4 -0
  78. data/spec/integration/search_spec.rb +4 -0
  79. data/spec/integration/service_check_spec.rb +4 -0
  80. data/spec/integration/service_level_objective_spec.rb +73 -0
  81. data/spec/integration/snapshot_spec.rb +4 -0
  82. data/spec/integration/synthetics_spec.rb +131 -0
  83. data/spec/integration/tag_spec.rb +4 -0
  84. data/spec/integration/usage_spec.rb +4 -0
  85. data/spec/integration/user_spec.rb +4 -0
  86. data/spec/spec_helper.rb +21 -0
  87. data/spec/unit/capistrano_spec.rb +4 -0
  88. data/spec/unit/common_spec.rb +64 -7
  89. data/spec/unit/facade_spec.rb +4 -0
  90. metadata +37 -7
@@ -1,5 +1,37 @@
1
1
  # Changes
2
2
 
3
+ ## 1.42.0 / 2020-09-17
4
+
5
+ * [Added] Allow dashboard creation / updates using Template Variable Presets. See [#238](https://github.com/DataDog/dogapi-rb/pull/238).
6
+
7
+ ## 1.41.0 / 2020-07-27
8
+
9
+ * [Added] Improve user-agent header to include telemetry information. See [#235](https://github.com/DataDog/dogapi-rb/pull/235).
10
+ * [Added] Move setting hostname to end of method body in order to actually return it. See [#233](https://github.com/DataDog/dogapi-rb/pull/233).
11
+
12
+ ## 1.40.0 / 2020-04-06
13
+
14
+ * [Added] Re-add service level objectives support. See [#224](https://github.com/DataDog/dogapi-rb/pull/224).
15
+
16
+ ## 1.39.0 / 2020-02-04
17
+
18
+ * [Added] Allow Setting Proxy without Using HTTP_PROXY, etc.. See [#180](https://github.com/DataDog/dogapi-rb/pull/180). Thanks [KingAlex42](https://github.com/KingAlex42).
19
+ * [Added] [capistrano] Add ability to use `etc.getpwuid` instead of `etc.getlogin` to get the user name. See [#146](https://github.com/DataDog/dogapi-rb/pull/146). Thanks [rkul](https://github.com/rkul).
20
+ * [Fixed] Check exit code of `hostname -f` for failures. See [#219](https://github.com/DataDog/dogapi-rb/pull/219).
21
+ * [Added] Add `validate_tags` util to check that `tags` is an array of strings. See [#218](https://github.com/DataDog/dogapi-rb/pull/218).
22
+ * [Added] Added function to deal with redirection of HTTP requests. See [#200](https://github.com/DataDog/dogapi-rb/pull/200).
23
+ * [Added] Add Synthetics support. See [#210](https://github.com/DataDog/dogapi-rb/pull/210).
24
+ * [Added] Add dashboard read_only option. See [#135](https://github.com/DataDog/dogapi-rb/pull/135). Thanks [tjoyal](https://github.com/tjoyal).
25
+ * [Added] Add options for force delete monitors. See [#213](https://github.com/DataDog/dogapi-rb/pull/213).
26
+
27
+ ## 1.38.0 / 2019-12-13
28
+
29
+ * [BUGFIX] Fix setting keys in both query params and headers. See [#194][]
30
+ * [BUGFIX] Fix `cancel_downtime_by_scope` method by setting `send_json` to `true`. See [#205][]
31
+ * [FEATURE] Add Azure, GCP, AWS, and AWS Logs integration support. See [#201][]
32
+ * [FEATURE] Add support for new `Monitor.can_delete` endpoint. See [#195][]
33
+ * [FEATURE] Add `options` to the `get_downtime` endpoint. See [#206][]
34
+
3
35
  ## 1.37.1 / 2019-11-04
4
36
 
5
37
  * [BUGFIX] Revert the Service Level Objective feature to remove an issue with older versions of Ruby < 2.0. See [#198][]
@@ -261,7 +293,12 @@ This is the last release compatible with Ruby 1.8. ([EOL 2013-06-30](https://www
261
293
  [#188]: https://github.com/DataDog/dogapi-rb/issues/188
262
294
  [#189]: https://github.com/DataDog/dogapi-rb/issues/189
263
295
  [#192]: https://github.com/DataDog/dogapi-rb/issues/192
296
+ [#194]: https://github.com/DataDog/dogapi-rb/issues/194
297
+ [#195]: https://github.com/DataDog/dogapi-rb/issues/195
264
298
  [#198]: https://github.com/DataDog/dogapi-rb/issues/198
299
+ [#201]: https://github.com/DataDog/dogapi-rb/issues/201
300
+ [#205]: https://github.com/DataDog/dogapi-rb/issues/205
301
+ [#206]: https://github.com/DataDog/dogapi-rb/issues/206
265
302
  [@ArjenSchwarz]: https://github.com/ArjenSchwarz
266
303
  [@Kaixiang]: https://github.com/Kaixiang
267
304
  [@TaylURRE]: https://github.com/TaylURRE
@@ -0,0 +1,111 @@
1
+ # How to contribute
2
+
3
+ First of all, thanks for contributing!
4
+
5
+ This document provides some basic guidelines for contributing to this repository. To propose improvements, feel free to submit a PR.
6
+
7
+ ## Reporting a Bug - Requesting a feature - Github Issues
8
+
9
+ * **Ensure the bug was not already reported** by searching on GitHub under [Issues][1].
10
+ * If you're unable to find an open issue addressing the problem, [open a new one][2].
11
+ - **Fill out the issue template completely**. Label the issue properly.
12
+ - Add `severity/` label.
13
+ - Add `documentation` label if this issue is related to documentation changes.
14
+ * If you have a feature request, it is encouraged to [contact support][3] so the request can be prioritized and properly tracked.
15
+ * **Do not open an issue if you have a question**, instead [contact support][3].
16
+
17
+ ## Suggesting an enhancements - Pull Requests
18
+
19
+ Have you fixed an issue? Many thanks!
20
+
21
+ Read the [development guide][/DEVELOPMENT.md] for more information on how to get started.
22
+
23
+ In order to ease/speed up our review, here are some items you can check/improve when submitting your PR:
24
+ * **Ensure an [Issue has been created](#reporting)**.
25
+ * Avoid changing too many things at once.
26
+ - Make sure that your Pull Requests only fixes one Issue at the time.
27
+ * **Write tests** for the code you wrote.
28
+ * Make sure that **all tests pass locally**.
29
+ * Summarize your PR with a **meaningful title** and **fill out the pull request description template completely!**
30
+ * Add the most suitable changelog label choosing one of the following:
31
+ * `changelog/Added` for new features.
32
+ * `changelog/Changed` for changes in existing functionality.
33
+ * `changelog/Deprecated` for soon-to-be removed features.
34
+ * `changelog/Removed` for now removed features.
35
+ * `changelog/Fixed` for any bug fixes.
36
+ * `changelog/Security` in case of vulnerabilities.
37
+ * `changelog/no-changelog` in case this PR should not appear in the changelog at all.
38
+
39
+ See [here][4] for more details about changelogs.
40
+
41
+ Your pull request must pass all CI tests before. If you're seeing
42
+ an error and don't think it's your fault, it may not be! [Join us on Slack][5] or send us an email, and together we'll
43
+ get it sorted out.
44
+
45
+ ### Keep it small, focused
46
+
47
+ Avoid changing too many things at once. For instance if you're fixing two different
48
+ issues at once, it makes reviewing harder and the _time-to-release_ longer.
49
+
50
+ ### Pull Request title
51
+
52
+ Unless the PR is marked with the proper exclusion label, the title will be used
53
+ to automatically fill the changelog entries. For this reason the title must be
54
+ concise but explanatory.
55
+
56
+ ### Commit Messages
57
+
58
+ Please don't be this person: `git commit -m "Fixed stuff"`. Take a moment to
59
+ write meaningful commit messages.
60
+
61
+ The commit message should describe the reason for the change and give extra details
62
+ that will allow someone later on to understand in 5 seconds the thing you've been
63
+ working on for a day.
64
+
65
+ ### Releasing
66
+
67
+ The release procedure is managed by Datadog, instructions can be found in the [RELEASING](/RELEASING.md) document.
68
+
69
+ ## Asking a questions
70
+
71
+ Need help? Contact [Datadog support][3]
72
+
73
+ ## Additional Notes
74
+
75
+ ### Issue and Pull Request Labels
76
+
77
+ This section lists the labels we use to help us track and manage issues and pull requests.
78
+
79
+ | Label name | Usage | Description
80
+ |-------------------------------|--------------------------|------------------------------------------------------------
81
+ | `backward-incompatible` | Issues and Pull Requests | Warn for backward incompatible changes.
82
+ | `changelog/Added` | Pull Request Only | Added features results into a minor version bump.
83
+ | `changelog/Changed` | Pull Request Only | Changed features results into a major version bump.
84
+ | `changelog/Deprecated` | Pull Request Only | Deprecated features results into a major version bump.
85
+ | `changelog/Fixed` | Pull Request Only | Fixed features results into a bug fix version bump.
86
+ | `changelog/no-changelog` | Pull Request Only | Changes don't appear in changelog.
87
+ | `changelog/Removed` | Pull Request Only | Deprecated features results into a major version bump.
88
+ | `changelog/Security` | Pull Request Only | Fixed features results into a bug fix version bump.
89
+ | `community/help-wanted` | Issue Only | Community help wanted.
90
+ | `community` | Issues and Pull Requests | Community driven changes.
91
+ | `dev/testing` | Issues and Pull Requests | Tests related changes.
92
+ | `dev/tooling` | Issues and Pull Requests | Tooling related changes.
93
+ | `do-not-merge/HOLD` | Pull Request Only | Do not merge this PR.
94
+ | `do-not-merge/WIP` | Pull Request Only | Do not merge this PR.
95
+ | `documentation` | Issues and Pull Requests | Documentation related changes.
96
+ | `duplicate` | Issue Only | Duplicate issue.
97
+ | `invalid` | Issue Only | Invalid issue.
98
+ | `kind/bug` | Issue Only | Bug related issue.
99
+ | `kind/feature-request` | Issue Only | Feature request related issue.
100
+ | `severity/critical` | Issue Only | Critical severity issue.
101
+ | `severity/major` | Issue Only | Major severity issue.
102
+ | `severity/minor` | Issue Only | Minor severity issue.
103
+ | `severity/normal` | Issue Only | Normal severity issue.
104
+ | `stale` | Issues and Pull Requests | Stale - Bot reminder.
105
+ | `stale/exempt` | Issues and Pull Requests | Exempt from being marked as stale.
106
+
107
+ [1]: https://github.com/DataDog/dogapi-rb/issues
108
+ [2]: https://github.com/DataDog/dogapi-rb/issues/new
109
+ [3]: https://docs.datadoghq.com/help
110
+ [4]: https://keepachangelog.com/en/1.0.0
111
+ [5]: https://datadoghq.slack.com
@@ -0,0 +1,11 @@
1
+ # Development
2
+
3
+ The API implementation is located in the [`lib/dogapi`](lib/dogapi) folder.
4
+
5
+ ## Testing
6
+
7
+ Test files are located in the [`spec`](spec) folder.
8
+
9
+ ## Coding conventions
10
+
11
+ This project uses rubocop for linting.
data/Gemfile CHANGED
@@ -4,6 +4,8 @@ gemspec
4
4
 
5
5
  group :test do
6
6
  gem 'rubocop', "~> 0.49.0"
7
+ # NOTE: rake < 12.3.3 is vulnerable to CVE-2020-8130, but we only use it as a test dependency
8
+ # and neither our users nor our CI is vulnerable in any way
7
9
  gem 'rake', '>= 2.4.2'
8
10
  gem 'rspec'
9
11
  gem 'simplecov'
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem 'rubocop', "~> 0.41.0"
7
+ # NOTE: rake < 12.3.3 is vulnerable to CVE-2020-8130, but we only use it as a test dependency
8
+ # and neither our users nor our CI is vulnerable in any way
9
+ gem 'rake', '>= 2.4.2'
10
+ gem 'rspec'
11
+ gem 'simplecov', "~> 0.11.2"
12
+ gem 'webmock'
13
+ end
data/LICENSE CHANGED
@@ -1,25 +1,26 @@
1
- Copyright (c) 2011, Datadog <info@datadoghq.com>
2
- All rights reserved.
1
+ Copyright (c) 2011-Present, Datadog <opensource@datadoghq.com>
3
2
 
4
3
  Redistribution and use in source and binary forms, with or without
5
4
  modification, are permitted provided that the following conditions are met:
6
- * Redistributions of source code must retain the above copyright
7
- notice, this list of conditions and the following disclaimer.
8
- * Redistributions in binary form must reproduce the above copyright
9
- notice, this list of conditions and the following disclaimer in the
10
- documentation and/or other materials provided with the distribution.
11
- * Neither the name of the Datadog nor the
12
- names of its contributors may be used to endorse or promote products
13
- derived from this software without specific prior written permission.
14
5
 
15
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
- DISCLAIMED. IN NO EVENT SHALL DATADOG BE LIABLE FOR ANY
19
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6
+ * Redistributions of source code must retain the above copyright notice, this
7
+ list of conditions and the following disclaimer.
25
8
 
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+
13
+ * Neither the name of the copyright holder nor the names of its
14
+ contributors may be used to endorse or promote products derived from
15
+ this software without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,6 @@
1
+ Component,Origin,License,Copyright
2
+ gemfile, rubocop, MIT, Copyright (c) 2012-19 Bozhidar Batsov
3
+ gemfile, rake, MIT, Copyright (c) Jim Weirich
4
+ gemfile, rspec, MIT, Copyright © 2009 Chad Humphries David Chelimsky Copyright © 2006 David Chelimsky The RSpec Development Team Copyright © 2005 Steven Baker
5
+ gemfile, simplecov, MIT, Copyright (c) 2010-2017 Christoph Olszowka
6
+ gemfile, webmock, MIT, Copyright (c) 2009-2010 Bartosz Blimke
@@ -36,6 +36,13 @@ If you get a LoadError, missing mkmf, you need to install the development packag
36
36
 
37
37
  = Usage
38
38
 
39
+ == Supported Versions
40
+
41
+ This project currently works with Ruby versions 1.9.3+
42
+
43
+ *Note* Newer features and new endpoint support may no longer support EOL Ruby versions but
44
+ the client should still intialize and allow metric/event submission.
45
+
39
46
  == How to find your API and application keys
40
47
 
41
48
  Go to your setup page[https://app.datadoghq.com/account/settings].
@@ -147,6 +154,13 @@ data point you will need to pass a list of +Time+, +float+ pairs, instead of a s
147
154
 
148
155
  dog.emit_points('some.metric.name', [[t1, val1], [t2, val2], [t3, val3]], :host => "my_host", :device => "my_device")
149
156
 
157
+ If you want to specify the metric type, using the example above you can pass in a symbol key with :type and a value of a metric type such as counter, gauge or rate.
158
+
159
+ dog.emit_points('some.metric.name', [[t1, val1], [t2, val2], [t3, val3]], :host => "my_host", :device => "my_device", :type => 'counter' )
160
+
161
+ If you want to add metric tags, using the example above you can pass in a symbol key with :tags and an array of tags.
162
+
163
+ dog.emit_points('some.metric.name', [[t1, val1], [t2, val2], [t3, val3]], :host => "my_host", :device => "my_device", :tags => ['frontend', 'app:webserver'] )
150
164
 
151
165
  == Get points from a Datadog metric
152
166
 
@@ -0,0 +1,46 @@
1
+ # Releasing
2
+ This document summarizes the process of doing a new release of this project.
3
+ Release can only be performed by Datadog maintainers of this repository.
4
+
5
+ ## Schedule
6
+ This project does not have a strict release schedule. However, we would make a release at least every 2 months.
7
+ - No release will be done if no changes got merged to the `master` branch during the above mentioned window.
8
+ - Releases may be done more frequently than the above mentioned window.
9
+
10
+ ## Prerelease checklist
11
+ * Check and upgrade dependencies where it applies and makes sense.
12
+ - Create a distinct pull request and test your changes since it may introduce regressions.
13
+ - While using the latest versions of dependencies is advised, it may not always be possible due to potential compatibility issues.
14
+ - Upgraded dependencies should be thoroughly considered and tested to ensure they are safe!
15
+ * Make sure tests are passing.
16
+ - Locally and in the continuous integration system.
17
+ * Manually test changes included in the new release.
18
+ * Make sure documentation is up-to-date.
19
+
20
+ ## Release Process
21
+ ### Prerequisite
22
+ Install [bundler](https://bundler.io/) and setup your RubyGems credentials:
23
+ 1. Register an account on https://rubygems.org/
24
+ 1. *Datadog Admins only* - Be assigned to Datadog's RubyGems gems by an owner.
25
+ 1. Set a `~/.gem/credentials` file as the following:
26
+ ```
27
+ ---
28
+ :rubygems_api_key: $RUBYGEMS_APIKEY
29
+ ```
30
+ 1. Install [datadog_checks_dev](https://datadog-checks-base.readthedocs.io/en/latest/datadog_checks_dev.cli.html#installation) using Python 3.
31
+
32
+ ### Update Changelog
33
+ #### Commands
34
+ - See changes ready for release by running `ddev release show changes .` at the root of this project. Add any missing labels to PRs if needed.
35
+ - Run `ddev release changelog . <NEW_VERSION>` to update the `CHANGELOG.md` file at the root of this repository
36
+ - Commit the changes to the repository in a release branch. Do not merge yet.
37
+
38
+ ### Release
39
+ 1. Update the gem version number in `lib/dogapi/version.rb`, push it to your changelog PR.
40
+ 1. Merge the PR to master.
41
+ 1. Create the release in the [Github releases page](https://github.com/DataDog/dogapi-rb/releases).
42
+ 1. Checkout the tag created at the previous step.
43
+ 1. Build the gem: `bundle exec gem build dogapi.gemspec`.
44
+ 1. Push the gem: `bundle exec gem push dogapi-x.x.x.gem`.
45
+ 1. Check that the [Ruby Gem is published](https://rubygems.org/gems/dogapi).
46
+ 1. Bump the version again in `lib/dogapi/version.rb` to a dev version (e.g. `1.39.0` -> `1.40.0.dev`), open a PR and merge it to master.
@@ -0,0 +1,9 @@
1
+ # Support
2
+
3
+ The issue queue we have here on GitHub is primarily intended for tracking features,
4
+ bugs and work items associated with this Datadog open source project.
5
+
6
+ For any other support request, please reach out through one of the following:
7
+
8
+ * Contact our [support](https://docs.datadoghq.com/help/)
9
+ * Join us [on Slack](http://datadoghq.slack.com)
@@ -33,6 +33,8 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency 'multi_json'
34
34
 
35
35
  spec.add_development_dependency 'bundler', '>= 1.3'
36
+ # NOTE: rake < 12.3.3 is vulnerable to CVE-2020-8130, but we only use it as a test dependency
37
+ # and neither our users nor our CI is vulnerable in any way
36
38
  spec.add_development_dependency 'rake', '~> 10'
37
39
  spec.add_development_dependency 'rdoc'
38
40
  end
@@ -31,5 +31,5 @@ dog.emit_points('test.api.test_metric', points)
31
31
  # Emit differents metrics in a single request to be more efficient
32
32
  dog.batch_metrics do
33
33
  dog.emit_point('test.api.test_metric',10)
34
- dog.emit_point('test.api.this_other_metric', 1, :type => 'counter')
34
+ dog.emit_point('test.api.this_other_metric', 1, :type => 'count')
35
35
  end
@@ -18,7 +18,10 @@ To set up your Capfile:
18
18
  # for instance, only push the production event
19
19
  # set :datadog_event_filter, proc { |event, hosts| event.msg_title.include?('ran production') ? [event, hosts] : nil }
20
20
 
21
+ # (optional) use the `Etc.getlogin` method (default) or the `Etc.getpwuid` method to get the user name
22
+ # default: use `Etc.getlogin`
23
+ # set :use_getlogin, true
24
+
21
25
  You can find your Datadog API key [here](https://app.datadoghq.com/account/settings#api). If you don't have a Datadog account, you can sign up for one [here](http://www.datadoghq.com/).
22
26
 
23
27
  `capistrano/datadog` will capture each Capistrano task that that Capfile runs, including the roles that the task applies to and any logging output that it emits and submits them as events to Datadog at the end of the execution of all the tasks. If sending to Datadog fails for any reason, your scripts will still succeed.
24
-
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require 'etc'
2
6
  require 'digest/md5'
3
7
  require 'timeout'
@@ -24,11 +28,11 @@ module Capistrano
24
28
  @cap_version
25
29
  end
26
30
 
27
- def self.submit(api_key)
31
+ def self.submit(api_key, use_getlogin=true)
28
32
  begin
29
33
  if api_key
30
34
  dog = Dogapi::Client.new(api_key)
31
- reporter.report.each do |event, hosts|
35
+ reporter.report(use_getlogin).each do |event, hosts|
32
36
  if hosts.size > 0
33
37
  hosts.each do |host|
34
38
  dog.emit_event event, host: host
@@ -89,9 +93,9 @@ module Capistrano
89
93
  end
90
94
  end
91
95
 
92
- def report()
96
+ def report(use_getlogin=true)
93
97
  hostname = Dogapi.find_localhost
94
- user = Etc.getlogin
98
+ user = use_getlogin ? Etc.getlogin : Etc.getpwuid.name
95
99
 
96
100
  # Lazy randomness
97
101
  aggregation_key = Digest::MD5.hexdigest "#{Time.new}|#{rand}"
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require 'benchmark'
2
6
  require 'delegate'
3
7
 
@@ -58,7 +62,11 @@ module Capistrano
58
62
  namespace :datadog do
59
63
  desc 'Submit the tasks that have run to Datadog as events'
60
64
  task :submit do |ns|
61
- Capistrano::Datadog.submit variables[:datadog_api_key]
65
+ if variables[:use_getlogin].nil?
66
+ Capistrano::Datadog.submit variables[:datadog_api_key]
67
+ else
68
+ Capistrano::Datadog.submit variables[:datadog_api_key], variables[:use_getlogin]
69
+ end
62
70
  end
63
71
  end
64
72
  end
@@ -1,3 +1,7 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
2
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ # Copyright 2011-Present Datadog, Inc.
4
+
1
5
  require 'benchmark'
2
6
  require 'delegate'
3
7
  require 'sshkit/formatters/pretty'
@@ -76,5 +80,10 @@ end
76
80
 
77
81
  at_exit do
78
82
  api_key = Capistrano::Configuration.env.fetch :datadog_api_key
79
- Capistrano::Datadog.submit api_key
83
+ use_getlogin = Capistrano::Configuration.env.fetch :use_getlogin
84
+ if use_getlogin.nil?
85
+ Capistrano::Datadog.submit api_key
86
+ else
87
+ Capistrano::Datadog.submit api_key, use_getlogin
88
+ end
80
89
  end