Skip to content

Commit 8ac049e

Browse files
kaizencciliapolo
andauthored
feat: release telemetry (#969)
This PR turns on telemetry collection by default. See telemetry [docs](https://docs.aws.amazon.com/cdk/v2/guide/cli-telemetry.html) for ways to opt-out. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license Co-authored-by: Eli Polonsky <[email protected]>
1 parent f7642da commit 8ac049e

File tree

6 files changed

+3
-10
lines changed

6 files changed

+3
-10
lines changed

packages/@aws-cdk-testing/cli-integ/tests/telemetry-integ-tests/cdk-cli-telemetry-disable-sends-no-data.integtest.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import { TELEMETRY_ENDPOINT } from './constants';
21
import { integTest, withDefaultFixture } from '../../lib';
32

43
jest.setTimeout(2 * 60 * 60_000); // Includes the time to acquire locks, worst-case single-threaded runtime
54

65
integTest(
76
'CLI Telemetry --disable does not send to endpoint',
87
withDefaultFixture(async (fixture) => {
9-
const output = await fixture.cdk(['cli-telemetry', '--disable'], { verboseLevel: 3, modEnv: { TELEMETRY_ENDPOINT: TELEMETRY_ENDPOINT } });
8+
const output = await fixture.cdk(['cli-telemetry', '--disable'], { verboseLevel: 3 });
109

1110
// Check the trace that telemetry was not executed successfully
1211
expect(output).not.toContain('Telemetry Sent Successfully');

packages/@aws-cdk-testing/cli-integ/tests/telemetry-integ-tests/cdk-deploy-telemetry.integtest.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as path from 'path';
22
import * as fs from 'fs-extra';
3-
import { TELEMETRY_ENDPOINT } from './constants';
43
import { integTest, withDefaultFixture } from '../../lib';
54

65
jest.setTimeout(2 * 60 * 60_000); // Includes the time to acquire locks, worst-case single-threaded runtime
@@ -14,7 +13,6 @@ integTest(
1413
const deployOutput = await fixture.cdkDeploy('test-1', {
1514
telemetryFile,
1615
verboseLevel: 3, // trace mode
17-
modEnv: { TELEMETRY_ENDPOINT: TELEMETRY_ENDPOINT },
1816
});
1917

2018
// Check the trace that telemetry was executed successfully

packages/@aws-cdk-testing/cli-integ/tests/telemetry-integ-tests/cdk-synth-telemetry-with-errors.integtest.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as path from 'path';
22
import * as fs from 'fs-extra';
3-
import { TELEMETRY_ENDPOINT } from './constants';
43
import { integTest, withDefaultFixture } from '../../lib';
54

65
jest.setTimeout(2 * 60 * 60_000); // Includes the time to acquire locks, worst-case single-threaded runtime
@@ -13,7 +12,6 @@ integTest(
1312
allowErrExit: true,
1413
modEnv: {
1514
INTEG_STACK_SET: 'stage-with-errors',
16-
TELEMETRY_ENDPOINT: TELEMETRY_ENDPOINT,
1715
},
1816
verboseLevel: 3, // trace mode
1917
});

packages/@aws-cdk-testing/cli-integ/tests/telemetry-integ-tests/cdk-synth-telemetry.integtest.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as path from 'path';
22
import * as fs from 'fs-extra';
3-
import { TELEMETRY_ENDPOINT } from './constants';
43
import { integTest, withDefaultFixture } from '../../lib';
54

65
jest.setTimeout(2 * 60 * 60_000); // Includes the time to acquire locks, worst-case single-threaded runtime
@@ -12,7 +11,7 @@ integTest(
1211

1312
const synthOutput = await fixture.cdk(
1413
['synth', fixture.fullStackName('test-1'), `--telemetry-file=${telemetryFile}`],
15-
{ modEnv: { TELEMETRY_ENDPOINT: TELEMETRY_ENDPOINT }, verboseLevel: 3 }, // trace mode
14+
{ verboseLevel: 3 }, // trace mode
1615
);
1716

1817
// Check the trace that telemetry was executed successfully

packages/@aws-cdk-testing/cli-integ/tests/telemetry-integ-tests/constants.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/aws-cdk/lib/cli/io-host/cli-io-host.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export class CliIoHost implements IIoHost {
203203
}
204204
}
205205

206-
const telemetryEndpoint = process.env.TELEMETRY_ENDPOINT;
206+
const telemetryEndpoint = process.env.TELEMETRY_ENDPOINT ?? 'https://cdk-cli-telemetry.us-east-1.api.aws/metrics';
207207
if (canCollectTelemetry(args, context) && telemetryEndpoint) {
208208
try {
209209
sinks.push(new EndpointTelemetrySink({

0 commit comments

Comments
 (0)