-
Notifications
You must be signed in to change notification settings - Fork 52
feat: instrument telemetry for import command #1312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6879a3a
feat: instrument telemetry for import command
Hweinstock 80092a3
fix: use relative import instead of @/ path alias
Hweinstock b32ddd9
test: add missing import online-eval telemetry integ test
Hweinstock c999d5e
fix: use generic Error for pipeline failure instead of ValidationError
Hweinstock File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| import { createTelemetryHelper, runCLI } from '../src/test-utils/index.js'; | ||
| import { randomUUID } from 'node:crypto'; | ||
| import { mkdir, rm } from 'node:fs/promises'; | ||
| import { tmpdir } from 'node:os'; | ||
| import { join } from 'node:path'; | ||
| import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest'; | ||
|
|
||
| describe('import command', () => { | ||
| let testDir: string; | ||
| let projectDir: string; | ||
| const telemetry = createTelemetryHelper(); | ||
|
|
||
| beforeAll(async () => { | ||
| testDir = join(tmpdir(), `agentcore-import-telemetry-${randomUUID()}`); | ||
| await mkdir(testDir, { recursive: true }); | ||
|
|
||
| const projectName = 'ImportTelemetryProj'; | ||
| const result = await runCLI(['create', '--name', projectName, '--no-agent'], testDir); | ||
| if (result.exitCode !== 0) { | ||
| throw new Error(`Failed to create project: ${result.stdout} ${result.stderr}`); | ||
| } | ||
| projectDir = join(testDir, projectName); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| telemetry.clearEntries(); | ||
| }); | ||
|
|
||
| afterAll(async () => { | ||
| telemetry.destroy(); | ||
| await rm(testDir, { recursive: true, force: true }); | ||
| }); | ||
|
|
||
| describe('import --source', () => { | ||
| it('emits failure telemetry for nonexistent source file', async () => { | ||
| const result = await runCLI(['import', '--source', '/nonexistent/file.yaml'], projectDir, { | ||
| env: telemetry.env, | ||
| }); | ||
| expect(result.exitCode).toBe(1); | ||
| telemetry.assertMetricEmitted({ | ||
| command: 'import', | ||
| exit_reason: 'failure', | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe('import runtime', () => { | ||
| it('emits failure telemetry for invalid ARN', async () => { | ||
| const result = await runCLI(['import', 'runtime', '--arn', 'invalid-arn'], projectDir, { | ||
| env: telemetry.env, | ||
| }); | ||
| expect(result.exitCode).toBe(1); | ||
| telemetry.assertMetricEmitted({ | ||
| command: 'import.runtime', | ||
| exit_reason: 'failure', | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe('import memory', () => { | ||
| it('emits failure telemetry for invalid ARN', async () => { | ||
| const result = await runCLI(['import', 'memory', '--arn', 'invalid-arn'], projectDir, { | ||
| env: telemetry.env, | ||
| }); | ||
| expect(result.exitCode).toBe(1); | ||
| telemetry.assertMetricEmitted({ | ||
| command: 'import.memory', | ||
| exit_reason: 'failure', | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe('import evaluator', () => { | ||
| it('emits failure telemetry for invalid ARN', async () => { | ||
| const result = await runCLI(['import', 'evaluator', '--arn', 'invalid-arn'], projectDir, { | ||
| env: telemetry.env, | ||
| }); | ||
| expect(result.exitCode).toBe(1); | ||
| telemetry.assertMetricEmitted({ | ||
| command: 'import.evaluator', | ||
| exit_reason: 'failure', | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe('import gateway', () => { | ||
| it('emits failure telemetry for invalid ARN', async () => { | ||
| const result = await runCLI(['import', 'gateway', '--arn', 'invalid-arn'], projectDir, { | ||
| env: telemetry.env, | ||
| }); | ||
| expect(result.exitCode).toBe(1); | ||
| telemetry.assertMetricEmitted({ | ||
| command: 'import.gateway', | ||
| exit_reason: 'failure', | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe('import online-eval', () => { | ||
| it('emits failure telemetry for invalid ARN', async () => { | ||
| const result = await runCLI(['import', 'online-eval', '--arn', 'invalid-arn'], projectDir, { | ||
| env: telemetry.env, | ||
| }); | ||
| expect(result.exitCode).toBe(1); | ||
| telemetry.assertMetricEmitted({ | ||
| command: 'import.online-eval', | ||
| exit_reason: 'failure', | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.