Add Sentry AI agent monitoring with telemetry configuration (#15301)
This PR implements Sentry's AI agent monitoring by: - Configuring vercelAIIntegration with recordInputs and recordOutputs options - Adding sendDefaultPii to Sentry.init() for better debugging - Creating a shared AI_TELEMETRY_CONFIG constant to DRY up the telemetry configuration - Adding experimental_telemetry to all AI SDK calls (generateText, generateObject, streamText) All AI operations are now fully monitored in Sentry with complete input/output recording for debugging and performance analysis. Note: Currently on Sentry v9.26.0, which is compatible with this implementation. No breaking changes from the v9-to-v10 migration guide were found in the codebase.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
export const AI_TELEMETRY_CONFIG = {
|
||||
isEnabled: true,
|
||||
recordInputs: true,
|
||||
recordOutputs: true,
|
||||
};
|
||||
@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { LanguageModel, type ModelMessage, streamText } from 'ai';
|
||||
|
||||
import { AI_TELEMETRY_CONFIG } from 'src/engine/core-modules/ai/constants/ai-telemetry.const';
|
||||
import { AiModelRegistryService } from 'src/engine/core-modules/ai/services/ai-model-registry.service';
|
||||
|
||||
@Injectable()
|
||||
@@ -40,6 +41,7 @@ export class AiService {
|
||||
messages,
|
||||
temperature: options?.temperature,
|
||||
maxOutputTokens: options?.maxOutputTokens,
|
||||
experimental_telemetry: AI_TELEMETRY_CONFIG,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user