Skip to content
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

feat(internal-plugin-metrics): add business_metrics_wxcc_desktop #4000

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

lialang-cisco
Copy link
Contributor

@lialang-cisco lialang-cisco commented Nov 21, 2024

COMPLETES #CX-17090

This pull request addresses CX-17090

by making the following changes, we allow consumers of the SDK to send metrics to the business_metrics_wxcc_desktop talbe in Pinot.

Add a new value to the Table enum, which describes which table in Pinot a business metric event should be sent to: business_metrics_wxcc_desktop; and corresponding method in business-metrics.ts to send the metric with the appropriate metadata.

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

Sent a metric event from the wxcc_desktop client using this new code path, and observed it in Pinot in the desired table. Added unit test.

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.

Summary by CodeRabbit

  • New Features

    • Introduced support for submitting business metrics specifically for the Webex application desktop version.
    • Expanded the metrics categorization to include a new table for Webex desktop metrics.
  • Bug Fixes

    • Enhanced the event submission method to ensure accurate data structure for the new metrics table.
  • Tests

    • Added a new test case to verify the correct formation of business events for the Webex desktop metrics table.

@lialang-cisco lialang-cisco requested review from a team as code owners November 21, 2024 12:07
Copy link

coderabbitai bot commented Nov 21, 2024

Walkthrough

The changes introduce a new private method submitWxccDesktopEvent to the BusinessMetrics class for submitting metrics to the business_metrics_wxcc_desktop table. The public method submitBusinessEvent is updated to accommodate this new table. Additionally, the Table type is expanded to include the new string literal type 'business_metrics_wxcc_desktop'. A corresponding test case is added to ensure the correct event structure for submissions to this new table.

Changes

File Change Summary
packages/@webex/internal-plugin-metrics/src/business-metrics.ts - Added method private submitWxccDesktopEvent for metrics submission to business_metrics_wxcc_desktop.
- Updated public submitBusinessEvent to handle the new table case.
packages/@webex/internal-plugin-metrics/src/metrics.types.ts - Expanded Table type to include 'business_metrics_wxcc_desktop'.
packages/@webex/internal-plugin-metrics/test/unit/spec/business/business-metrics.ts - Added test case for submitBusinessEvent to verify event structure for business_metrics_wxcc_desktop.

Possibly related PRs

Suggested labels

validated

Suggested reviewers

  • Shreyas281299
  • adhmenon

Poem

In the meadow where metrics play,
A new event joins the fray.
With wxcc now in sight,
Business data takes flight!
Rabbits hop with joy and cheer,
Metrics dance, the time is near! 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

warning eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning eslint > @humanwhocodes/config-array@0.13.0: Use @eslint/config-array instead
warning eslint > @humanwhocodes/config-array > @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
warning eslint > file-entry-cache > flat-cache > rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob > inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
warning eslint-import-resolver-typescript > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning glob@7.2.3: Glob versions prior to v9 are no longer supported
warning intern > glob@7.1.7: Glob versions prior to v9 are no longer supported
warning intern > glob > inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
warning jasmine > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > jest-config > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > jest-runtime > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > @jest/reporters > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > @jest/transform > babel-plugin-istanbul > test-exclude > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning mocha > glob@7.2.0: Glob versions prior to v9 are no longer supported
warning mocha > glob > inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
warning sinon@9.2.4: 16.1.1
warning wd > request@2.88.0: request has been deprecated, see request/request#3142
warning wd > archiver > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning wd > q@1.5.1: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other.

