Giter Club home page Giter Club logo

doggy's Introduction

Doggy

Build Status

Doggy manages your DataDog dashboards, alerts, monitors, and screenboards.

Installation

Add this line to your Gemfile:

gem 'doggy'

And then execute:

$ bundle

Or install it yourself as:

$ gem install doggy

Authentication

To authenticate, you need to set API and APP keys for your DataDog account.

Environment variables

Export DATADOG_API_KEY and DATADOG_APP_KEY environment variables and doggy will catch them up automatically.

Optional: You can set DATADOG_BASE_HUMAN_URL environment variable if your organization uses a custom domain. This will change the urls given to users.

json (plaintext)

If you're feeling adventurous, just put plaintext secrets.json in your root object store like this:

{
  "datadog_api_key": "key1",
  "datadog_app_key": "key2"
}

Optional: Add datadog_base_human_url if your organization uses a custom domain.

Usage

# Syncs local changes to Datadog since last deploy.
$ doggy sync

# Download items. If no ID is given it will download all the items managed by dog.
$ doggy pull [IDs]

# Upload items to Datadog. If no ID is given it will push all items.
$ doggy push [IDs]

# Edit an item in WYSIWYG
$ doggy edit ID

# Delete selected items from both Datadog and local storage
$ doggy delete IDs

# Mute monitor(s) forever
$ doggy mute IDs

# Unmute monitor(s)
$ doggy unmute IDs

Multiple IDs should be separated by space.

Development

