Skip to content
Back to skills

Datadog Api Traces

ASecurity

Implements application performance monitoring (APM) using the Datadog API for tracing, including best practices for initiating and managing traces and spans.

  • 10 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 4, 2026
businesspythonsqlapidatabaseperformance

Works with

  • cli
  • api

Security analysis

A100/100

Scanned September 4, 2026

npx -y skills add paulpas/agent-skill-router --skill datadog-api-traces --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Datadog Api Traces?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Datadog Api Traces
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/paulpas-datadog-api-traces/badge)](https://www.skillsdirectory.com/skills/paulpas-datadog-api-traces)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---




name: datadog-api-traces
description: Implements application performance monitoring (APM) using the Datadog API for tracing, including best practices for initiating and managing traces and spans.
license: MIT
compatibility: opencode
metadata:
  version: "1.0.0"
  domain: coding
  triggers: datadog traces, send traces, trace management, datadog APM, how do I send traces to datadog
  role: implementation
  scope: implementation
  output-format: code
  related-skills: datadog-api-logs, datadog-api-metrics, datadog-api-monitors
  archetypes: [monitoring, application performance]
  anti_triggers: [manual instrumentation, performance degradation]
  response_profile:
    verbosity: medium
    directive_strength: high




---





# Datadog APM Tracing
Implements APM tracing for applications using Datadog API. This skill covers how to create, manage, and submit traces for effective performance monitoring and alerting based on APM data.

## TL;DR Checklist
- [ ] Use Datadog APM tracing library to instrument applications.
- [ ] Create spans around significant operations to monitor performance.
- [ ] Include context (trace_id, span_id) in all logs to correlate traces and logs.
- [ ] Ensure rate limits are managed during trace submission.

## Core Workflow
1. **Initialize the Tracing Client**: Create and configure the tracing client using `ddtrace` library ensuring proper API key handling.
   **Checkpoint:** Validate connectivity to the Datadog APM endpoints on startup.

2. **Create Spans for Key Operations**: Wrap operations (e.g., HTTP calls, database queries) in spans to measure performance metrics clearly.
   **Checkpoint:** Ensure spans have meaningful names and include error capture.

3. **Submit Traces to Datadog**: Send traces, including all spans, to Datadog using the provided API endpoints.
   **Checkpoint:** Validate that traces arrive at the endpoint without errors; implement retries for transient failures.

## Implementation Patterns
### Pattern 1: Initializing the Tracing Client
```python
from ddtrace import tracer, patch
import os

# Patch auto-instrumentation to collect traces from HTTP requests
def setup_datadog_apm():
    patch(sqlalchemy=True, requests=True)
    trace_agent_url = os.environ.get("DD_TRACE_AGENT_URL", "http://localhost:8126")
    tracer.configure(service="my-service", hostname=trace_agent_url)
    # Optionally set other global settings here
def example_function():
    with tracer.trace("example.function") as span:
        # Perform work here
        pass
```
### Pattern 2: Submitting Error Information
```python
def submit_error_trace(span, error):
    span.set_tag("error", True)
    span.set_tag("error.message", str(error))
    span.set_tag("error.stack", error.__traceback__)
``` 

### Constraints
#### MUST DO
- Use `ddtrace` to collect and submit traces.
- Always set trace IDs in logs for correlation with APM data.

#### MUST NOT DO
- Do not create spans without measuring their execution context (e.g., response times, errors).
- Never assume traces will be processed at a constant rate; handle rate limits gracefully.

---

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in business →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.