https://github.com/DataDog/dogapi-rb
Ruby client for Datadog's API
https://github.com/DataDog/dogapi-rb
Keywords from Contributors
apm datadog distributed-tracing tracing debugging profiling activerecord octokit-rb rubygem github-api
Last synced: about 4 hours ago
JSON representation
Repository metadata
Ruby client for Datadog's API
- Host: GitHub
- URL: https://github.com/DataDog/dogapi-rb
- Owner: DataDog
- License: bsd-3-clause
- Created: 2011-03-15T21:55:13.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2025-09-05T18:22:05.000Z (4 months ago)
- Last Synced: 2025-12-19T20:29:03.647Z (21 days ago)
- Language: Ruby
- Homepage: https://www.datadoghq.com
- Size: 695 KB
- Stars: 99
- Watchers: 597
- Forks: 87
- Open Issues: 5
- Releases: 31
-
Metadata Files:
- Readme: README.rdoc
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Support: SUPPORT.md
README.rdoc
= Ruby Client for Datadog API
{
}[http://badge.fury.io/rb/dogapi]
{
}[https://dev.azure.com/datadoghq/dogapi-rb/_build/latest?definitionId=16&branchName=master]
The Ruby client is a library suitable for inclusion in existing Ruby projects or for development of standalone scripts. It provides an abstraction on top of Datadog's raw HTTP interface for reporting events and metrics.
To support all Datadog HTTP APIs, a generated library is
available which will expose all the endpoints:
datadog-api-client-ruby[https://github.com/DataDog/datadog-api-client-ruby].
= What's new?
See CHANGELOG.md for details
= Installation
== From Source
Available at: https://github.com/DataDog/dogapi-rb
$ cd dogapi-rb
$ bundle
$ rake install
== Using RubyGems
Gem page: https://rubygems.org/gems/dogapi
$ gem install dogapi
If you get a permission error, you might need to run the install process with sudo:
$ sudo gem install dogapi
If you get a LoadError, missing mkmf, you need to install the development packages for ruby.
# on ubuntu e.g.
$ sudo apt-get install ruby-dev
= Usage
== Supported Versions
This project currently works with Ruby versions 1.9.3+
*Note* Newer features and new endpoint support may no longer support EOL Ruby versions but
the client should still intialize and allow metric/event submission.
== How to find your API and application keys
Go to your setup page[https://app.datadoghq.com/account/settings].
== A word about hosts and devices
Events and metric data points can be attached to hosts
to take advantage of automatic tagging with the host's tags.
If you want to attach events and points to a specific device
on a host, simply specify the device when calling emit functions.
== Configure the Datadog API Url
require 'rubygems'
require 'dogapi'
api_key = "abcdef123456"
application_key = "fedcba654321"
# by default the API Url will be set to https://api.datadoghq.com
dog = Dogapi::Client.new(api_key, application_key)
p dog.datadog_host # prints https://api.datadoghq.com
# API Url can be passed to the initializer...
dog = Dogapi::Client.new(api_key, application_key, nil, nil, nil, nil, 'https://myproxy.local')
p dog.datadog_host # prints https://myproxy.local
# ...or set on the client instance directly
dog = Dogapi::Client.new(api_key, application_key)
dog.datadog_host = 'https://myproxy.local'
p dog.datadog_host # prints https://myproxy.local
# in any case, contents of the DATADOG_HOST env var take precedence
ENV['DATADOG_HOST'] = https://myproxy.local
dog = Dogapi::Client.new(api_key, application_key)
p dog.datadog_host # prints https://myproxy.local
== Submit an event to Datadog
require 'rubygems'
require 'dogapi'
api_key = "abcdef123456"
# submitting events doesn't require an application_key, so we don't bother setting it
dog = Dogapi::Client.new(api_key)
dog.emit_event(Dogapi::Event.new('Testing done, FTW'), :host => "my_host")
== Tag a host in Datadog
require 'rubygems'
require 'dogapi'
api_key = "abcdef123456"
application_key = "fedcba654321"
dog = Dogapi::Client.new(api_key, application_key)
dog.add_tags("my_host", ["tagA", "tagB"])
== Submit a metric to Datadog
You want to track a new metric called +some+.+metric+.+name+ and have just sampled it from +my_device+ on +my_host+.
Its value is 50. Here is how you submit the value to Datadog.
require 'rubygems'
require 'dogapi'
api_key = "abcdef123456"
# submitting metrics doesn't require an application_key, so we don't bother setting it
dog = Dogapi::Client.new(api_key)
dog.emit_point('some.metric.name', 50.0, :host => "my_host", :device => "my_device")
Let us now assume that you have sampled the metric multiple times and you would like to submit the results.
You can use the +emit_points+ method (instead of +emit_point+). Since you are submitting more than one
data point you will need to pass a list of +Time+, +float+ pairs, instead of a simple +float+ value.
require 'rubygems'
require 'dogapi'
# Actual sampling takes place
t1 = Time.now
val1 = 50.0
# some time elapses
t2 = Time.now
val2 = 51.0
# some more time elapses
t3 = Time.now
val3 = -60.0
api_key = "abcdef123456"
dog = Dogapi::Client.new(api_key)
dog.emit_points('some.metric.name', [[t1, val1], [t2, val2], [t3, val3]], :host => "my_host", :device => "my_device")
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.
dog.emit_points('some.metric.name', [[t1, val1], [t2, val2], [t3, val3]], :host => "my_host", :device => "my_device", :type => 'counter' )
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.
dog.emit_points('some.metric.name', [[t1, val1], [t2, val2], [t3, val3]], :host => "my_host", :device => "my_device", :tags => ['frontend', 'app:webserver'] )
== Get points from a Datadog metric
require 'rubygems'
require 'dogapi'
api_key = "abcd123"
application_key = "brec1252"
dog = Dogapi::Client.new(api_key, application_key)
# get points from the last hour
from = Time.now - 3600
to = Time.now
query = 'sum:metric.count{*}.as_count()'
dog.get_points(query, from, to)
Owner metadata
- Name: Datadog, Inc.
- Login: DataDog
- Email: info@datadoghq.com
- Kind: organization
- Description:
- Website: https://datadoghq.com
- Location: New York
- Twitter: datadoghq
- Company:
- Icon url: https://avatars.githubusercontent.com/u/365230?v=4
- Repositories: 968
- Last ynced at: 2024-04-15T05:05:10.008Z
- Profile URL: https://github.com/DataDog
GitHub Events
Total
- Watch event: 2
- Delete event: 3
- Push event: 6
- Pull request review event: 1
- Pull request event: 7
- Create event: 4
Last Year
- Watch event: 2
- Delete event: 3
- Push event: 6
- Pull request review event: 1
- Pull request event: 7
- Create event: 4
Committers metadata
Last synced: 1 day ago
Total Commits: 501
Total Committers: 85
Avg Commits per committer: 5.894
Development Distribution Score (DDS): 0.888
Commits in past year: 3
Committers in past year: 2
Avg Commits per committer in past year: 1.5
Development Distribution Score (DDS) in past year: 0.333
| Name | Commits | |
|---|---|---|
| Mike Fiedler | m****n@g****m | 56 |
| Carlo Cabanilla | c****o@d****m | 42 |
| Matt Singleton | m****t@d****m | 36 |
| Alexis Lê-Quôc | a****q@d****m | 32 |
| Quentin Madec | q****c@d****m | 32 |
| Conor Branagan | c****n@g****m | 29 |
| Hippolyte HENRY | z****e | 21 |
| Matt Perpick | m****k@g****m | 21 |
| Matt Singleton | m****n@g****m | 21 |
| Massimiliano Pippi | m****i@g****m | 18 |
| Arthur Wang | a****r@d****m | 15 |
| Nicholas Muesch | n****h@d****m | 15 |
| Yann Mahe | y****n@d****m | 13 |
| Aaron Kalin | a****n@m****m | 11 |
| Seth Rosenblum | s****h@d****m | 11 |
| Rudy | r****y@d****m | 9 |
| Rami Enbashi | r****i@d****m | 8 |
| Slavek Kabrda | s****a@d****m | 5 |
| Charles Lai | c****i@d****m | 5 |
| Gregory Zussa | g****a | 5 |
| ericmustin | m****c@g****m | 5 |
| jack-edmonds-dd | j****s@d****m | 4 |
| Andrew McBurney | a****w@m****l | 3 |
| Isaac Sadaqah | i****c@d****m | 3 |
| Jean Boussier | j****r@g****m | 3 |
| Jiri Kuncar | j****r@d****m | 3 |
| Marie-Laure Bardonnet | m****t@d****m | 3 |
| talwai | a****1@g****m | 3 |
| Patrick Cockwell | p****l@g****m | 2 |
| Russell Egan | r****n@s****m | 2 |
| and 55 more... | ||
Committer domains:
- datadoghq.com: 31
- airbnb.com: 2
- martinisoftware.com: 1
- mcburney.email: 1
- safenet-inc.com: 1
- orien.io: 1
- shoprunner.com: 1
- realgravity.com: 1
- grymonpon.be: 1
- moriz.de: 1
- cloudpack.jp: 1
- shopify.com: 1
- indeed.com: 1
- cookpad.com: 1
- evolution7.com.au: 1
- hilscher.ca: 1
- pivotal.io: 1
- atlassian.com: 1
Issue and Pull Request metadata
Last synced: 15 days ago
Total issues: 27
Total pull requests: 89
Average time to close issues: about 2 years
Average time to close pull requests: 2 months
Total issue authors: 26
Total pull request authors: 40
Average comments per issue: 3.44
Average comments per pull request: 1.08
Merged pull request: 71
Bot issues: 0
Bot pull requests: 0
Past year issues: 1
Past year pull requests: 13
Past year average time to close issues: 2 days
Past year average time to close pull requests: about 15 hours
Past year issue authors: 1
Past year pull request authors: 5
Past year average comments per issue: 2.0
Past year average comments per pull request: 0.23
Past year merged pull request: 9
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- celenechang (2)
- SteveAlexander (1)
- LeoCavaille (1)
- dudo (1)
- parkr (1)
- frmsaul (1)
- toddself (1)
- agirlnamedsophia (1)
- rmoriz (1)
- ktimothy (1)
- WToorenburghIntiveo (1)
- clarkedb (1)
- dn (1)
- l0k0ms (1)
- seth-outreach (1)
Top Pull Request Authors
- zippolyte (18)
- jack-edmonds-dd (7)
- bkabrda (6)
- nmuesch (6)
- armcburney (5)
- gzussa (5)
- jirikuncar (3)
- xopham (2)
- albertvaka (2)
- therve (2)
- Ricky-Thomas (2)
- drichards-87 (2)
- tjoyal (2)
- parkr (1)
- juliendoutre (1)
Top Issue Labels
- kind/bug (8)
- stale (7)
- kind/feature-request (4)
- community/help-wanted (1)
- changelog/no-changelog (1)
- mergequeue-status: in_progress (1)
Top Pull Request Labels
- changelog/no-changelog (30)
- documentation (16)
- changelog/Added (15)
- changelog/Fixed (7)
- kind/feature-request (3)
- dev/tooling (1)
- dev/testing (1)
- community (1)
- mergequeue-status: done (1)
- stale (1)
Package metadata
- Total packages: 4
-
Total downloads:
- rubygems: 201,261,356 total
- Total docker downloads: 1,036,946
- Total dependent packages: 55 (may contain duplicates)
- Total dependent repositories: 260 (may contain duplicates)
- Total versions: 234
- Total maintainers: 3
gem.coop: dogapi
Ruby bindings for Datadog's API
- Homepage: http://datadoghq.com/
- Documentation: http://www.rubydoc.info/gems/dogapi/
- Licenses: BSD
- Latest release: 1.45.0 (published almost 5 years ago)
- Last Synced: 2026-01-08T04:20:31.946Z (2 days ago)
- Versions: 69
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 100,630,678 Total
- Docker Downloads: 518,473
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Downloads: 0.25%
- Average: 0.434%
- Docker downloads count: 1.487%
- Maintainers (3)
rubygems.org: dogapi
Ruby bindings for Datadog's API
- Homepage: http://datadoghq.com/
- Documentation: http://www.rubydoc.info/gems/dogapi/
- Licenses: BSD
- Latest release: 1.45.0 (published almost 5 years ago)
- Last Synced: 2026-01-08T04:20:26.040Z (2 days ago)
- Versions: 69
- Dependent Packages: 55
- Dependent Repositories: 260
- Downloads: 100,630,678 Total
- Docker Downloads: 518,473
-
Rankings:
- Downloads: 0.226%
- Dependent packages count: 0.487%
- Dependent repos count: 1.928%
- Docker downloads count: 2.191%
- Average: 2.209%
- Forks count: 2.76%
- Stargazers count: 5.66%
- Maintainers (3)
proxy.golang.org: github.com/DataDog/dogapi-rb
- Homepage:
- Documentation: https://pkg.go.dev/github.com/DataDog/dogapi-rb#section-documentation
- Licenses: bsd-3-clause
- Latest release: v1.45.0 (published almost 5 years ago)
- Last Synced: 2026-01-08T04:20:29.434Z (2 days ago)
- Versions: 48
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 5.406%
- Average: 5.587%
- Dependent repos count: 5.769%
proxy.golang.org: github.com/datadog/dogapi-rb
- Homepage:
- Documentation: https://pkg.go.dev/github.com/datadog/dogapi-rb#section-documentation
- Licenses: bsd-3-clause
- Latest release: v1.45.0 (published almost 5 years ago)
- Last Synced: 2026-01-08T04:20:30.900Z (2 days ago)
- Versions: 48
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 5.406%
- Average: 5.587%
- Dependent repos count: 5.769%
Dependencies
- ddtrace >= 0 development
- rspec >= 0 development
- rubocop ~> 0.49.0 development
- simplecov >= 0 development
- webmock >= 0 development
- bundler >= 1.3 development
- rake ~> 10 development
- rdoc >= 0 development
- multi_json >= 0
- actions/checkout v3 composite
- github/codeql-action/analyze v2 composite
- github/codeql-action/autobuild v2 composite
- github/codeql-action/init v2 composite
- DataDog/labeler glob-all composite
- actions/stale v1 composite
Score: 28.212297695512493