dd-apm by datadog-labs/agent-skills
npx skills add https://github.com/datadog-labs/agent-skills --skill dd-apm分布式追踪、服务地图与性能分析。
需安装 Datadog Labs Pup。如果尚未安装,请参阅 设置 Pup。
pup auth login
pup apm services list
pup apm traces list --service api-gateway --duration 1h
pup apm services list
pup apm services list --env production
pup apm services get api-gateway --json
# 查看依赖关系
pup apm service-map --service api-gateway --json
# 按服务
pup apm traces list --service api-gateway --duration 1h
# 仅错误
pup apm traces list --service api-gateway --status error
# 慢追踪 (>1s)
pup apm traces list --service api-gateway --min-duration 1000ms
# 使用特定标签
pup apm traces list --query "@http.url:/api/users"
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
pup apm traces get <trace_id> --json
| 指标 | 衡量内容 |
|---|---|
trace.http.request.hits | 请求数量 |
trace.http.request.duration | 延迟 |
trace.http.request.errors | 错误数量 |
trace.http.request.apdex | 用户满意度 |
并非所有追踪都会被保留。 请理解采样机制:
| 模式 | 保留内容 |
|---|---|
| 基于头部 | 开始时随机百分比 |
| 错误/慢速 | 所有错误、慢速追踪 |
| 保留 | 被索引(计费)的内容 |
# 检查保留过滤器
pup apm retention-filters list
| 保留类型 | 成本 |
|---|---|
| 索引跨度 | $$$ 每百万 |
| 摄入跨度 | $ 每百万 |
最佳实践: 仅索引搜索所需的内容。
将 APM 链接到 SLO:
pup slos create \
--name "API 延迟 p99 < 200ms" \
--type metric \
--numerator "sum:trace.http.request.hits{service:api,@duration:<200000000}" \
--denominator "sum:trace.http.request.hits{service:api}" \
--target 99.0
| 目标 | 查询 |
|---|---|
| 最慢端点 | avg:trace.http.request.duration{*} by {resource_name} |
| 错误率 | sum:trace.http.request.errors{*} / sum:trace.http.request.hits{*} |
| 吞吐量 | sum:trace.http.request.hits{*}.as_rate() |
| 问题 | 解决方法 |
|---|---|
| 无追踪 | 检查 ddtrace 是否安装,DD_TRACE_ENABLED=true |
| 缺少服务 | 验证 DD_SERVICE 环境变量 |
| 追踪未链接 | 检查追踪头是否已传播 |
| 高基数 | 不要使用 user_id/request_id 进行标记 |
每周安装数
188
代码库
GitHub 星标数
77
首次出现
2026年2月26日
安全审计
安装于
codex184
github-copilot183
cursor181
gemini-cli179
opencode179
amp177
Distributed tracing, service maps, and performance analysis.
Datadog Labs Pup should be installed. See Setup Pup if not.
pup auth login
pup apm services list
pup apm traces list --service api-gateway --duration 1h
pup apm services list
pup apm services list --env production
pup apm services get api-gateway --json
# View dependencies
pup apm service-map --service api-gateway --json
# By service
pup apm traces list --service api-gateway --duration 1h
# Errors only
pup apm traces list --service api-gateway --status error
# Slow traces (>1s)
pup apm traces list --service api-gateway --min-duration 1000ms
# With specific tag
pup apm traces list --query "@http.url:/api/users"
pup apm traces get <trace_id> --json
| Metric | What It Measures |
|---|---|
trace.http.request.hits | Request count |
trace.http.request.duration | Latency |
trace.http.request.errors | Error count |
trace.http.request.apdex | User satisfaction |
Not all traces are kept. Understand sampling:
| Mode | What's Kept |
|---|---|
| Head-based | Random % at start |
| Error/Slow | All errors, slow traces |
| Retention | What's indexed (billed) |
# Check retention filters
pup apm retention-filters list
| Retention | Cost |
|---|---|
| Indexed spans | $$$ per million |
| Ingested spans | $ per million |
Best practice: Only index what you need for search.
Link APM to SLOs:
pup slos create \
--name "API Latency p99 < 200ms" \
--type metric \
--numerator "sum:trace.http.request.hits{service:api,@duration:<200000000}" \
--denominator "sum:trace.http.request.hits{service:api}" \
--target 99.0
| Goal | Query |
|---|---|
| Slowest endpoints | avg:trace.http.request.duration{*} by {resource_name} |
| Error rate | sum:trace.http.request.errors{*} / sum:trace.http.request.hits{*} |
| Throughput | sum:trace.http.request.hits{*}.as_rate() |
| Problem | Fix |
|---|---|
| No traces | Check ddtrace installed, DD_TRACE_ENABLED=true |
| Missing service | Verify DD_SERVICE env var |
| Traces not linked | Check trace headers propagated |
| High cardinality | Don't tag with user_id/request_id |
Weekly Installs
188
Repository
GitHub Stars
77
First Seen
Feb 26, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex184
github-copilot183
cursor181
gemini-cli179
opencode179
amp177
Azure 升级评估与自动化工具 - 轻松迁移 Functions 计划、托管层级和 SKU
104,900 周安装