Skip to content

Metrics specs#4956

Open
Kesari3008 wants to merge 3 commits into
webex:nextfrom
Kesari3008:Metrics-Specs
Open

Metrics specs#4956
Kesari3008 wants to merge 3 commits into
webex:nextfrom
Kesari3008:Metrics-Specs

Conversation

@Kesari3008
Copy link
Copy Markdown
Contributor

@Kesari3008 Kesari3008 commented May 6, 2026

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Other - Please Specify
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

I certified that

  • I have read and followed contributing guidelines
  • I discussed changes with code owners prior to submitting this pull request
  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the documentation accordingly

Make sure to have followed the contributing guidelines before submitting.

@Kesari3008 Kesari3008 added the validated If the pull request is validated for automation. label May 6, 2026
@aws-amplify-us-east-2
Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-4956.d3m3l2kee0btzx.amplifyapp.com

@Kesari3008 Kesari3008 marked this pull request as ready for review May 12, 2026 16:10
@Kesari3008 Kesari3008 requested a review from a team as a code owner May 12, 2026 16:10
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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`).
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Member

@eigengravy eigengravy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


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`).
Copy link
Copy Markdown
Member

@eigengravy eigengravy May 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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

Labels

validated If the pull request is validated for automation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants