@mastra/mcp-docs-server 0.13.25-alpha.0 → 0.13.25
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.
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +12 -1
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +11 -0
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +18 -18
- package/.docs/organized/changelogs/%40mastra%2Fcloud.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +35 -35
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +30 -30
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Flance.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +18 -18
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +24 -24
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Frag.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Freact.md +17 -0
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +11 -3
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +10 -10
- package/.docs/organized/changelogs/create-mastra.md +11 -11
- package/.docs/organized/changelogs/mastra.md +19 -19
- package/.docs/organized/code-examples/agent.md +0 -4
- package/.docs/organized/code-examples/ai-elements.md +47 -0
- package/.docs/organized/code-examples/heads-up-game.md +5 -5
- package/.docs/raw/auth/clerk.mdx +3 -3
- package/.docs/raw/observability/ai-tracing/exporters/default.mdx +1 -0
- package/.docs/raw/observability/ai-tracing/exporters/langsmith.mdx +88 -0
- package/.docs/raw/observability/ai-tracing/exporters/otel.mdx +250 -0
- package/.docs/raw/observability/ai-tracing/overview.mdx +15 -15
- package/.docs/raw/observability/overview.mdx +1 -1
- package/.docs/raw/reference/agents/network.mdx +1 -1
- package/.docs/raw/reference/auth/clerk.mdx +1 -1
- package/.docs/raw/reference/client-js/agents.mdx +4 -13
- package/.docs/raw/reference/client-js/mastra-client.mdx +10 -0
- package/.docs/raw/reference/client-js/observability.mdx +76 -0
- package/.docs/raw/reference/core/getScorer.mdx +75 -0
- package/.docs/raw/reference/core/getScorerByName.mdx +75 -0
- package/.docs/raw/reference/core/getScorers.mdx +42 -0
- package/.docs/raw/reference/core/mastra-class.mdx +7 -0
- package/.docs/raw/reference/observability/ai-tracing/ai-tracing.mdx +1 -0
- package/.docs/raw/reference/observability/ai-tracing/configuration.mdx +5 -4
- package/.docs/raw/reference/observability/ai-tracing/exporters/langsmith.mdx +112 -0
- package/.docs/raw/reference/observability/ai-tracing/exporters/otel.mdx +355 -0
- package/.docs/raw/reference/observability/logging/pino-logger.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/index.mdx +11 -11
- package/.docs/raw/reference/scorers/create-scorer.mdx +59 -9
- package/.docs/raw/reference/scorers/mastra-scorer.mdx +6 -0
- package/.docs/raw/reference/scorers/run-experiment.mdx +216 -0
- package/.docs/raw/reference/streaming/ChunkType.mdx +3 -2
- package/.docs/raw/reference/streaming/agents/MastraModelOutput.mdx +1 -1
- package/.docs/raw/reference/streaming/agents/stream.mdx +2 -2
- package/.docs/raw/reference/streaming/workflows/resumeStreamVNext.mdx +17 -1
- package/.docs/raw/reference/streaming/workflows/stream.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +1 -1
- package/.docs/raw/scorers/custom-scorers.mdx +16 -1
- package/.docs/raw/scorers/overview.mdx +28 -0
- package/CHANGELOG.md +16 -0
- package/package.json +6 -6
- package/.docs/organized/changelogs/%40mastra%2Freact-hooks.md +0 -8
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Reference: getScorers() | Core | Mastra Docs"
|
|
3
|
+
description: "Documentation for the `getScorers()` method in Mastra, which returns all registered scorers for evaluating AI outputs."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# getScorers()
|
|
7
|
+
|
|
8
|
+
The `getScorers()` method returns all scorers that have been registered with the Mastra instance. Scorers are used for evaluating AI outputs and can override default scorers during agent generation or workflow execution.
|
|
9
|
+
|
|
10
|
+
## Usage Example
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { mastra } from './mastra';
|
|
14
|
+
|
|
15
|
+
// Get all registered scorers
|
|
16
|
+
const allScorers = mastra.getScorers();
|
|
17
|
+
|
|
18
|
+
// Access a specific scorer
|
|
19
|
+
const myScorer = allScorers.relevancyScorer;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Parameters
|
|
23
|
+
|
|
24
|
+
This method takes no parameters.
|
|
25
|
+
|
|
26
|
+
## Returns
|
|
27
|
+
|
|
28
|
+
<PropertiesTable
|
|
29
|
+
content={[
|
|
30
|
+
{
|
|
31
|
+
name: "scorers",
|
|
32
|
+
type: "Record<string, MastraScorer> | undefined",
|
|
33
|
+
description: "An object containing all registered scorers, where keys are scorer names and values are MastraScorer instances. Returns undefined if no scorers are registered.",
|
|
34
|
+
},
|
|
35
|
+
]}
|
|
36
|
+
/>
|
|
37
|
+
|
|
38
|
+
## Related
|
|
39
|
+
|
|
40
|
+
- [getScorer()](../../reference/core/getScorer) - Get a specific scorer by key
|
|
41
|
+
- [getScorerByName()](../../reference/core/getScorerByName) - Get a scorer by its name property
|
|
42
|
+
- [Scorers Overview](../../docs/scorers/overview) - Learn about creating and using scorers
|
|
@@ -129,6 +129,13 @@ export const mastra = new Mastra({
|
|
|
129
129
|
isOptional: true,
|
|
130
130
|
defaultValue: "{ externals: [], sourcemap: false, transpilePackages: [] }",
|
|
131
131
|
},
|
|
132
|
+
{
|
|
133
|
+
name: "scorers",
|
|
134
|
+
type: "Record<string, MastraScorer>",
|
|
135
|
+
description: "Scorers to register for scoring traces and overriding default scorers used during agent generation or workflow execution. Structured as a key-value pair, with keys being the scorer name and values being the scorer instance.",
|
|
136
|
+
isOptional: true,
|
|
137
|
+
defaultValue: "{}",
|
|
138
|
+
},
|
|
132
139
|
]}
|
|
133
140
|
/>
|
|
134
141
|
|
|
@@ -90,7 +90,7 @@ interface TracingConfig {
|
|
|
90
90
|
## SamplingStrategy
|
|
91
91
|
|
|
92
92
|
```typescript
|
|
93
|
-
type SamplingStrategy =
|
|
93
|
+
type SamplingStrategy =
|
|
94
94
|
| { type: 'always' }
|
|
95
95
|
| { type: 'never' }
|
|
96
96
|
| { type: 'ratio', probability: number }
|
|
@@ -129,8 +129,8 @@ Initializes AI tracing from configuration. Called automatically by Mastra constr
|
|
|
129
129
|
|
|
130
130
|
```typescript
|
|
131
131
|
function registerAITracing(
|
|
132
|
-
name: string,
|
|
133
|
-
instance: AITracing,
|
|
132
|
+
name: string,
|
|
133
|
+
instance: AITracing,
|
|
134
134
|
isDefault?: boolean
|
|
135
135
|
): void
|
|
136
136
|
```
|
|
@@ -229,5 +229,6 @@ Checks if a tracing instance exists and is enabled.
|
|
|
229
229
|
### Exporters
|
|
230
230
|
- [DefaultExporter](/reference/observability/ai-tracing/exporters/default-exporter) - Storage configuration
|
|
231
231
|
- [CloudExporter](/reference/observability/ai-tracing/exporters/cloud-exporter) - Cloud setup
|
|
232
|
+
- [Braintrust](/reference/observability/ai-tracing/exporters/braintrust) - Braintrust integration
|
|
232
233
|
- [Langfuse](/reference/observability/ai-tracing/exporters/langfuse) - Langfuse integration
|
|
233
|
-
- [
|
|
234
|
+
- [LangSmith](/reference/observability/ai-tracing/exporters/langsmith) - LangSmith integration
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "LangSmithExporter | Exporters | AI Tracing | Reference"
|
|
3
|
+
description: LangSmith exporter for AI tracing
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { PropertiesTable } from "@/components/properties-table";
|
|
7
|
+
|
|
8
|
+
# LangSmithExporter
|
|
9
|
+
|
|
10
|
+
Sends AI tracing data to LangSmith for observability.
|
|
11
|
+
|
|
12
|
+
## Constructor
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
new LangSmithExporter(config: LangSmithExporterConfig)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## LangSmithExporterConfig
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
interface LangSmithExporterConfig extends ClientConfig {
|
|
22
|
+
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
23
|
+
client?: Client;
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
<PropertiesTable
|
|
28
|
+
props={[
|
|
29
|
+
{
|
|
30
|
+
name: "apiKey",
|
|
31
|
+
type: "string",
|
|
32
|
+
description: "LangSmith API key",
|
|
33
|
+
required: false,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "apiUrl",
|
|
37
|
+
type: "string",
|
|
38
|
+
description: "LangSmith API URL",
|
|
39
|
+
required: false,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "callerOptions",
|
|
43
|
+
type: "object",
|
|
44
|
+
description: "HTTP client configuration options",
|
|
45
|
+
required: false,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "hideInputs",
|
|
49
|
+
type: "boolean",
|
|
50
|
+
description: "Hide input data in the LangSmith UI",
|
|
51
|
+
required: false,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "hideOutputs",
|
|
55
|
+
type: "boolean",
|
|
56
|
+
description: "Hide output data in the LangSmith UI",
|
|
57
|
+
required: false,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "logLevel",
|
|
61
|
+
type: "'debug' | 'info' | 'warn' | 'error'",
|
|
62
|
+
description: "Logger level (default: 'warn')",
|
|
63
|
+
required: false,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "client",
|
|
67
|
+
type: "Client",
|
|
68
|
+
description: "Pre-configured LangSmith client instance",
|
|
69
|
+
required: false,
|
|
70
|
+
},
|
|
71
|
+
]}
|
|
72
|
+
/>
|
|
73
|
+
|
|
74
|
+
## Methods
|
|
75
|
+
|
|
76
|
+
### exportEvent
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
async exportEvent(event: AITracingEvent): Promise<void>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Exports a tracing event to LangSmith.
|
|
83
|
+
|
|
84
|
+
### shutdown
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
async shutdown(): Promise<void>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Ends all active spans and clears the trace map.
|
|
91
|
+
|
|
92
|
+
## Usage
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
import { LangSmithExporter } from '@mastra/langsmith';
|
|
96
|
+
|
|
97
|
+
const exporter = new LangSmithExporter({
|
|
98
|
+
apiKey: process.env.LANGSMITH_API_KEY,
|
|
99
|
+
apiUrl: 'https://api.smith.langchain.com',
|
|
100
|
+
logLevel: 'info',
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Span Type Mapping
|
|
105
|
+
|
|
106
|
+
| AI Span Type | LangSmith Type |
|
|
107
|
+
|--------------|----------------|
|
|
108
|
+
| `LLM_GENERATION` | `llm` |
|
|
109
|
+
| `LLM_CHUNK` | `llm` |
|
|
110
|
+
| `TOOL_CALL` | `tool` |
|
|
111
|
+
| `MCP_TOOL_CALL` | `tool` |
|
|
112
|
+
| All others | `chain` |
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "OtelExporter | Exporters | AI Tracing | Reference"
|
|
3
|
+
description: OpenTelemetry exporter for AI tracing
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { PropertiesTable } from "@/components/properties-table";
|
|
7
|
+
import { Callout } from "nextra/components";
|
|
8
|
+
|
|
9
|
+
# OtelExporter
|
|
10
|
+
|
|
11
|
+
<Callout type="warning">
|
|
12
|
+
The OtelExporter is currently **experimental**. APIs and configuration options may change in future releases.
|
|
13
|
+
</Callout>
|
|
14
|
+
|
|
15
|
+
Sends AI tracing data to any OpenTelemetry-compatible observability platform using standardized GenAI semantic conventions.
|
|
16
|
+
|
|
17
|
+
## Constructor
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
new OtelExporter(config: OtelExporterConfig)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## OtelExporterConfig
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
interface OtelExporterConfig {
|
|
27
|
+
provider?: ProviderConfig;
|
|
28
|
+
timeout?: number;
|
|
29
|
+
batchSize?: number;
|
|
30
|
+
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
<PropertiesTable
|
|
35
|
+
props={[
|
|
36
|
+
{
|
|
37
|
+
name: "provider",
|
|
38
|
+
type: "ProviderConfig",
|
|
39
|
+
description: "Provider-specific configuration (see below)",
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "timeout",
|
|
44
|
+
type: "number",
|
|
45
|
+
description: "Export timeout in milliseconds (default: 30000)",
|
|
46
|
+
required: false,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "batchSize",
|
|
50
|
+
type: "number",
|
|
51
|
+
description: "Number of spans per batch (default: 100)",
|
|
52
|
+
required: false,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "logLevel",
|
|
56
|
+
type: "'debug' | 'info' | 'warn' | 'error'",
|
|
57
|
+
description: "Logger level (default: 'warn')",
|
|
58
|
+
required: false,
|
|
59
|
+
},
|
|
60
|
+
]}
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
## Provider Configurations
|
|
64
|
+
|
|
65
|
+
### Dash0Config
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
interface Dash0Config {
|
|
69
|
+
apiKey: string;
|
|
70
|
+
endpoint: string;
|
|
71
|
+
dataset?: string;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
<PropertiesTable
|
|
76
|
+
props={[
|
|
77
|
+
{
|
|
78
|
+
name: "apiKey",
|
|
79
|
+
type: "string",
|
|
80
|
+
description: "Dash0 API key",
|
|
81
|
+
required: true,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "endpoint",
|
|
85
|
+
type: "string",
|
|
86
|
+
description: "Dash0 ingress endpoint (e.g., ingress.us-west-2.aws.dash0.com:4317)",
|
|
87
|
+
required: true,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "dataset",
|
|
91
|
+
type: "string",
|
|
92
|
+
description: "Optional dataset name for data organization",
|
|
93
|
+
required: false,
|
|
94
|
+
},
|
|
95
|
+
]}
|
|
96
|
+
/>
|
|
97
|
+
|
|
98
|
+
### SignozConfig
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
interface SignozConfig {
|
|
102
|
+
apiKey: string;
|
|
103
|
+
region?: 'us' | 'eu' | 'in';
|
|
104
|
+
endpoint?: string;
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
<PropertiesTable
|
|
109
|
+
props={[
|
|
110
|
+
{
|
|
111
|
+
name: "apiKey",
|
|
112
|
+
type: "string",
|
|
113
|
+
description: "SigNoz ingestion key",
|
|
114
|
+
required: true,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "region",
|
|
118
|
+
type: "'us' | 'eu' | 'in'",
|
|
119
|
+
description: "SigNoz cloud region (default: 'us')",
|
|
120
|
+
required: false,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "endpoint",
|
|
124
|
+
type: "string",
|
|
125
|
+
description: "Custom endpoint for self-hosted SigNoz",
|
|
126
|
+
required: false,
|
|
127
|
+
},
|
|
128
|
+
]}
|
|
129
|
+
/>
|
|
130
|
+
|
|
131
|
+
### NewRelicConfig
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
interface NewRelicConfig {
|
|
135
|
+
apiKey: string;
|
|
136
|
+
endpoint?: string;
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
<PropertiesTable
|
|
141
|
+
props={[
|
|
142
|
+
{
|
|
143
|
+
name: "apiKey",
|
|
144
|
+
type: "string",
|
|
145
|
+
description: "New Relic license key",
|
|
146
|
+
required: true,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "endpoint",
|
|
150
|
+
type: "string",
|
|
151
|
+
description: "Custom endpoint (default: https://otlp.nr-data.net:443/v1/traces)",
|
|
152
|
+
required: false,
|
|
153
|
+
},
|
|
154
|
+
]}
|
|
155
|
+
/>
|
|
156
|
+
|
|
157
|
+
### TraceloopConfig
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
interface TraceloopConfig {
|
|
161
|
+
apiKey: string;
|
|
162
|
+
destinationId?: string;
|
|
163
|
+
endpoint?: string;
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
<PropertiesTable
|
|
168
|
+
props={[
|
|
169
|
+
{
|
|
170
|
+
name: "apiKey",
|
|
171
|
+
type: "string",
|
|
172
|
+
description: "Traceloop API key",
|
|
173
|
+
required: true,
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "destinationId",
|
|
177
|
+
type: "string",
|
|
178
|
+
description: "Optional destination identifier",
|
|
179
|
+
required: false,
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: "endpoint",
|
|
183
|
+
type: "string",
|
|
184
|
+
description: "Custom endpoint (default: https://api.traceloop.com/v1/traces)",
|
|
185
|
+
required: false,
|
|
186
|
+
},
|
|
187
|
+
]}
|
|
188
|
+
/>
|
|
189
|
+
|
|
190
|
+
### LaminarConfig
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
interface LaminarConfig {
|
|
194
|
+
apiKey: string;
|
|
195
|
+
teamId?: string;
|
|
196
|
+
endpoint?: string;
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
<PropertiesTable
|
|
201
|
+
props={[
|
|
202
|
+
{
|
|
203
|
+
name: "apiKey",
|
|
204
|
+
type: "string",
|
|
205
|
+
description: "Laminar project API key",
|
|
206
|
+
required: true,
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: "teamId",
|
|
210
|
+
type: "string",
|
|
211
|
+
description: "Optional team identifier (for backwards compatibility)",
|
|
212
|
+
required: false,
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
name: "endpoint",
|
|
216
|
+
type: "string",
|
|
217
|
+
description: "Custom endpoint (default: https://api.lmnr.ai/v1/traces)",
|
|
218
|
+
required: false,
|
|
219
|
+
},
|
|
220
|
+
]}
|
|
221
|
+
/>
|
|
222
|
+
|
|
223
|
+
### CustomConfig
|
|
224
|
+
|
|
225
|
+
```typescript
|
|
226
|
+
interface CustomConfig {
|
|
227
|
+
endpoint: string;
|
|
228
|
+
protocol?: 'http/json' | 'http/protobuf' | 'grpc' | 'zipkin';
|
|
229
|
+
headers?: Record<string, string>;
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
<PropertiesTable
|
|
234
|
+
props={[
|
|
235
|
+
{
|
|
236
|
+
name: "endpoint",
|
|
237
|
+
type: "string",
|
|
238
|
+
description: "OTEL collector endpoint URL",
|
|
239
|
+
required: true,
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
name: "protocol",
|
|
243
|
+
type: "'http/json' | 'http/protobuf' | 'grpc' | 'zipkin'",
|
|
244
|
+
description: "Export protocol (default: 'http/json')",
|
|
245
|
+
required: false,
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
name: "headers",
|
|
249
|
+
type: "Record<string, string>",
|
|
250
|
+
description: "Custom headers for authentication",
|
|
251
|
+
required: false,
|
|
252
|
+
},
|
|
253
|
+
]}
|
|
254
|
+
/>
|
|
255
|
+
|
|
256
|
+
## Methods
|
|
257
|
+
|
|
258
|
+
### exportEvent
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
async exportEvent(event: AITracingEvent): Promise<void>
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Exports a tracing event to the configured OTEL backend.
|
|
265
|
+
|
|
266
|
+
### shutdown
|
|
267
|
+
|
|
268
|
+
```typescript
|
|
269
|
+
async shutdown(): Promise<void>
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Flushes pending traces and shuts down the exporter.
|
|
273
|
+
|
|
274
|
+
## Usage Examples
|
|
275
|
+
|
|
276
|
+
### Basic Usage
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
import { OtelExporter } from '@mastra/otel-exporter';
|
|
280
|
+
|
|
281
|
+
const exporter = new OtelExporter({
|
|
282
|
+
provider: {
|
|
283
|
+
signoz: {
|
|
284
|
+
apiKey: process.env.SIGNOZ_API_KEY,
|
|
285
|
+
region: 'us',
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### With Custom Endpoint
|
|
292
|
+
|
|
293
|
+
```typescript
|
|
294
|
+
const exporter = new OtelExporter({
|
|
295
|
+
provider: {
|
|
296
|
+
custom: {
|
|
297
|
+
endpoint: 'https://my-collector.example.com/v1/traces',
|
|
298
|
+
protocol: 'http/protobuf',
|
|
299
|
+
headers: {
|
|
300
|
+
'x-api-key': process.env.API_KEY,
|
|
301
|
+
},
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
timeout: 60000,
|
|
305
|
+
logLevel: 'debug',
|
|
306
|
+
});
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Span Mapping
|
|
310
|
+
|
|
311
|
+
The exporter maps Mastra AI spans to OpenTelemetry spans following GenAI semantic conventions:
|
|
312
|
+
|
|
313
|
+
### Span Names
|
|
314
|
+
- `LLM_GENERATION` → `chat {model}` or `tool_selection {model}`
|
|
315
|
+
- `TOOL_CALL` → `tool.execute {tool_name}`
|
|
316
|
+
- `AGENT_RUN` → `agent.{agent_id}`
|
|
317
|
+
- `WORKFLOW_RUN` → `workflow.{workflow_id}`
|
|
318
|
+
|
|
319
|
+
### Span Kinds
|
|
320
|
+
- Root agent/workflow spans → `SERVER`
|
|
321
|
+
- LLM calls → `CLIENT`
|
|
322
|
+
- Tool calls → `INTERNAL` or `CLIENT`
|
|
323
|
+
- Workflow steps → `INTERNAL`
|
|
324
|
+
|
|
325
|
+
### Attributes
|
|
326
|
+
|
|
327
|
+
The exporter maps to standard OTEL GenAI attributes:
|
|
328
|
+
|
|
329
|
+
| Mastra Attribute | OTEL Attribute |
|
|
330
|
+
|------------------|----------------|
|
|
331
|
+
| `model` | `gen_ai.request.model` |
|
|
332
|
+
| `provider` | `gen_ai.system` |
|
|
333
|
+
| `inputTokens` / `promptTokens` | `gen_ai.usage.input_tokens` |
|
|
334
|
+
| `outputTokens` / `completionTokens` | `gen_ai.usage.output_tokens` |
|
|
335
|
+
| `temperature` | `gen_ai.request.temperature` |
|
|
336
|
+
| `maxOutputTokens` | `gen_ai.request.max_tokens` |
|
|
337
|
+
| `finishReason` | `gen_ai.response.finish_reasons` |
|
|
338
|
+
|
|
339
|
+
## Protocol Requirements
|
|
340
|
+
|
|
341
|
+
Different providers require different OTEL exporter packages:
|
|
342
|
+
|
|
343
|
+
| Protocol | Required Package | Providers |
|
|
344
|
+
|----------|------------------|-----------|
|
|
345
|
+
| gRPC | `@opentelemetry/exporter-trace-otlp-grpc` | Dash0 |
|
|
346
|
+
| HTTP/Protobuf | `@opentelemetry/exporter-trace-otlp-proto` | SigNoz, New Relic, Laminar |
|
|
347
|
+
| HTTP/JSON | `@opentelemetry/exporter-trace-otlp-http` | Traceloop, Custom |
|
|
348
|
+
| Zipkin | `@opentelemetry/exporter-zipkin` | Zipkin collectors |
|
|
349
|
+
|
|
350
|
+
## Parent-Child Relationships
|
|
351
|
+
|
|
352
|
+
The exporter preserves span hierarchy from Mastra's AI tracing:
|
|
353
|
+
- Uses `parentSpanId` directly from Mastra spans
|
|
354
|
+
- Maintains correct nesting for agents, workflows, LLM calls, and tools
|
|
355
|
+
- Exports complete traces with all relationships intact
|
|
@@ -7,7 +7,7 @@ description: Documentation for PinoLogger, which provides methods to record even
|
|
|
7
7
|
|
|
8
8
|
A Logger instance is created using `new PinoLogger()` and provides methods to record events at various severity levels.
|
|
9
9
|
|
|
10
|
-
When deploying to Mastra Cloud, logs are displayed on the [Logs](
|
|
10
|
+
When deploying to Mastra Cloud, logs are displayed on the [Logs](../../../docs/mastra-cloud/dashboard.mdx#logs) page. In self-hosted or custom environments, logs can be directed to files or external services depending on the configured transports.
|
|
11
11
|
|
|
12
12
|
## Usage example
|
|
13
13
|
|
|
@@ -9,14 +9,14 @@ import { Callout } from "nextra/components";
|
|
|
9
9
|
|
|
10
10
|
These providers are supported with OTLP-based tracing:
|
|
11
11
|
|
|
12
|
-
- [Arize AX](./arize-ax.mdx)
|
|
13
|
-
- [Arize Phoenix](./arize-phoenix.mdx)
|
|
14
|
-
- [Braintrust](./braintrust.mdx)
|
|
15
|
-
- [Dash0](./dash0.mdx)
|
|
16
|
-
- [Laminar](./laminar.mdx)
|
|
17
|
-
- [Langfuse](./langfuse.mdx)
|
|
18
|
-
- [Langsmith](./langsmith.mdx)
|
|
19
|
-
- [LangWatch](./langwatch.mdx)
|
|
20
|
-
- [New Relic](./new-relic.mdx)
|
|
21
|
-
- [SigNoz](./signoz.mdx)
|
|
22
|
-
- [Traceloop](./traceloop.mdx)
|
|
12
|
+
- [Arize AX](./providers/arize-ax.mdx)
|
|
13
|
+
- [Arize Phoenix](./providers/arize-phoenix.mdx)
|
|
14
|
+
- [Braintrust](./providers/braintrust.mdx)
|
|
15
|
+
- [Dash0](./providers/dash0.mdx)
|
|
16
|
+
- [Laminar](./providers/laminar.mdx)
|
|
17
|
+
- [Langfuse](./providers/langfuse.mdx)
|
|
18
|
+
- [Langsmith](./providers/langsmith.mdx)
|
|
19
|
+
- [LangWatch](./providers/langwatch.mdx)
|
|
20
|
+
- [New Relic](./providers/new-relic.mdx)
|
|
21
|
+
- [SigNoz](./providers/signoz.mdx)
|
|
22
|
+
- [Traceloop](./providers/traceloop.mdx)
|