Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0c1c0b3
chore(cli): telemetry client
kaizencc Jun 9, 2025
2fe74df
docs
kaizencc Jun 9, 2025
c6bf5f4
wip
kaizencc Jun 13, 2025
e91e7e3
use interfaces and fix tests
kaizencc Jun 13, 2025
0d33ac5
add schema and pr feedback
kaizencc Jun 16, 2025
c380240
Merge branch 'main' into conroy/basic-telemetry-client
kaizencc Jun 18, 2025
e51d30d
change to parsed url
kaizencc Jun 18, 2025
9d980d5
readonly
kaizencc Jun 18, 2025
9126147
Merge branch 'main' into conroy/basic-telemetry-client
kaizencc Jun 19, 2025
ab560fd
small change
kaizencc Jun 19, 2025
4e361ae
retries implemented, not yet tested
kaizencc Jun 19, 2025
69e63cd
add commented out test
kaizencc Jun 19, 2025
8760b44
Merge branch 'main' into conroy/basic-telemetry-client
kaizencc Jun 21, 2025
3dbbe62
add proxy support, better retries, test succeeds
kaizencc Jun 25, 2025
feaf376
lint
kaizencc Jun 25, 2025
83ebd08
lints
kaizencc Jun 25, 2025
56f23e5
force not ci in tests
kaizencc Jun 26, 2025
079bbc5
Merge branch 'main' into conroy/basic-telemetry-client
kaizencc Jun 26, 2025
635d6b7
Merge branch 'main' into conroy/basic-telemetry-client
kaizencc Jun 30, 2025
18d9349
Merge branch 'main' into conroy/basic-telemetry-client
kaizencc Jul 1, 2025
ea4720c
Merge branch 'main' into conroy/basic-telemetry-client
kaizencc Jul 2, 2025
4bf3be9
Merge branch 'main' into conroy/basic-telemetry-client
kaizencc Jul 2, 2025
359a442
telemetry interface includes flush
kaizencc Jul 2, 2025
54109d6
rename
kaizencc Jul 2, 2025
334b9dd
lint
kaizencc Jul 2, 2025
25dec4a
pr feedback
kaizencc Jul 2, 2025
5628ed9
trace
kaizencc Jul 2, 2025
cc8c6dd
pr feedback
kaizencc Jul 2, 2025
c7d365a
renames
kaizencc Jul 3, 2025
ab8bc32
fix tests
kaizencc Jul 3, 2025
0365976
remove url file
kaizencc Jul 3, 2025
8fdd0e9
add test on errors
kaizencc Jul 3, 2025
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
Prev Previous commit
Next Next commit
pr feedback
  • Loading branch information
kaizencc committed Jul 2, 2025
commit cc8c6dd316db9d999d475bc8aefac83f0582d39d
19 changes: 10 additions & 9 deletions packages/aws-cdk/lib/cli/telemetry/endpoint-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { IIoHost } from '../io-host';
import type { TelemetrySchema } from './schema';
import type { ITelemetrySink } from './sink-interface';

const REQUEST_ATTEMPT_TIMEOUT_MS = 2_000;
const REQUEST_ATTEMPT_TIMEOUT_MS = 500;

/**
* Properties for the Endpoint Telemetry Client
Expand Down Expand Up @@ -65,19 +65,20 @@ export class EndpointTelemetryClient implements ITelemetrySink {
}

public async flush(): Promise<void> {
if (this.events.length === 0) {
return;
}

try {
if (this.events.length === 0) {
return;
}

const res = await this.https(this.endpoint, this.events);

// Clear the events array after successful output
if (res) {
this.events = [];
}
} catch (_e: any) {
// Never throw errors, and error message was previously logged to ioHost
} catch (e: any) {
// Never throw errors, just log them via ioHost
await this.ioHelper.defaults.trace(`Failed to add telemetry event: ${e.message}`);
}
}

Expand All @@ -89,7 +90,7 @@ export class EndpointTelemetryClient implements ITelemetrySink {
body: TelemetrySchema[],
): Promise<boolean> {
try {
const res = await requestPromise(url, body, this.agent);
const res = await doRequest(url, body, this.agent);

// Successfully posted
if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
Expand All @@ -109,7 +110,7 @@ export class EndpointTelemetryClient implements ITelemetrySink {
/**
* A Promisified version of `https.request()`
*/
function requestPromise(
function doRequest(
url: UrlWithStringQuery,
data: TelemetrySchema[],
agent?: Agent,
Expand Down
Loading