(For a CapTP with native promises, see @endo/eventual-send and @endo/captp)
warning wd > request > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
warning wd > request > har-validator@5.1.5: this library is no longer supported
warning wd > archiver > archiver-utils > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning @babel/cli > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning @babel/plugin-proposal-async-generator-functions@7.20.7: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-async-generator-functions instead.
warning @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
warning @babel/plugin-proposal-export-namespace-from@7.18.9: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-export-namespace-from instead.
warning @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
warning @babel/plugin-proposal-object-rest-spread@7.20.7: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.
warning @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
warning @babel/polyfill@7.12.1: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
warning @babel/polyfill > core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning @babel/runtime-corejs2 > core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning babel-plugin-lodash > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning workspace-aggregator-b070e72e-96f4-49ec-9b36-a41b1acda3b3 > eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning workspace-aggregator-b070e72e-96f4-49ec-9b36-a41b1acda3b3 > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning workspace-aggregator-b070e72e-96f4-49ec-9b36-a41b1acda3b3 > sinon@9.2.4: 16.1.1
warning workspace-aggregator-b070e72e-96f4-49ec-9b36-a41b1acda3b3 > @babel/plugin-proposal-async-generator-functions@7.20.7: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-async-generator-functions instead.
warning workspace-aggregator-b070e72e-96f4-49ec-9b36-a41b1acda3b3 > @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
warning workspace-aggregator-b070e72e-96f4-49ec-9b36-a41b1acda3b3 > @babel/plugin-proposal-export-namespace-from@7.18.9: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-export-namespace-from instead.
warning workspace-aggregator-b070e72e-96f4-49ec-9b36-a41b1acda3b3 > @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
warning workspace-aggregator-b070e72e-96f4-49ec-9b36-a41b1acda3b3 > @babel/plugin-proposal-object-rest-spread@7.20.7: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.
warning workspace-aggregator-b070e72e-96f4-49ec-9b36-a41b1acda3b3 > @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
warning workspace-aggregator-b070e72e-96f4-49ec-9b36-a41b1acda3b3 > @babel/polyfill@7.12.1: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
error eslint-plugin-jsdoc@40.3.0: The engine "node" is incompatible with this module. Expected version "^14 || ^16 || ^17 || ^18 || ^19". Got "22.9.0"
error Found incompatible module.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

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

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (3)
packages/@webex/internal-plugin-metrics/src/business-metrics.ts (2)

65-71: Fix typo in documentation

The JSDoc comment contains a typo in the word "buisness".

-   * Submit a buisness metric to our metrics endpoint
+   * Submit a business metric to our metrics endpoint

72-89: Consider refactoring to reduce code duplication

The event construction logic is very similar across all submit methods. Consider extracting the common event construction logic into a shared private method.

Example refactor:

private createBaseEvent(name: string, payload: EventPayload, appType: string, options?: {indexHint?: string}) {
  return {
    type: ['business'],
    eventPayload: {
      key: name,
      client_timestamp: new Date().toISOString(),
      appType,
      ...(options?.indexHint && {indexHint: options.indexHint}),
      value: {
        ...this.getContext(),
        ...this.getBrowserDetails(),
        ...payload,
      },
    },
  };
}

private submitWxccDesktopEvent({name, payload}: {name: string; payload: EventPayload}) {
  const event = this.createBaseEvent(name, payload, 'WxCC Desktop', {indexHint: 'wxccdesktop'});
  return this.submitEvent({
    kind: 'business-events:business_metrics_wxcc_desktop -> ',
    name,
    event,
  });
}
packages/@webex/internal-plugin-metrics/src/metrics.types.ts (1)

172-177: LGTM! Consider adding documentation.

The addition of 'business_metrics_wxcc_desktop' to the Table type is well-structured and aligns with the FedRAMP compliance requirements. The change is non-breaking and follows the existing naming patterns.

Consider adding a JSDoc comment above the Table type to document the purpose of each table, particularly the new business_metrics_wxcc_desktop table. This would improve maintainability and help other developers understand when to use each table type.

+/**
+ * Defines the available metric table destinations
+ * @property business_metrics_wxcc_desktop - Table for FedRAMP compliance metrics from wxcc desktop client
+ * ... document other table types ...
+ */
 export type Table =
   | 'wbxapp_callend_metrics'
   | 'business_metrics'
   | 'business_ucf'
   | 'business_metrics_wxcc_desktop'
   | 'default';
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 8d6d1bc and ea3c708.

