@mastra/core
Version:
32 lines (21 loc) • 1.61 kB
Markdown
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
Mastra configures [observability](https://mastra.ai/docs/observability/overview) from an `observability.ts` file directly under `src/mastra/`. The file default-exports an `Observability` instance that sets up tracing, logging, metrics, and feedback for the project.
Use this page for the file-based convention. For the signal model, exporters, storage, and multi-config setup, see the [observability overview](https://mastra.ai/docs/observability/overview) and [observability configuration](https://mastra.ai/docs/observability/overview).
Create `src/mastra/observability.ts` and default-export an `Observability` instance:
```typescript
import { MastraStorageExporter, Observability } from '@mastra/observability'
export default new Observability({
configs: {
default: {
serviceName: 'mastra',
exporters: [new MastraStorageExporter()],
},
},
})
```
## Observability and storage
`observability.ts` configures which signals are collected and where they're exported. [`storage.ts`](https://mastra.ai/reference/file-based-agents/storage) configures the project store that can persist observability records. For storage support by signal, see [observability signal support](https://mastra.ai/docs/observability/overview).
## Precedence with code
Code-registered observability wins over `observability.ts`. Use `observability.ts` when one project-wide configuration is enough. Use code registration when setup depends on runtime wiring in `src/mastra/index.ts`.