-
Notifications
You must be signed in to change notification settings - Fork 746
feat(telemetry): metrics with missing fields are warned in the logs. #7196
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
Conversation
|
46c256b to
1b3cfc4
Compare
|
tracked failing test #7187. |
|
|
||
| // TODO: there are many instances in the toolkit where we emit metrics with missing fields. If those can be removed, we can configure this to throw in CI. | ||
| if (metadata.missingFields) { | ||
| logger.warn(msgPrefix + `"${metricName} emitted with missing fields: ${metadata.missingFields}`, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any concerns of this spamming the users logs too much?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I see after messing around in Q for a few minutes, so I am not too concerned.
2025-05-02 15:32:30.013 [warning] telemetry: invalid Metric: "languageServer_setup emitted with missing fields: id
2025-05-02 15:32:30.013 [warning] telemetry: invalid Metric: "languageServer_setup emitted with missing fields: id
2025-05-02 15:32:37.919 [warning] telemetry: invalid Metric: "languageServer_setup emitted with missing fields: id
2025-05-02 15:32:37.919 [warning] telemetry: invalid Metric: "languageServer_setup emitted with missing fields: id
2025-05-02 15:33:00.476 [warning] telemetry: invalid Metric: "amazonq_addMessage emitted with missing fields: cwsprChatTimeToFirstChunk
2025-05-02 15:34:09.534 [warning] telemetry: invalid Metric: "amazonq_addMessage emitted with missing fields: cwsprChatTimeToFirstChunk
2025-05-02 15:35:04.858 [warning] telemetry: invalid Metric: "amazonq_addMessage emitted with missing fields: cwsprChatTimeToFirstChunk
2025-05-02 15:36:13.968 [warning] telemetry: invalid Metric: "amazonq_addMessage emitted with missing fields: cwsprChatTimeToFirstChunk
I also checked Toolkit and wasn't able to find any of these. addMessage was fixed in aws/language-servers#1222. I can look into the languageServer_setup one as a follow-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably do a logOnce thing for these warnings, since duplicates aren't useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this pattern seems somewhat common, I added a utility to execute functions once per unique argument. Then used that to implement the logOnce. (also refactored the processUtils to use it).
| * logOnce('test') // prints: test | ||
| * ``` | ||
| */ | ||
| export function oncePerUniqueArg<T, U extends any[]>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
off-topic: Might be able to drop onceChanged in favor of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah its somewhat of a generalization. I think we could reimplement onceChanged to call oncePerUniqueArg with a buffer size of 1 so that it only compares against the previous.
Problem
A metric was forwarded from Flare with missing fields. This resulted in some confusion about why the metric wasn't showing up properly in Kibana.
Solution
Future Work
feature/xbranches will not be squash-merged at release time.