📒 Files selected for processing (3)
  • packages/@webex/internal-plugin-metrics/src/business-metrics.ts (2 hunks)
  • packages/@webex/internal-plugin-metrics/src/metrics.types.ts (1 hunks)
  • packages/@webex/internal-plugin-metrics/test/unit/spec/business/business-metrics.ts (1 hunks)
🧰 Additional context used
🪛 Biome
packages/@webex/internal-plugin-metrics/test/unit/spec/business/business-metrics.ts

[error] 208-208: This property value named locale is later overwritten by an object member with the same name.

Overwritten with this value.

If an object property with the same name is defined multiple times (except when combining a getter with a setter), only the last definition makes it into the object and previous definitions are ignored.
Unsafe fix: Remove this property value named locale

(lint/suspicious/noDuplicateObjectKeys)

🔇 Additional comments (5)
packages/@webex/internal-plugin-metrics/src/business-metrics.ts (2)

141-142: LGTM!

The switch case addition is clean and follows the established pattern.


Line range hint 65-142: Verify test coverage for the new functionality

The PR objectives mention that unit tests were added, but they're not visible in the provided files. Please ensure that:

  1. Test cases cover the new submitWxccDesktopEvent method
  2. Test cases verify the correct event structure including the indexHint and appType fields
  3. Test cases validate the new table option in submitBusinessEvent
✅ Verification successful

Let me check the test file content to verify the test coverage.


Test coverage is complete and accurate

The test file includes comprehensive coverage for the new functionality:

  • Test case verifies submitWxccDesktopEvent through the business_metrics_wxcc_desktop table option
  • Validates correct event structure including indexHint: 'wxccdesktop' and appType: 'WxCC Desktop'
  • Asserts the proper payload structure and timestamp handling
  • Confirms the integration with the table routing in submitBusinessEvent
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for related test files and their coverage of the new functionality
fd -e test.ts -e spec.ts . | xargs rg -l "business_metrics_wxcc_desktop"

# Look for existing test patterns that should be followed
rg -A 5 "describe.*BusinessMetrics" 

Length of output: 754


Script:

#!/bin/bash
# Check the content of the test file
cat "packages/@webex/internal-plugin-metrics/test/unit/spec/business/business-metrics.ts"

Length of output: 8712

packages/@webex/internal-plugin-metrics/src/metrics.types.ts (1)

172-177: Verify handling of the new table type.

Let's ensure the new table type is properly handled throughout the codebase.

✅ Verification successful

Let me generate another script to check for switch statements handling the table type more specifically:


The new table type is properly handled throughout the codebase

The verification shows that:

  1. The new table type is properly handled in the switch statement with a dedicated case that maps to submitWxccDesktopEvent
  2. The type is properly defined in metrics.types.ts
  3. The implementation includes proper documentation for the new table type
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify proper handling of the new table type

# Check for switch/case statements that handle table types
echo "Checking for switch statements handling table types..."
rg -A 5 "switch.*\(.*[tT]able.*\)" 

# Check for hardcoded table type strings
echo "Checking for hardcoded table type strings..."
rg -i "business_metrics_wxcc_desktop"

# Check for type imports
echo "Checking for Table type imports..."
rg "import.*\{.*Table.*\}.*from.*metrics\.types"

Length of output: 132172


Script:

#!/bin/bash
# Check for switch statements handling table types in business-metrics.ts
echo "Checking switch statement handling of table types..."
rg -A 10 "switch.*\(.*table.*\)" packages/@webex/internal-plugin-metrics/src/business-metrics.ts

# Check for any other references to the table type
echo "Checking for other table type references..."
rg -A 2 "business_metrics_wxcc_desktop" packages/@webex/internal-plugin-metrics/src/

Length of output: 1793

