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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dreki-gg/pi-datadog

v0.3.0

Published

Datadog log search tools for pi — query production logs with project-aware context

Downloads

239

Readme

@dreki-gg/pi-datadog

Datadog log and RUM search tools for pi — query production logs and Real User Monitoring sessions with project-aware context.

Setup

1. Install

pi install npm:@dreki-gg/pi-datadog

2. Set credentials

Export your Datadog API and Application keys as environment variables:

export DD_API_KEY="your-datadog-api-key"
export DD_APP_KEY="your-datadog-app-key"

Tip: Add these to your shell profile (~/.zshrc, ~/.bashrc) or use a .env manager. Never commit credentials to version control.

You need an Application Key (not just an API key) because log search uses Datadog's read endpoints.

3. Configure your project (optional)

Create .pi/datadog.json in your project root to set defaults:

{
  "service": "my-api",
  "env": "production",
  "site": "datadoghq.com",
  "defaultTags": ["team:backend"],
  "defaultTimeRange": "1h",
  "rumApplicationId": "abcd-1234",
  "rumService": "web-frontend"
}

| Field | Description | Default | |-------|-------------|---------| | service | Default service name for queries | (none) | | env | Default environment | (none) | | site | Datadog site | datadoghq.com | | defaultTags | Tags auto-appended to every query | [] | | defaultTimeRange | Default lookback window | 1h | | rumApplicationId | Default RUM application id (@application.id) for RUM searches | (none) | | rumService | Default service for RUM searches (falls back to service) | (none) |

Supported sites: datadoghq.com (US1), us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu (EU).

Usage

Natural language

Just ask pi to search your logs:

> Show me the errors in production from the last 30 minutes
> What's causing the 500 errors on the payments service?
> Find logs with "timeout" in staging from the past 24 hours

The agent uses your .pi/datadog.json defaults automatically — you don't need to specify service or environment unless you want to override them.

You can also ask about front-end / RUM sessions:

> Show me RUM sessions from the last hour
> Find RUM errors on the checkout view in production
> What views did users hit in the last 30 minutes?

Tool: datadog_logs_search

The agent calls this tool with Datadog query syntax:

| Parameter | Type | Description | |-----------|------|-------------| | query | string | Required. Datadog log query (e.g. status:error, @http.status_code:500) | | from | string | Start time — relative (15m, 1h, 7d) or ISO 8601 | | to | string | End time — relative, ISO 8601, or now | | limit | number | Max results (1–100, default 25) | | sort | string | newest or oldest | | service | string | Override project default service | | env | string | Override project default environment |

The agent receives a compact inline digest (counts, status breakdown, services). The full, untruncated log entries are written to a temp file whose path is in the response — the agent reads that file with the read tool to inspect actual content.

Tool: datadog_rum_search

Searches Datadog RUM events (sessions, views, actions, front-end errors) with RUM query syntax. Defaults to session events (@type:session) when the query omits @type.

| Parameter | Type | Description | |-----------|------|-------------| | query | string | Required. RUM query (e.g. @type:session, @type:error, @view.url_path:/checkout). Leave empty to list recent sessions | | from | string | Start time — relative (15m, 1h, 7d) or ISO 8601 | | to | string | End time — relative, ISO 8601, or now | | limit | number | Max results (1–100, default 25) | | sort | string | newest or oldest | | service | string | Override project default RUM service | | env | string | Override project default environment | | applicationId | string | Override project default RUM application id (@application.id) |

Like the logs tool, it returns a compact digest inline (counts, event-type breakdown, services) and writes the full events to a rum-*.md temp file the agent can read.

Command: /datadog

Check your configuration and connection status:

/datadog

Shows: credential status (set/missing), project config (service, env, site, tags, RUM application, RUM service).

Query Syntax Examples

status:error                          # All errors
service:my-api status:error           # Errors for a specific service
@http.status_code:500                 # 500 errors
"connection refused"                  # Full-text search
service:my-api env:production @duration:>5000  # Slow requests

See the Datadog Log Search Syntax docs for the full reference.

RUM query examples

@type:session                          # User sessions (the default)
@type:error                            # Front-end errors
@type:view @view.url_path:/checkout    # Views on the checkout page
@type:session @session.type:user       # Real user sessions (exclude synthetics)
@application.id:abcd-1234 @type:action # Actions in a specific RUM application

See the RUM Search Syntax docs for the full reference.

How It Works

  1. The extension loads .pi/datadog.json from your project on session start
  2. When the agent calls datadog_logs_search, it merges your query with project defaults (service, env, tags)
  3. Results are formatted as markdown with status icons, truncated messages, and key attributes
  4. The agent receives structured metadata (status breakdown, services found) to summarize intelligently

License

MIT