
Security News
npm v12 Ships With Install Scripts Off by Default, Begins Deprecating 2FA-Bypass Tokens
npm v12 is generally available, turning install scripts off by default and beginning the deprecation of 2FA-bypass publishing tokens.
@mastra/observability
Advanced tools
Affected versions:
Core observability package for Mastra - includes tracing and scoring features
Tracing, metrics, and structured logging for AI operations in Mastra.
npm install @mastra/observability
import { Mastra } from '@mastra/core';
import { Observability, MastraStorageExporter, MastraPlatformExporter } from '@mastra/observability';
export const mastra = new Mastra({
observability: new Observability({
configs: {
default: {
serviceName: 'my-app',
exporters: [
new MastraStorageExporter(), // Persists observability events to Mastra Storage
new MastraPlatformExporter(), // Sends observability events to Mastra Platform
],
},
},
}),
});
A SensitiveDataFilter span output processor is auto-applied to every configured instance by default, redacting secrets (API keys, tokens, passwords, etc.) before they reach exporters. Set sensitiveDataFilter: false on the Observability config to opt out, or pass a SensitiveDataFilterOptions object to customize it.
Central event router that dispatches tracing, metric, and log events to registered exporters. All handler promises are tracked for reliable flush and shutdown — no events are silently dropped.
Exporters register via registerExporter() and can optionally implement onLogEvent and onMetricEvent handlers alongside the existing exportTracingEvent.
Metrics are automatically extracted from span lifecycle events by AutoExtractedMetrics:
mastra_agent_duration_msmastra_tool_duration_msmastra_workflow_duration_msmastra_model_duration_msmastra_model_total_input_tokens / mastra_model_total_output_tokensmastra_model_input_text_tokens / mastra_model_input_cache_read_tokens / mastra_model_input_cache_write_tokens / mastra_model_input_audio_tokens / mastra_model_input_image_tokensmastra_model_output_text_tokens / mastra_model_output_reasoning_tokens / mastra_model_output_audio_tokens / mastra_model_output_image_tokensAuto-extracted metrics carry labels: entity_type, entity_name, status, plus model and provider on model generation spans.
LoggerContextImpl emits log events with automatic trace correlation (traceId, spanId), inherited tags, and entity metadata. Supports minimum log level filtering (debug/info/warn/error/fatal).
MetricsContextImpl provides counter, gauge, and histogram instruments. All labels pass through a CardinalityFilter that blocks high-cardinality keys (trace_id, user_id, etc.) to protect metric backends.
WORKFLOW_RUN - Workflow executionWORKFLOW_STEP - Individual workflow stepAGENT_RUN - Agent processingMODEL_GENERATION - LLM API callsTOOL_CALL - Tool executionMCP_TOOL_CALL - MCP tool executionPROCESSOR_RUN - Processor executionGENERIC - Custom operations| Label | Description | Cardinality |
|---|---|---|
entity_type | What is being measured (e.g., agent, tool, workflow_run) | Small enum (~9 values) |
entity_name | Name of the entity (e.g., researcher, search) | Bounded by defined entities |
model | LLM model ID (only on model generation spans) | Bounded by LLM providers |
provider | LLM provider (only on model generation spans) | Bounded by LLM providers |
status | Outcome of the operation (ok or error), on _ended metrics only | 2 values |
User-emitted metrics inherit additional context labels from the active span:
| Label | Description | Cardinality |
|---|---|---|
parent_type | Entity type of the nearest parent | Same small enum |
parent_name | Name of the nearest parent entity | Bounded by defined entities |
root_type | Entity type of the outermost ancestor (only set when different from parent) | Same small enum |
root_name | Name of the outermost ancestor entity | Bounded by defined entities |
service_name | Service name from observability config | Single value per deployment |
entity_name where entity_type=agentparent_nameroot_namemodel where entity_name=XFor configuration options, exporters, sampling strategies, and more, see the full documentation.
FAQs
Core observability package for Mastra - includes tracing and scoring features
The npm package @mastra/observability receives a total of 279,609 weekly downloads. As such, @mastra/observability popularity was classified as popular.
We found that @mastra/observability demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
npm v12 is generally available, turning install scripts off by default and beginning the deprecation of 2FA-bypass publishing tokens.

Research
/Security News
Socket tracks the activity as Operation “Muck and Load”: a threat actor uses commit-farming workflows, public dead drops, and protected archives to stage Windows RAT and infostealer malware.

Security News
pnpm 11.10 hardens registry auth to block token redirection, tightens pack-app and deploy, and makes the Rust port (v12) installable.