Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions packages/@webex/internal-plugin-metrics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This is an internal Cisco Webex plugin. As such, it does not strictly adhere to

- [Install](#install)
- [Usage](#usage)
- [Unhandled exception telemetry](#unhandled-exception-telemetry)
- [Contribute](#contribute)
- [Maintainers](#maintainers)
- [License](#license)
Expand All @@ -29,6 +30,41 @@ const webex = new WebexCore();
webex.internal.metrics.WHATEVER;
```

## Unhandled exception telemetry

Unhandled exception telemetry is currently supported only in browser environments. It starts after
the Webex SDK emits `ready`. It does not install a standalone collector, capture errors before SDK
initialization, persist events, or retry failed telemetry submissions.

The reporter captures uncaught errors, unhandled promise rejections, and resource load failures.
Matching failures captured in the same one-second in-memory window are submitted once with an
`occurrenceCount`. Non-HTTP(S) URLs are redacted; URL credentials, query parameters, and fragments
are stripped; and error names, messages, and stacks are truncated before submission.

Telemetry is disabled by default. Enable it with
`metrics.unhandledExceptionTelemetry.enabled: true`. Applications may provide a synchronous
`getMetadata` callback in the same configuration object. It must return an object whose fields can
include application context such as `orgId` and `dataCenter`. Metadata must not contain personally
identifiable information or credentials.

```js
import Webex from 'webex';

const webex = Webex.init({
config: {
metrics: {
unhandledExceptionTelemetry: {
enabled: true,
getMetadata: () => ({
orgId: 'your-organization-id',
dataCenter: 'your-data-center',
}),
},
},
},
});
```

## Maintainers

This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
Expand Down
3 changes: 3 additions & 0 deletions packages/@webex/internal-plugin-metrics/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export default {
},
metrics: {
appType: inBrowser ? 'browser' : 'nodejs',
unhandledExceptionTelemetry: {
enabled: false,
},
batcherWait: 500,
batcherMaxCalls: 50,
batcherMaxWait: 1500,
Expand Down
3 changes: 3 additions & 0 deletions packages/@webex/internal-plugin-metrics/src/new-metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import CallDiagnosticLatencies from './call-diagnostic/call-diagnostic-metrics-l
import {setMetricTimings} from './call-diagnostic/call-diagnostic-metrics.util';
import {generateCommonErrorMetadata} from './utils';
import {isAutomatedUser as detectAutomatedUser} from './automated-user';
import {startUnhandledExceptionTelemetry} from './unhandled-exception-telemetry';

/**
* Metrics plugin to centralize all types of metrics.
Expand Down Expand Up @@ -103,6 +104,8 @@ class Metrics extends WebexPlugin {
shouldDelay: this.delaySubmitClientEvents,
overrides: this.delayedClientEventsOverrides,
});
// @ts-ignore
startUnhandledExceptionTelemetry(this.webex);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: need a test that checks that startUnhandledExceptionTelemetry is called when ready

});
}

Expand Down
Loading