-
Notifications
You must be signed in to change notification settings - Fork 35
feat(cli): send telemetry events to local file #631
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
129 commits
Select commit
Hold shift + click to select a range
0c1c0b3
chore(cli): telemetry client
kaizencc 2fe74df
docs
kaizencc c6bf5f4
wip
kaizencc e91e7e3
use interfaces and fix tests
kaizencc 0d33ac5
add schema and pr feedback
kaizencc 7d5a19a
feat(cli): telemetry for list
kaizencc 41a461b
Merge branch 'main' into conroy/list
kaizencc c380240
Merge branch 'main' into conroy/basic-telemetry-client
kaizencc e51d30d
change to parsed url
kaizencc 9d980d5
readonly
kaizencc d8dd12f
Merge branch 'conroy/basic-telemetry-client' into conroy/list
kaizencc 9126147
Merge branch 'main' into conroy/basic-telemetry-client
kaizencc ab560fd
small change
kaizencc 4e361ae
retries implemented, not yet tested
kaizencc 69e63cd
add commented out test
kaizencc da20533
Merge branch 'conroy/basic-telemetry-client' into conroy/list
kaizencc ca3f172
refactor list telemetry, still wip
kaizencc 3b0082e
1 line change
kaizencc 8824e28
add message code
kaizencc f7cb38a
add failed synth
kaizencc 8760b44
Merge branch 'main' into conroy/basic-telemetry-client
kaizencc ece2874
fixup sanitation"
kaizencc 4dea47d
pr feedback
kaizencc 3dbbe62
add proxy support, better retries, test succeeds
kaizencc feaf376
lint
kaizencc 83ebd08
lints
kaizencc 4b8397b
Merge branch 'conroy/basic-telemetry-client' into conroy/list
kaizencc cf285bb
wip
kaizencc 2c8191b
reworked with iohost
kaizencc 6c977b6
include spans
kaizencc 56f23e5
force not ci in tests
kaizencc 079bbc5
Merge branch 'main' into conroy/basic-telemetry-client
kaizencc 8e43ba7
Merge branch 'conroy/basic-telemetry-client' into conroy/list
kaizencc 9dd1580
refactors from friday are in a working state
kaizencc 55a4a73
add cdk library version
kaizencc 1041bf8
collect telemetry
kaizencc 635d6b7
Merge branch 'main' into conroy/basic-telemetry-client
kaizencc 18d9349
Merge branch 'main' into conroy/basic-telemetry-client
kaizencc 1811c9a
Merge branch 'conroy/basic-telemetry-client' into conroy/list
kaizencc ea4720c
Merge branch 'main' into conroy/basic-telemetry-client
kaizencc b9c0d6d
Merge branch 'conroy/basic-telemetry-client' into conroy/list
kaizencc 46cc2c8
remove circular dependencies
kaizencc 76a19ff
diff tests need to not depend on message order
kaizencc 2433e3e
update type registry name
kaizencc b30d188
can collect telemetry
kaizencc fe47576
callback function on crtl-c
kaizencc 4bf3be9
Merge branch 'main' into conroy/basic-telemetry-client
kaizencc 359a442
telemetry interface includes flush
kaizencc c20ad8b
Merge branch 'conroy/basic-telemetry-client' into conroy/list
kaizencc 54109d6
rename
kaizencc 334b9dd
lint
kaizencc 39152d3
Merge branch 'conroy/basic-telemetry-client' into conroy/list
kaizencc fbd6dd6
small fixes
kaizencc 70fa3e3
minor enhancements
kaizencc e02a283
wip
kaizencc 25dec4a
pr feedback
kaizencc 5628ed9
trace
kaizencc cc8c6dd
pr feedback
kaizencc 9433b36
tests for collect-telemetry
kaizencc 72c862e
lint
kaizencc d3c745c
test for installation ids
kaizencc da64d2b
library-version tests
kaizencc b007f0e
library version tests
kaizencc 9caf42e
refactor telemetry session
kaizencc ad0e6cd
minors
kaizencc c7d365a
renames
kaizencc fb85dfa
Merge branch 'conroy/basic-telemetry-client' into conroy/list
kaizencc e139111
Merge branch 'main' into conroy/list
kaizencc 27ea7e6
fix merge
kaizencc f74bb90
small updates
kaizencc d79756f
fix stupid await
kaizencc 80fad80
sanitize tests
kaizencc e087b50
accountid test
kaizencc 66bb8c1
region fetcher tests
kaizencc 64b5fa2
fix tests from merge
kaizencc b5d0f32
fix build
kaizencc b2b56d3
Merge branch 'main' into conroy/list
kaizencc 1adc88e
session unit tests
kaizencc 541eeb4
Update packages/aws-cdk/test/commands/diff.test.ts
kaizencc 59aecf1
iohost unit tests
kaizencc af1bbbb
Update packages/aws-cdk/lib/init-templates/.init-version.json
kaizencc 6a86ee3
Update .recommended-feature-flags.json
kaizencc 6427847
Update .recommended-feature-flags.json
kaizencc effed08
s
kaizencc 27fa7de
fix
kaizencc 75b6490
Merge branch 'main' into conroy/list
kaizencc 9dc5a68
update test
kaizencc 8341898
Apply suggestions from code review
kaizencc e783eb2
ci file
kaizencc 4fad6c6
Merge branch 'main' into conroy/list
kaizencc 31f5a92
refactors
kaizencc 670a289
update-test
kaizencc 8ea3e65
merge
kaizencc 0a15701
delete previously deleted file
kaizencc d193044
fix merge
kaizencc c694d99
telemetry to file
kaizencc 2b51b13
update
kaizencc d17faf7
add cli integ test for telemetry file
kaizencc 1c94d1b
Merge branch 'main' into conroy/list
kaizencc 1e138ac
update version and fix tests
kaizencc 3b0917d
chore: self mutation
invalid-email-address 956aa9f
Merge branch 'main' into conroy/list
kaizencc cfc070d
Merge branch 'main' into conroy/list
kaizencc 3f850e0
integ test for failure
kaizencc 2edd715
chore: self mutation
invalid-email-address e317acd
Merge branch 'main' into conroy/list
kaizencc 17d4d19
Merge branch 'main' into conroy/list
kaizencc c53f310
Merge branch 'main' into conroy/list
iliapolo b37c6dd
build
iliapolo 30e054b
pr feedback
kaizencc f36edc8
more pr feedback
kaizencc c933608
remove config for now
kaizencc 136546b
final pr feedbacks
kaizencc 7fb93b9
lint
kaizencc fb49fa4
unique files
kaizencc aa21c27
add feature flags
kaizencc 4d8620f
Update packages/aws-cdk/README.md
kaizencc 25afd6f
Apply suggestions from code review
kaizencc a90bf24
test changes
kaizencc b6911c9
rename featureflags
kaizencc cd2d2d0
rename file
kaizencc 5b461b0
final pr feedback
kaizencc 58254f8
update integs
kaizencc 3b75fd9
Merge branch 'main' into conroy/list
kaizencc 3a99e78
update tests
kaizencc e66d364
chore: self mutation
invalid-email-address 84f6cc5
merge
kaizencc a737980
fix linter
kaizencc 41389ff
chore: self mutation
invalid-email-address 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
127 changes: 127 additions & 0 deletions
127
...esting/cli-integ/tests/cli-integ-tests/synth/cdk-synth-telemetry-with-errors.integtest.ts
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,127 @@ | ||
import * as path from 'path'; | ||
import * as fs from 'fs-extra'; | ||
import { integTest, withDefaultFixture } from '../../../lib'; | ||
|
||
jest.setTimeout(2 * 60 * 60_000); // Includes the time to acquire locks, worst-case single-threaded runtime | ||
|
||
integTest( | ||
'cdk synth with telemetry and validation error leads to invoke failure', | ||
withDefaultFixture(async (fixture) => { | ||
const telemetryFile = path.join(fixture.integTestDir, `telemetry-${Date.now()}.json`); | ||
const output = await fixture.cdk(['synth', '--unstable=telemetry', `--telemetry-file=${telemetryFile}`], { | ||
allowErrExit: true, | ||
modEnv: { | ||
INTEG_STACK_SET: 'stage-with-errors', | ||
}, | ||
}); | ||
|
||
expect(output).toContain('This is an error'); | ||
|
||
const json = fs.readJSONSync(telemetryFile); | ||
expect(json).toEqual([ | ||
expect.objectContaining({ | ||
event: expect.objectContaining({ | ||
command: expect.objectContaining({ | ||
path: ['synth'], | ||
parameters: { | ||
verbose: 1, | ||
unstable: '<redacted>', | ||
['telemetry-file']: '<redacted>', | ||
lookups: true, | ||
['ignore-errors']: false, | ||
json: false, | ||
debug: false, | ||
staging: true, | ||
notices: true, | ||
['no-color']: false, | ||
ci: expect.anything(), // changes based on where this is called | ||
validation: true, | ||
quiet: false, | ||
}, | ||
config: { | ||
context: {}, | ||
}, | ||
}), | ||
state: 'SUCCEEDED', | ||
eventType: 'SYNTH', | ||
}), | ||
identifiers: expect.objectContaining({ | ||
installationId: expect.anything(), | ||
sessionId: expect.anything(), | ||
telemetryVersion: '1.0', | ||
cdkCliVersion: expect.anything(), | ||
cdkLibraryVersion: fixture.library.requestedVersion(), | ||
region: expect.anything(), | ||
eventId: expect.stringContaining(':1'), | ||
timestamp: expect.anything(), | ||
}), | ||
environment: { | ||
ci: expect.anything(), | ||
os: { | ||
platform: expect.anything(), | ||
release: expect.anything(), | ||
}, | ||
nodeVersion: expect.anything(), | ||
}, | ||
project: {}, | ||
duration: { | ||
total: expect.anything(), | ||
}, | ||
}), | ||
expect.objectContaining({ | ||
event: expect.objectContaining({ | ||
command: expect.objectContaining({ | ||
path: ['synth'], | ||
parameters: { | ||
verbose: 1, | ||
unstable: '<redacted>', | ||
['telemetry-file']: '<redacted>', | ||
lookups: true, | ||
['ignore-errors']: false, | ||
json: false, | ||
debug: false, | ||
staging: true, | ||
notices: true, | ||
['no-color']: false, | ||
ci: expect.anything(), // changes based on where this is called | ||
validation: true, | ||
quiet: false, | ||
}, | ||
config: { | ||
context: {}, | ||
}, | ||
}), | ||
state: 'FAILED', | ||
eventType: 'INVOKE', | ||
}), | ||
identifiers: expect.objectContaining({ | ||
installationId: expect.anything(), | ||
sessionId: expect.anything(), | ||
telemetryVersion: '1.0', | ||
cdkCliVersion: expect.anything(), | ||
cdkLibraryVersion: fixture.library.requestedVersion(), | ||
region: expect.anything(), | ||
eventId: expect.stringContaining(':2'), | ||
timestamp: expect.anything(), | ||
}), | ||
environment: { | ||
ci: expect.anything(), | ||
os: { | ||
platform: expect.anything(), | ||
release: expect.anything(), | ||
}, | ||
nodeVersion: expect.anything(), | ||
}, | ||
project: {}, | ||
duration: { | ||
total: expect.anything(), | ||
}, | ||
error: { | ||
name: 'AssemblyError', | ||
}, | ||
}), | ||
]); | ||
fs.unlinkSync(telemetryFile); | ||
}), | ||
); | ||
|
117 changes: 117 additions & 0 deletions
117
...s/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/synth/cdk-synth-telemetry.integtest.ts
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,117 @@ | ||
import * as path from 'path'; | ||
import * as fs from 'fs-extra'; | ||
import { integTest, withDefaultFixture } from '../../../lib'; | ||
|
||
jest.setTimeout(2 * 60 * 60_000); // Includes the time to acquire locks, worst-case single-threaded runtime | ||
|
||
integTest( | ||
'cdk synth with telemetry data', | ||
withDefaultFixture(async (fixture) => { | ||
const telemetryFile = path.join(fixture.integTestDir, `telemetry-${Date.now()}.json`); | ||
await fixture.cdk(['synth', fixture.fullStackName('test-1'), '--unstable=telemetry', `--telemetry-file=${telemetryFile}`]); | ||
const json = fs.readJSONSync(telemetryFile); | ||
expect(json).toEqual([ | ||
expect.objectContaining({ | ||
event: expect.objectContaining({ | ||
command: expect.objectContaining({ | ||
path: ['synth', '$STACKS_1'], | ||
parameters: { | ||
verbose: 1, | ||
unstable: '<redacted>', | ||
['telemetry-file']: '<redacted>', | ||
lookups: true, | ||
['ignore-errors']: false, | ||
json: false, | ||
debug: false, | ||
staging: true, | ||
notices: true, | ||
['no-color']: false, | ||
ci: expect.anything(), // changes based on where this is called | ||
validation: true, | ||
quiet: false, | ||
}, | ||
config: { | ||
context: {}, | ||
}, | ||
}), | ||
state: 'SUCCEEDED', | ||
eventType: 'SYNTH', | ||
}), | ||
// some of these can change; but we assert that some value is recorded | ||
identifiers: expect.objectContaining({ | ||
installationId: expect.anything(), | ||
sessionId: expect.anything(), | ||
telemetryVersion: '1.0', | ||
cdkCliVersion: expect.anything(), | ||
cdkLibraryVersion: fixture.library.requestedVersion(), | ||
region: expect.anything(), | ||
eventId: expect.stringContaining(':1'), | ||
timestamp: expect.anything(), | ||
}), | ||
environment: { | ||
ci: expect.anything(), | ||
os: { | ||
platform: expect.anything(), | ||
release: expect.anything(), | ||
}, | ||
nodeVersion: expect.anything(), | ||
}, | ||
project: {}, | ||
duration: { | ||
total: expect.anything(), | ||
}, | ||
}), | ||
expect.objectContaining({ | ||
event: expect.objectContaining({ | ||
command: expect.objectContaining({ | ||
path: ['synth', '$STACKS_1'], | ||
parameters: { | ||
verbose: 1, | ||
unstable: '<redacted>', | ||
['telemetry-file']: '<redacted>', | ||
lookups: true, | ||
['ignore-errors']: false, | ||
json: false, | ||
debug: false, | ||
staging: true, | ||
notices: true, | ||
['no-color']: false, | ||
ci: expect.anything(), // changes based on where this is called | ||
validation: true, | ||
quiet: false, | ||
}, | ||
config: { | ||
context: {}, | ||
}, | ||
}), | ||
state: 'SUCCEEDED', | ||
eventType: 'INVOKE', | ||
}), | ||
identifiers: expect.objectContaining({ | ||
installationId: expect.anything(), | ||
sessionId: expect.anything(), | ||
telemetryVersion: '1.0', | ||
cdkCliVersion: expect.anything(), | ||
cdkLibraryVersion: fixture.library.requestedVersion(), | ||
region: expect.anything(), | ||
eventId: expect.stringContaining(':2'), | ||
timestamp: expect.anything(), | ||
}), | ||
environment: { | ||
ci: expect.anything(), | ||
os: { | ||
platform: expect.anything(), | ||
release: expect.anything(), | ||
}, | ||
nodeVersion: expect.anything(), | ||
}, | ||
project: {}, | ||
duration: { | ||
total: expect.anything(), | ||
}, | ||
}), | ||
]); | ||
fs.unlinkSync(telemetryFile); | ||
}), | ||
); | ||
|
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.