Skip to content

fix: collect metrics to help analyze performance problems#1124

Draft
rix0rrr wants to merge 15 commits intomainfrom
huijbers/measure-more-perf
Draft

fix: collect metrics to help analyze performance problems#1124
rix0rrr wants to merge 15 commits intomainfrom
huijbers/measure-more-perf

Conversation

@rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Feb 9, 2026

This PR changes telemetry to help diagnose and address performance problems.

The effective changes are as follows:

  • We are seeing slow synth times.
    • Log the total number of assemblies and stacks to correlate and segment synth times and stack counts (is the relationship linear/nonlinear, are slow synth times due to huge applications, ...)
    • Log the (guessed) implementation language, to see if synth times behave differently between languages, if startup times make a lot of difference, etc.
  • We are concerned about the time needed for agents to produce a successful CDK application.
    • Try to determine whether we are currently being run by an agent so we can segment on that.
    • Log the counts of warnings and errors, to see if deployment failure is or can be preceded/prevented by better error reporting at synth time.
  • The library version we were collecting was a rough guess, do a better one once we have accurate information.
  • Count the number of resources in a stack to correlate and segment deployment times by resource count.

For consistency, the same counters changes are being made to toolkit-lib, even though those counters aren't being consumed by anything.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

In multiple places the `SYNTH` span doesn't measure the time to
synthesize the assembly, but rather the time to select stacks from an
already-synthesized assembly.

Presumably this was done in order to avoid duplicating this line:

```ts
    const selectStacks = options.stacks ?? ALL_STACKS;
```

Instead, introduce a helper function that gets called from all places,
and centralize the `selectStacks` logic so we don't fear duplication
anymore.
@rix0rrr rix0rrr force-pushed the huijbers/measure-more-perf branch from d141182 to 9fa8629 Compare February 9, 2026 09:57
@github-actions github-actions bot added the p2 label Feb 9, 2026
@aws-cdk-automation aws-cdk-automation requested a review from a team February 9, 2026 09:57
@rix0rrr rix0rrr changed the title fix: collect metrics to help analyze performance impact fix: collect metrics to help analyze performance problems Feb 9, 2026
@rix0rrr rix0rrr force-pushed the huijbers/measure-more-perf branch from 9fa8629 to 671ef9f Compare February 9, 2026 09:58
@rix0rrr rix0rrr force-pushed the huijbers/measure-more-perf branch from 671ef9f to 063862f Compare February 9, 2026 09:59
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 71.73913% with 65 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.34%. Comparing base (da376fd) to head (a12cc87).

Files with missing lines Patch % Lines
packages/aws-cdk/lib/cli/util/guess-language.ts 42.62% 35 Missing ⚠️
packages/aws-cdk/lib/cli/util/guess-agent.ts 55.88% 13 Missing and 2 partials ⚠️
packages/aws-cdk/lib/cli/cli.ts 40.00% 9 Missing ⚠️
packages/aws-cdk/lib/cli/telemetry/session.ts 94.11% 4 Missing ⚠️
packages/aws-cdk/lib/cli/cdk-toolkit.ts 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1124      +/-   ##
==========================================
- Coverage   87.71%   87.34%   -0.37%     
==========================================
  Files          72       74       +2     
  Lines       10116    10329     +213     
  Branches     1337     1371      +34     
==========================================
+ Hits         8873     9022     +149     
- Misses       1217     1279      +62     
- Partials       26       28       +2     
Flag Coverage Δ
suite.unit 87.34% <71.73%> (-0.37%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments