<commit_before># Ruby client for Datadog API v1.2.3

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.

# What's new?

## v1.2.x

* You can now manage host tags
* You can now get event details and query the stream in addition to posting events
* Functionality relating to events with a duration has been deprecated
* The underlying clients have been updated to use Datadog's new [https://github.com/DataDog/dogapi/wiki](public HTTP API)

## v1.1.x

* You do not need to use environment variables anymore to use the client.

# Installation

## From Source

Available at: https://github.com/DataDog/dogapi-rb

    $ cd dogapi-rb
    $ rake gem
    $ gem install pkg/dogapi-*.gem

## Using RubyGems

Gem page: https://rubygems.org/gems/dogapi

    $ gem install dogapi

# Usage

## How to find your API and application keys

Go to [https://app.datadoghq.com/account/settings](your setup page).

## 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.

## Submit an event to Datadog

```ruby
require 'rubygems'
require 'dogapi'

api_key = "<KEY>"

# 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

```ruby
require 'rubygems'
require 'dogapi'

api_key = "<KEY>"
application_key = "fedcba654321"<commit_msg>Added the tags argument to the emit_event call to show an example of using tags.<commit_after># Ruby client for Datadog API v1.2.3

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.

# What's new?

## v1.2.x

* You can now manage host tags
* You can now get event details and query the stream in addition to posting events
* Functionality relating to events with a duration has been deprecated
* The underlying clients have been updated to use Datadog's new [https://github.com/DataDog/dogapi/wiki](public HTTP API)

## v1.1.x

* You do not need to use environment variables anymore to use the client.

# Installation

## From Source

Available at: https://github.com/DataDog/dogapi-rb

    $ cd dogapi-rb
    $ rake gem
    $ gem install pkg/dogapi-*.gem

## Using RubyGems

Gem page: https://rubygems.org/gems/dogapi

    $ gem install dogapi

# Usage

## How to find your API and application keys

Go to [https://app.datadoghq.com/account/settings](your setup page).

## 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.

## Submit an event to Datadog

```ruby
require 'rubygems'
require 'dogapi'

api_key = "<KEY>"

# 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", :tags => ["tag1", "tag2", "tag3"])
```

## Tag a host in Datadog

```ruby
require 'rubygems'
require 'dogapi'

api_key = "<KEY>"
application_key = "fedcba654321"
{'fraction_non_alphanumeric': 0.08589462129527992, 'fraction_numerical': 0.007958287596048299, 'mean_word_length': 4.155586987270156, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1706643', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1063, 'n_words': 481}