@mastra/datadog 1.4.5-alpha.0 → 1.4.5-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +14 -108
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -5,132 +5,38 @@ Datadog LLM Observability exporter for Mastra. Exports observability data to [Da
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- pnpm add @mastra/datadog
8
+ npm install @mastra/datadog
9
9
  ```
10
10
 
11
- ## Requirements
12
-
13
- - **Node.js >=22.13.0** (Node.js 22.x recommended; `dd-trace` native modules ship prebuilt binaries for this ABI)
14
- - Datadog account with LLM Observability enabled
15
- - Datadog API key (available in your Datadog account settings)
16
-
17
11
  ## Usage
18
12
 
19
13
  ### Basic Setup
20
14
 
21
15
  ```typescript
22
- import { Mastra } from '@mastra/core';
16
+ import { Mastra } from '@mastra/core/mastra';
17
+ import { Observability } from '@mastra/observability';
23
18
  import { DatadogExporter } from '@mastra/datadog';
24
19
 
25
- const datadog = new DatadogExporter({
26
- mlApp: 'my-llm-app',
27
- apiKey: process.env.DD_API_KEY,
28
- });
29
-
30
- const mastra = new Mastra({
31
- observability: {
20
+ export const mastra = new Mastra({
21
+ observability: new Observability({
32
22
  configs: {
33
- default: {
23
+ datadog: {
34
24
  serviceName: 'my-service',
35
- exporters: [datadog],
25
+ exporters: [new DatadogExporter()],
36
26
  },
37
27
  },
38
- },
39
- });
40
- ```
41
-
42
- ### With Local Datadog Agent (Optional)
43
-
44
- If you have a Datadog Agent running locally, you can use agent mode instead:
45
-
46
- ```typescript
47
- const datadog = new DatadogExporter({
48
- mlApp: 'my-llm-app',
49
- agentless: false, // Use local Datadog Agent instead of direct HTTPS
50
- env: 'production',
28
+ }),
51
29
  });
52
30
  ```
53
31
 
54
- ### Configuration Options
55
-
56
- | Option | Description | Default |
57
- | --------------------- | ---------------------------------------------------- | ------------------------------ |
58
- | `apiKey` | Datadog API key (required) | `DD_API_KEY` env var |
59
- | `mlApp` | ML application name for grouping traces (required) | `DD_LLMOBS_ML_APP` env var |
60
- | `site` | Datadog site (e.g., 'datadoghq.com', 'datadoghq.eu') | `DD_SITE` or `'datadoghq.com'` |
61
- | `agentless` | Use direct HTTPS intake (no local agent required) | `true` |
62
- | `service` | Service name for the application | Uses `mlApp` value |
63
- | `env` | Environment name (e.g., 'production', 'staging') | `DD_ENV` env var |
64
- | `integrationsEnabled` | Enable dd-trace automatic integrations | `false` |
65
-
66
- Note that the `site` is also used to specify non-default regions, e.g. `us3.datadoghq.com` instead of `us1.datadoghq.com`.
67
-
68
- ### Environment Variables
69
-
70
- The exporter reads configuration from environment variables:
71
-
72
- - `DD_API_KEY` - Datadog API key (required)
73
- - `DD_LLMOBS_ML_APP` - ML application name
74
- - `DD_SITE` - Datadog site
75
- - `DD_ENV` - Environment name
76
- - `DD_LLMOBS_AGENTLESS_ENABLED` - Set to 'false' or '0' to use local Datadog Agent
32
+ ## Documentation
77
33
 
78
- ## Span Type Mapping
34
+ - [@mastra/datadog documentation](https://mastra.ai/integrations/observability/datadog)
79
35
 
80
- Mastra span types are mapped to Datadog LLMObs span kinds:
36
+ ## Changelog
81
37
 
82
- | Mastra SpanType | Datadog Kind |
83
- | ------------------ | ------------ |
84
- | `AGENT_RUN` | `agent` |
85
- | `MODEL_GENERATION` | `workflow` |
86
- | `MODEL_STEP` | `llm` |
87
- | `TOOL_CALL` | `tool` |
88
- | `MCP_TOOL_CALL` | `tool` |
89
- | `WORKFLOW_RUN` | `workflow` |
90
- | All other types | `task` |
91
-
92
- All unmapped span types (including `MODEL_CHUNK`, `GENERIC`, etc., and future span types) automatically default to `task`.
93
-
94
- ## Features
95
-
96
- - **Completion-only pattern**: Spans are emitted at completion for efficient tracing
97
- - **Message formatting**: LLM inputs/outputs formatted as message arrays
98
- - **Metadata as tags**: Span metadata is flattened into searchable Datadog tags
99
- - **Error tracking**: Error spans include error tags with message, ID, and category
100
- - **Parent/child hierarchy**: Spans are emitted parent-first to preserve trace trees in Datadog
101
-
102
- ## Troubleshooting
103
-
104
- ### Native module ABI errors
105
-
106
- If you see errors like `No native build was found for runtime=node abi=137`:
107
-
108
- These are non-blocking warnings. The `dd-trace` native modules (`@datadog/native-metrics`, etc.) are **optional** and provide performance monitoring features. Core tracing works without them.
109
-
110
- **Options:**
111
-
112
- 1. **Use Node.js 22.x** - Prebuilt binaries for `dd-trace` native modules target Node.js 22 (ABI 127/131). Newer Node.js versions have different ABIs.
113
- 2. **Ignore the errors** - These are warnings, not fatal errors. LLM observability tracing functions normally without native modules.
114
-
115
- ### Bundler configuration
116
-
117
- When using bundlers, mark `dd-trace` and native modules as external:
118
-
119
- ```typescript
120
- // src/mastra/index.ts
121
- export const mastra = new Mastra({
122
- bundler: {
123
- externals: [
124
- 'dd-trace',
125
- '@datadog/native-metrics',
126
- '@datadog/native-appsec',
127
- '@datadog/native-iast-taint-tracking',
128
- '@datadog/pprof',
129
- ],
130
- },
131
- });
132
- ```
38
+ See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/observability/datadog/CHANGELOG.md) for version history and release notes.
133
39
 
134
- ## License
40
+ ## Support
135
41
 
136
- Apache-2.0
42
+ We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/datadog",
3
- "version": "1.4.5-alpha.0",
3
+ "version": "1.4.5-alpha.1",
4
4
  "description": "Datadog LLM Observability exporter for Mastra - exports tracing data to Datadog's LLM Observability product",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
26
  "dd-trace": "^5.117.0",
27
- "@mastra/observability": "1.17.5-alpha.0"
27
+ "@mastra/observability": "1.17.5-alpha.1"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "22.20.1",
@@ -34,9 +34,9 @@
34
34
  "tsdown": "0.22.9",
35
35
  "typescript": "^7.0.2",
36
36
  "vitest": "4.1.10",
37
- "@internal/lint": "0.0.129",
38
- "@mastra/core": "1.64.0-alpha.2",
39
- "@internal/types-builder": "0.0.104"
37
+ "@internal/types-builder": "0.0.104",
38
+ "@mastra/core": "1.64.0-alpha.7",
39
+ "@internal/lint": "0.0.129"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@mastra/core": ">=1.16.0-0 <2.0.0-0",