Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/cli/commands/logs/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { COMMAND_DESCRIPTIONS } from '../../constants';
import { getErrorMessage } from '../../errors';
import { handleLogsEval } from '../../operations/eval';
import type { LogsEvalOptions } from '../../operations/eval';
import { withCommandRunTelemetry } from '../../telemetry/cli-command-run.js';
import { requireProject } from '../../tui/guards';
import { handleLogs } from './action';
import type { LogsOptions } from './types';
Expand Down Expand Up @@ -31,7 +32,11 @@ export const registerLogs = (program: Command) => {
requireProject();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eventually, we'll want this in telemetry, but right now it kills the process on failure, so OOS for here.


try {
const result = await handleLogs(cliOptions);
const result = await withCommandRunTelemetry(
'logs',
{ has_query: !!cliOptions.query, has_level_filter: !!cliOptions.level },
() => handleLogs(cliOptions)
);

if (!result.success) {
render(<Text color="red">{result.error.message}</Text>);
Expand All @@ -56,7 +61,9 @@ export const registerLogs = (program: Command) => {
requireProject();

try {
const result = await handleLogsEval(cliOptions);
const result = await withCommandRunTelemetry('logs.evals', { has_follow: !!cliOptions.follow }, () =>
handleLogsEval(cliOptions)
);

if (!result.success) {
render(<Text color="red">{result.error.message}</Text>);
Expand Down
6 changes: 3 additions & 3 deletions src/cli/tui/screens/logs/useLogsFlow.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toError } from '../../../../lib';
import { ValidationError, toError } from '../../../../lib';
import type { AgentContext } from '../../../commands/logs/action';
import { resolveAgentContext } from '../../../commands/logs/action';
import { loadDeployedProjectConfig } from '../../../operations/resolve-agent';
Expand Down Expand Up @@ -40,7 +40,7 @@ export function useLogsFlow(): UseLogsFlowResult {
const runtimeNames = context.project.runtimes.map(r => r.name);

if (runtimeNames.length === 0) {
return { success: false as const, error: new Error('No runtimes defined in agentcore.json') };
return { success: false as const, error: new ValidationError('No runtimes defined in agentcore.json') };
}

const resolved: AgentContext[] = [];
Expand All @@ -54,7 +54,7 @@ export function useLogsFlow(): UseLogsFlowResult {
if (resolved.length === 0) {
return {
success: false as const,
error: new Error('No deployed agents found. Run `agentcore deploy` first.'),
error: new ValidationError('No deployed agents found. Run `agentcore deploy` first.'),
};
}

Expand Down
Loading