Note: This API is not intended for use in site development or when coding in Blocks.
The monitoring
submodule allows you to report errors, log messages, track performance metrics and get notified of uncaught exceptions and unhandled rejections in your application code with Sentry. Use the SDK to report errors, log messages, and track performance metrics in your application code.
See Monitoring Your App for setup and configuration requirements.
Note that when Wix recognizes the changes to your wix.config.json
file, Wix will report unhandled errors to your Sentry project automatically.
@wix/essentials
and the Wix CLI installed.
In order to use the monitoring client and report events, you need to initialize it.
captureException()
Captures an exception event and sends it to Sentry.
Name | Type | Description |
---|---|---|
error | Error | The error to capture. |
captureContext | CaptureContext | (Optional) Additional context to attach to the Sentry event. |
captureContext.level | string | (Optional) The severity level of the event. Default: error . Options: info , warning , error . |
captureContext.tags | object | (Optional) Key-value pairs to attach to the Sentry event. Learn more about usage and limitations. |
captureContext.contexts | object | (Optional) Additional context to attach to the Sentry event. Learn more about usage and limitations. |
captureMessage()
Captures a message event as an event in Sentry.
Name | Type | Description |
---|---|---|
message | string | The message to capture. |
captureContext | CaptureContext | (Optional) Additional context to attach to the Sentry event. |
captureContext.level | string | (Optional) The severity level of the event. Default: error . Options: info , warning , error . |
captureContext.tags | object | (Optional) Key-value string pairs to attach to the Sentry event. Learn more about usage and limitations . |
captureContext.contexts | object | (Optional) Additional context to attach to the Sentry event. Learn more about usage and limitations. |
addBreadcrumb()
Records a new breadcrumb which will be attached to future events. Breadcrumbs will be added to subsequent events to provide more context on user's actions prior to an error or crash.
Name | Type | Description |
---|---|---|
breadcrumb | Breadcrumb | The breadcrumb details. Learn more about these properties |
breadcrumb.message | string | The message of the breadcrumb. |
breadcrumb.type | string | (Optional) The type of the breadcrumb. |
breadcrumb.category | string | (Optional) The category of the breadcrumb. |
breadcrumb.level | string | (Optional) The severity level of the breadcrumb. Options: info , warning , error . |
breadcrumb.data | object | (Optional) Additional data to attach to the breadcrumb. |
startSpan()
Starts a new span and executes the provided callback function with the span as an argument.
Name | Type | Description |
---|---|---|
spanOptions | SpanOptions | The options for the span. |
spanOptions.name | string | The name of the span. |
spanOptions.tags | Tags | (Optional) Key-value string pairs to attach to the span. |
callback | (span: Span | undefined) => T | The callback function to execute with the span. |
Each report we send to Sentry is enriched with additional information that will help you find the root of the problem. The context object will vary slightly depending on the report, but will generally include the following:
Name | Description |
---|---|
app.id | Your app ID. |
extension.id | Your unique extension ID. |
extension.name | Your extension name. For backend extensions this could also be the name of an endpoint or webhook. |
extension.type | Extension type. For backend extensions types include: cli-api , cli-event , cli-service-plugin . |
platform | The platform where the error originated. Possible Values: BACKEND , DASHBOARD , SITE_EDITOR , SITE_VIEWER . |
url | The URL of the site where the error originated. Only relevant for site extensions. |