packages/@webex/internal-plugin-metrics/test/unit/spec/business/business-metrics.ts (2)

185-219: LGTM! Test structure follows established patterns.

The new test case is well-organized and follows the existing test structure, maintaining consistency with other table-specific tests.

🧰 Tools
🪛 Biome

[error] 208-208: This property value named locale is later overwritten by an object member with the same name.

Overwritten with this value.

If an object property with the same name is defined multiple times (except when combining a getter with a setter), only the last definition makes it into the object and previous definitions are ignored.
Unsafe fix: Remove this property value named locale

(lint/suspicious/noDuplicateObjectKeys)


185-219: Verify FedRAMP compliance requirements coverage.

While the test covers the basic functionality, please verify if there are any additional FedRAMP-specific requirements that need to be validated in the test case, such as:

  • Required fields for compliance
  • Data format validations
  • Security-related assertions

Let me help verify the FedRAMP requirements:

🧰 Tools
🪛 Biome

[error] 208-208: This property value named locale is later overwritten by an object member with the same name.

Overwritten with this value.

If an object property with the same name is defined multiple times (except when combining a getter with a setter), only the last definition makes it into the object and previous definitions are ignored.
Unsafe fix: Remove this property value named locale

(lint/suspicious/noDuplicateObjectKeys)

},
};

return this.submitEvent({kind: 'buisness-events:business_metrics -> ', name, event});
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix incorrect metrics kind parameter

The kind parameter in submitEvent should reflect the correct table name:

-    return this.submitEvent({kind: 'buisness-events:business_metrics -> ', name, event});
+    return this.submitEvent({kind: 'business-events:business_metrics_wxcc_desktop -> ', name, event});
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return this.submitEvent({kind: 'buisness-events:business_metrics -> ', name, event});
return this.submitEvent({kind: 'business-events:business_metrics_wxcc_desktop -> ', name, event});

Comment on lines +208 to +213
locale: window.navigator.language,
os: getOSNameInternal(),
app: {version: 'webex-version'},
device: {id: 'deviceId'},
locale: 'language',
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix duplicate 'locale' property in test assertions.

The value object contains duplicate locale properties at lines 208 and 212, where the second one overwrites the first. This could mask potential issues in the actual implementation.

Apply this diff to fix the duplicate property:

                locale: window.navigator.language,
                os: getOSNameInternal(),
                app: {version: 'webex-version'},
                device: {id: 'deviceId'},
-               locale: 'language',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
locale: window.navigator.language,
os: getOSNameInternal(),
app: {version: 'webex-version'},
device: {id: 'deviceId'},
locale: 'language',
}
locale: window.navigator.language,
os: getOSNameInternal(),
app: {version: 'webex-version'},
device: {id: 'deviceId'},
}
🧰 Tools
🪛 Biome

[error] 208-208: This property value named locale is later overwritten by an object member with the same name.

Overwritten with this value.

If an object property with the same name is defined multiple times (except when combining a getter with a setter), only the last definition makes it into the object and previous definitions are ignored.
Unsafe fix: Remove this property value named locale

(lint/suspicious/noDuplicateObjectKeys)

* @param {EventPayload} payload payload of the metric
* @returns {Promise<any>}
*/
private submitWxccDesktopEvent({name, payload}: {name: string; payload: EventPayload}) {

Choose a reason for hiding this comment

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

It seems to me that we shouldnt have product specific APIs. Can we achieve the same in a generic way? eg some "transform" mechanism that we can inject, or by setting config centrally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The API the SDK currently exposes is

submitBusinessEvent({
    name: string;
    payload: EventPayload;
    table?: Table;
})

(we can't make a breaking change or else we have to bump the major version number of the SDK)

We could add a second method like:

submitBusinessEvent({
    name: string;
    payload: EventPayload;
    eventMetadata: EventPayload;
})

where eventMetadata contains the appType and indexHint, or anything else, for future generic use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants