fix: collect metrics to help analyze performance problems#1124
fix: collect metrics to help analyze performance problems#1124
Conversation
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.
d141182 to
9fa8629
Compare
9fa8629 to
671ef9f
Compare
671ef9f to
063862f
Compare
Changes are proposed in aws/aws-cdk-cli#1124. We could have sent this data as simple "counters" and not have had to change this page, but instead we are more obvious about it and send them as independent fields that we document. cr: https://code.amazon.com/reviews/CR-252851509
…li into huijbers/measure-more-perf
|
|
||
| function mutable<A extends object>(x: A): { -readonly [k in keyof A]: A[k] } { | ||
| return x; | ||
| } |
There was a problem hiding this comment.
are we gasp playing god here and turning immutable objects mutable?
There was a problem hiding this comment.
Yes. There are good reasons for it.
There was a problem hiding this comment.
I've only ever seen this as re-defining the entire variable
| await this.notify(this.definition.end.msg( | ||
| endMsg, { | ||
| duration: duration.asMs, | ||
| ...(Object.keys(this.counters).length > 0 ? { counters: this.counters } : {}), |
There was a problem hiding this comment.
nit, doesn't matter: is there a reason you didn't want to send counters: {}?
There was a problem hiding this comment.
Yeah, I like sending as little as possible.
| */ | ||
| type SpanEndArguments<T> = keyof T extends keyof SpanEnd | ||
| ? (Pick<Partial<SpanEnd>, keyof T & keyof SpanEnd> | void) | ||
| : Optional<T, keyof T & keyof SpanEnd>; |
There was a problem hiding this comment.
i read your comments but this was still greek to me. This is what Kiro said, if true, it was a lot simpler to understand:
In short: if the span type already covers everything SpanEnd needs, ending is
no-arg. If the span type has extra fields beyond SpanEnd, you're
forced to supply them when calling end().
There was a problem hiding this comment.
Kiro is not entirely correct. You can still, but don't have to override the implicit values with optionals.
| * It's hard for us to say `false` for sure, so we only respond | ||
| * with `yes` or `don't know`. |
There was a problem hiding this comment.
It's hard for us to say 'yes' for sure too, since anyone can add an env variable like this.
There was a problem hiding this comment.
True. That's why the name is guess
This PR changes telemetry to help diagnose and address performance problems.
The effective changes are as follows:
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