npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hubot-datadog-snapshot

v0.1.0

Published

Hubot script for querying Datadog graph snapshots

Downloads

6

Readme

hubot-datadog-snapshot

Hubot script for querying Datadog graph snapshots

Installation

First, in your Hubot repository run:

npm install hubot-datadog-snapshot --save

Next, add hubot-datadog-snapshot to your external-scripts.json file:

[
  // ...,
  "hubot-datadog-snapshot"
]

Configuration

There are a couple pieces of required configuration to get things working:

  • HUBOT_DATADOG_API_KEY: Your Datadog API key
  • HUBOT_DATADOG_APP_KEY: Your Datadog app key

You can set these up in your Datadog dashboard.

There is also one optional piece of configuration:

  • HUBOT_DATADOG_GRAPH_RESPONSE_DELAY: time to pause (in milliseconds) in between receiving a graph URL from Datadog and sending it to the room

The reason for this option is that even though Datadog will return a URL right away, often it takes a second or two for the graph to actually be available. This can result in the image not automatically loading when the message is received in something like Slack or HipChat because the request would fail. The default value for this is 2 seconds.

Example Interactions

Querying with Datadog's Query Language

To get started you can take a query from your Datadog dashboard and run it here:

greg> hubot datadog query 24h avg:system.cpu.user
hubot> https://datadog/url

The time period can be defined in seconds (s), minutes (m), hours (h), or days (d). You can also omit the time period and it will default to one hour.

Saving a Query

Hubot will always keep track of the last query requested by each user, making it simple to save it for future use. This is done on a per-user basis so there's no need to worry about multiple users querying things at once. This is the only user-specific interaction, so all other commands (including the saved queries themselves) are globally available.

To save a query:

greg> hubot datadog save that as cpu
hubot> Shell: I saved that graph for you as `cpu`

Listing Saved Queries

You can also easily pull a list of all saved queries:

greg> hubot datadog list
hubot> I have the following saved queries :sparkles:

cpu

Running a Saved Query

You can also use the same query syntax from earlier to run saved queries by providing the name of that query instead of the Datadog query itself:

greg> hubot datadog query cpu
hubot> https://datadog/url

The time period specification is identical as well, and also defaults to one hour.

greg> hubot datadog query 7d cpu
hubot> https://datadog/url

Describing a Saved Query

Forgot what the actual query is behind one of your saved queries? No problem!

greg> hubot datadog describe cpu
hubot> Shell: That query is defined as `avg:system.cpu.user`

Deleting a Saved Query

You can quickly delete a saved query as well:

greg> hubot datadog delete cpu
hubot> Shell: I deleted the query `cpu`

Shorthand

For all of these commands you have the option of using hubot dd instead of hubot datadog as a convenient shorthand to save those valuable keystrokes.