DdPostGauge
CLI for posting gauge of custom metrics by using DataDog/datadog-api-client-ruby for Datadog.
Example
Install this Gem. See Installation.
Get Datadog API key from Organaization Settings > API Keys
. See api key and datadog site.
Confirm Datadog site. See api key and datadog site.
Prepare ./.env
and replace dummy data.
$ cp .env.sample .env
.env
file
DATADOG_API_KEY=XXXXXXXX
DATADOG_SITE=us5.datadoghq.com
Post 4 points of the gauge to Datadog.
Metrics namae -> hoge.test.ping
Metrics value -> 10, 50, 20, 70 (4 points)
Tag -> host
Tag value -> my.favoite.site.com
$ dd_post_gauge -m hoge.test.ping -v 10 -t host -r my.favoite.site.com
$ dd_post_gauge -m hoge.test.ping -v 50 -t host -r my.favoite.site.com
$ dd_post_gauge -m hoge.test.ping -v 20 -t host -r my.favoite.site.com
$ dd_post_gauge -m hoge.test.ping -v 70 -t host -r my.favoite.site.com
Confirming the posted result in Datadog.
You can use posted your metrics in the dashboard like other metrics.
Installation
Install the gem and add to the application's Gemfile by executing:
$ bundle add dd_post_gauge
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install dd_post_gauge
Usage
$ dd_post_gauge -m <metric_name> -v <metric_value> -r <metric_resource_name> -t <metric_resource_type> -k <api_key> -s <datadog site>
metric_name
and metric_value
are required.
metric_resource_name
and metric_resource_type
are optional.
if you have .env
in the directory and set following variables, you can omit the api_key
and datadog site
options.
DATADOG_API_KEY=XXXXXXXXXXXXXXXXXXXX
DATADOG_SITE=datadoghq.com
See .sample.env
.
api key and datadog site
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/junara/dd_post_gauge. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the DdPostGauge project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.