apm-configuration

Manage Datadog APM retention filters and span-based metrics via the pup CLI.

5|2|Updated Mar 9, 2026
One-click install
npx skills add https://github.com/lauhon/pi --skill apm-configuration-lauhon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: apm-configuration
Source: https://github.com/lauhon/pi/tree/main/skills/apm-configuration
Command: npx skills add https://github.com/lauhon/pi --skill apm-configuration-lauhon

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Controlling which spans get indexed and generating custom metrics from distributed traces in Datadog APM requires navigating complex APIs, query syntax, and permission scopes, which is error-prone when done manually. ## Core Features & Use Cases - Retention Filter Management: List, create, update, delete, and reorder span retention filters with configurable span and trace sampling rates. - Span-Based Metrics: Create count or distribution metrics from spans with group-by tags and optional percentile calculations. - Query Syntax Guidance: Apply Datadog span search syntax for precise filtering by service, environment, status, duration, and custom attributes. - Use Case: You want to retain all production error traces while sampling staging traffic at 10%, and create a p95 latency metric grouped by endpoint. This Skill generates the exact pup CLI commands with correct flags and permissions. ## Quick Start Ask the agent to create a retention filter that keeps all production error spans at a 100% sample rate.

Frequently Asked Questions about apm-configuration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Datadog APM retention filter?

Use the pup CLI command pup apm retention-filters create with a name, span search query, sample rate, and enabled flag. For example, set query to "status:error" with rate 1.0 to retain all error spans.

How to create span-based metrics in Datadog APM?

Run pup apm span-metrics create with a metric ID, aggregation type (count or distribution), filter query, and group-by rules. Distribution metrics also need a path like @duration and optional percentile calculation.

What permissions are required for Datadog retention filters?

Reading filters requires apm_retention_filter_read or apm_pipelines_read, while creating or modifying them requires apm_retention_filter_write or apm_pipelines_write. Span metrics need apm_read and apm_generate_metrics respectively.

Can I delete the default Datadog error retention filter?

No, default filters like spans-errors-sampling-processor and spans-appsec-sampling-processor cannot be deleted or renamed. You can only update their sample rate and enabled status.

Why does my span metric query return an invalid syntax error?

Invalid query errors occur when the span search syntax is malformed or attribute names are wrong. Test the query in Datadog Trace Explorer first and use the @ prefix for span attributes like @duration or @http.status_code.

What is the difference between span rate and trace rate in retention filters?

Span rate controls the percentage of individual matching spans retained, while trace rate controls the percentage of entire traces containing matching spans. Use trace rate when you need full trace context for debugging.