Metrics specs#4956
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a7e92d5c0d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| The `MetricManager` validates the `name` parameter against expected `METRIC_EVENT` values using switch statements. If an invalid name is received, it logs a warning and does not submit the metric. This prevents malformed telemetry from being sent. | ||
|
|
||
| **Exception:** `submitUploadLogsMetric` and `submitConnectionMetrics` do NOT log a warning on invalid names — they simply don't submit (data remains `undefined`). |
There was a problem hiding this comment.
Correct connection-metric invalid-name behavior in docs
This exception is inaccurate for submitConnectionMetrics: the implementation never validates name and always calls submitClientMetrics (packages/calling/src/Metrics/index.ts, lines 38-63), so invalid names are still sent rather than dropped. Keeping this statement will mislead maintainers and AI agents during troubleshooting and future changes by documenting the opposite of runtime behavior.
Useful? React with 👍 / 👎.
|
|
||
| The `MetricManager` validates the `name` parameter against expected `METRIC_EVENT` values using switch statements. If an invalid name is received, it logs a warning and does not submit the metric. This prevents malformed telemetry from being sent. | ||
|
|
||
| **Exception:** `submitUploadLogsMetric` and `submitConnectionMetrics` do NOT log a warning on invalid names — they simply don't submit (data remains `undefined`). |
There was a problem hiding this comment.
Nit: submitConnectionMetrics doesn't actually have the same silent-skip behavior as submitUploadLogsMetric — it has no switch/validation and unconditionally builds and submits the metric data (the if (metricData) guard is vacuous since an object literal is always truthy).
In practice this doesn't matter since TypeScript enforces valid names at compile time (name: METRIC_EVENT, metricAction: CONNECTION_ACTION), and all callers pass METRIC_EVENT.CONNECTION_ERROR. But the description here implies a runtime guard that doesn't exist.
Ref: packages/calling/src/Metrics/index.ts lines 38-63
COMPLETES
This pull request addresses
Spec for metrics folder in Calling SDK
by making the following changes
Added AGENTS.md and ARCHITECTURE.md for metrics folder.
Change Type
The following scenarios were tested
< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >
The GAI Coding Policy And Copyright Annotation Best Practices
I certified that
Make sure to have followed the contributing guidelines before submitting.