After checking out the repo, run bundle install to install dependencies.

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 to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

  1. Fork it ( https://github.com/shopify/doggy/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

doggy's People

Contributors

elvinefendi avatar bai avatar pfryerdavis avatar stefanmb avatar jules2689 avatar tjoyal avatar kvs avatar girasquid avatar marc-barry avatar shopify-rails[bot] avatar etiennebarrie avatar

Stargazers

Andrew Gerst avatar Sissy  avatar  avatar Willian César avatar Ole J. Rosendahl avatar Ryan Macdonald avatar Alejandro Falkowski avatar Jim Park avatar Rowan avatar Matthew Moore avatar micnncim avatar Ryan Ooi avatar Felipe Monteiro avatar Josh Rowley avatar Blaine Schanfeldt avatar Rori Kurniadi avatar Bernie Chiu avatar  avatar Nico Suárez-Cantón avatar Owen Hael avatar Peter Zhu avatar Chris Scheib avatar Daniel Kertesz avatar Jaehoon Choi avatar Sam Mingo avatar Chris Kelner avatar Rafael Carvalho avatar Steve Frank avatar Minho Ryang avatar Joe Block avatar Shota Terashita avatar Mark St.Godard avatar Jonathan Tsai avatar  avatar Javier Honduvilla Coto avatar Patrik Ragnarsson avatar Maxime Orefice avatar Kirk Russell avatar Yohei Kawahara avatar

Watchers

Lourens Naudé avatar Christian Zacharias avatar Elvio Vicosa avatar Jeff Bruton avatar  avatar Rafal Piekarski avatar Lucas Souza avatar Theo Oikonomou avatar Keir Whitaker avatar Jamie Sutton avatar Javier Jiménez avatar Rohit Mishra avatar Stella Miranda avatar Bart Zonneveld avatar Caroline avatar Ben Watts avatar Ben Doyle avatar Karl Baumgartner avatar Stephen Hunter avatar Peter Nitsch avatar Chris Caldwell avatar Jérémy Fache avatar tetchi avatar Jon Yonker avatar Lucas Medeiros avatar Jeremy W. Rowe avatar Paulo Monçores avatar  avatar Dan Menard avatar Mark Ryan avatar Mladen Rangelov avatar Peter de Wit avatar  avatar Sebastian Skopp avatar James Cloos avatar Ivan Savytskyi avatar Misha Korablin avatar Gregory Ciotti avatar Ryan Self avatar Vadym Tyemirov avatar Marcelo nakashima de brito avatar Corwin Brown avatar  avatar João Júnior avatar Daniel Leroux avatar Igor Kozlov avatar Daniel Molnar avatar Chris Shaw avatar Andrea Di Persio avatar Tim Lombardo avatar Javier Barrera avatar  avatar Kaj Drobin avatar Conor Malone avatar Mounir avatar josh sucher avatar Justin Gaskin avatar Satish Kanwar avatar Niko Kurtti avatar Liz McDonald avatar  avatar Riley Shott avatar Thomaz de Oliveira dos Reis avatar Ann  Wallace avatar Sherry Shao avatar Pablo Vallejo avatar Brandon avatar Vitor Rigoni avatar Dan Winkler avatar Sameer Ahmed avatar Louis Kearns avatar Weslley Araujo avatar Marc Thomas avatar  avatar Yungjae avatar Jared Rader avatar Robleh Jama avatar  avatar  avatar Damyan Petkov avatar Armando avatar David Little avatar Guillaume Fortin avatar Nicholas Simmons avatar  avatar Amar Jasarbasic avatar Kirsten Westeinde avatar Rodrigo Tello avatar Solmaz avatar Sergiy Dybskiy avatar Simon Gussing avatar Kayla Boyer avatar Michael Beddall avatar Pauline Ramos avatar  avatar Ed Chun avatar Anna Lambert avatar Natalia Stele avatar Bernardo Camilo avatar Sergio Roysen avatar

doggy's Issues

Reliance on rugged/libgit2 rename detection can cause accidental deletions

Summary

doggy sync can mis-identify renamed files as file delete + file add pairs, resulting in the unintentional deletion of objects from Datadog.

Details

Doggy relies on Rugged::Diff#find_similar! to distinguish renamed files from additions and deletions. Since git does not directly track renames, libgit2 implements a heuristic for rename detection, converting pairs of file add and file delete deltas in the diff into rename deltas if the contents are sufficiently similar.

Doggy marks a Datadog object for deletion if a deletion delta still exists for the corresponding file after calling find_similar! to execute the rename detection algorithm.

It's possible to defeat this heuristic by making alterations to a file in the same commit as a rename. If this happens, the original add/delete deltas will remain, and Doggy will treat the object as deleted. Running doggy sync will delete the object from Datadog. Since Datadog IDs are automatically generated, this will break any previously existing links to the object, even if the object is recreated from git.

Libgit2 needs to implement rename detection in the general case, for files with arbitrary contents. We don't have the same restriction: our Datadog object files have a persistent ID, which must be preserved across renames. Instead of relying on find_similar! to distinguish deletions from renames, we should look for file add + file delete pairs for files containing the same object ID and treat these as modifications instead.

Support Groups

Currently, doggy appears to drop group definitions, which makes managed dashboards much harder to read.

Raw API

{
  "notify_list": null,
  "description": "",
  "template_variables": [],
  "is_read_only": false,
  "id": "djn-unf-9m9",
  "title": "Istio (temp)",
  "url": "/dashboard/djn-unf-9m9/istio-temp",
  "created_at": "2019-03-15T20:26:10.086473+00:00",
  "modified_at": "2019-03-15T20:34:46.287203+00:00",
  "author_handle": "[email protected]",
  "widgets": [
    {
      "definition": {
        "widgets": [
          {
            "definition": {
              "requests": [
                {
                  "q": "avg:envoy.server.live{*}",
                  "style": {
                    "line_width": "normal",
                    "palette": "dog_classic",
                    "line_type": "solid"
                  },
                  "display_type": "line"
                }
              ],
              "type": "timeseries",
              "title": "Envoy Servers"
            },
            "id": 6484880803725222
          },
          {
            "definition": {
              "requests": [
                {
                  "q": "avg:envoy.http.rq_total{*}.as_count()",
                  "style": {
                    "line_width": "normal",
                    "palette": "dog_classic",
                    "line_type": "solid"
                  },
                  "display_type": "bars"
                }
              ],
              "type": "timeseries",
              "title": "Envoy Requests"
            },
            "id": 1188283215391254
          }
        ],
        "layout_type": "ordered",
        "type": "group",
        "title": "Envoy Group"
      },
      "id": 1237966659375890
    },
    {
      "definition": {
        "requests": [
          {
            "q": "avg:istio.mesh.request.count{*}",
            "style": {
              "line_width": "normal",
              "palette": "dog_classic",
              "line_type": "solid"
            },
            "display_type": "line"
          }
        ],
        "type": "timeseries",
        "title": "Istio Requests"
      },
      "id": 3239689418669054
    }
  ],
  "layout_type": "ordered"
}

Via doggy

{
  "description": "",
  "graphs": [
    {
      "definition": {
        "requests": [
          {
            "q": "avg:envoy.server.live{*}",
            "style": {
              "palette": "dog_classic",
              "type": "solid",
              "width": "normal"
            },
            "type": "line"
          }
        ],
        "viz": "timeseries"
      },
      "title": "Envoy Servers"
    },
    {
      "definition": {
        "requests": [
          {
            "q": "avg:envoy.http.rq_total{*}.as_count()",
            "style": {
              "palette": "dog_classic",
              "type": "solid",
              "width": "normal"
            },
            "type": "bars"
          }
        ],
        "viz": "timeseries"
      },
      "title": "Envoy Requests"
    },
    {
      "definition": {
        "requests": [
          {
            "q": "avg:istio.mesh.request.count{*}",
            "style": {
              "palette": "dog_classic",
              "type": "solid",
              "width": "normal"
            },
            "type": "line"
          }
        ],
        "viz": "timeseries"
      },
      "title": "Istio Requests"
    }
  ],
  "id": 1113729,
  "read_only": true,
  "template_variables": [
  ],
  "title": "Istio (temp)"
}

cc: @dwradcliffe, @stefanmb

The doggy emoji

Would it be possible to make the addition of a 🐶 emoji suffix optional?

Make doggy 2.0 compatible

Ruby 2.0 is the default Ruby version on OSX; it would be nice if doggy could work with that without having to install Ruby.

Add support for "doggy delete ID ID ID"

@ElvinEfendi

Related: #12.

The README states under Usage the following:

# Delete selected items from both DataDog and local storage
$ doggy delete ID ID ID

But that functionality isn't actually supported. This is issue is for adding support for this functionality.

Handle git-deletions

When running doggy push (as we do on deploy), it'd be nice if Doggy would handle object deletions in the source git repo.

Add support for "doggy push ID ID ID"

The README states under Usage the following:

# Upload selected items to DataDog
$ doggy push ID ID ID

But that functionality isn't actually supported. This is issue is for adding support for this functionality.

Rugged dependecny: Needed to be updated to 0.26.0

Hi,

The rugged version is needed to be updated to "0.26.0". Currently, it is listed as "0.23.2" in the dependencies (doggy.gemspec), and there is an error while compiling:

error: dereferencing pointer to incomplete type ‘BIO {aka struct bio_st}’

The error also appears when Rugged 0.23.2 is directly installed (not as a dependency of doggy). However, there is no error when rugged 0.26.0 is directly installed.

Thanks.

Mute monitors when editing clone

Currently, one can do a doggy edit 123456 to edit an object. When the monitor is cloned it isn't muted. I think this should be the default state of a monitor currently under edit to prevent this monitor from firing. I think this can simply be done by creating the clone with the silenced option. See http://docs.datadoghq.com/api/#monitors for details.

`NoMethodError: undefined method `+' for nil:NilClass` on doggy push

  • What did you do?

    I ran the command /home/vagrant/.gem/ruby/2.1.6/bin/doggy push 124448

  • What did you expect to happen?

    I expected Doggy to push 124448.json to data dog

  • What happened instead?

    Instead, what actually happened was it barfed, see stack trace below

Error details

NoMethodError: undefined method `+' for nil:NilClass
  /home/vagrant/.gem/ruby/2.1.6/gems/doggy-0.2.0/lib/doggy/model/monitor.rb:95:in `push'
  /home/vagrant/.gem/ruby/2.1.6/gems/doggy-0.2.0/lib/doggy/model/monitor.rb:16:in `block in upload'
  /home/vagrant/.gem/ruby/2.1.6/gems/doggy-0.2.0/lib/doggy/worker.rb:21:in `call'
  /home/vagrant/.gem/ruby/2.1.6/gems/doggy-0.2.0/lib/doggy/worker.rb:21:in `block (2 levels) in call'
  /home/vagrant/.gem/ruby/2.1.6/gems/thread-0.2.2/lib/thread/pool.rb:67:in `call'
  /home/vagrant/.gem/ruby/2.1.6/gems/thread-0.2.2/lib/thread/pool.rb:67:in `execute'
  /home/vagrant/.gem/ruby/2.1.6/gems/thread-0.2.2/lib/thread/pool.rb:405:in `block (2 levels) in spawn_thread'
  /home/vagrant/.gem/ruby/2.1.6/gems/thread-0.2.2/lib/thread/pool.rb:372:in `loop'
  /home/vagrant/.gem/ruby/2.1.6/gems/thread-0.2.2/lib/thread/pool.rb:372:in `block in spawn_thread'

Support for sorting JSON

The Datadog API returns JSON keys in different order making checking for changes with doggy pull very hard when you have a lot of dashboards, monitors and screens. Support for sorting of the JSON is needed so that when the JSON doesn't change, and only the orders does, that we don't see a change from Git's perspective.

Note that I have even seen that pulling the same object more then once results in differently ordered JSON coming from the Datadog API.

Requirements are not properly defined in documentation

It looks like most of this was built for use with ShipIt, but there's nothing in the documentation. The "sync" command does not work, as it checks datadog for recent deploy events from ShipIt.

To do a pull you have to first create the "objects" directory, otherwise it fails.

Was this ever meant to be used as a standalone tool?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.