This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
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.
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) Event severity level. 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 | Message to capture. |
captureContext | CaptureContext | (Optional) Additional context to attach to the Sentry event. |
captureContext.level | string | (Optional) Event sverity level. 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 | Breadcrumb details. Learn more about these properties |
breadcrumb.message | string | Breadcrumb message. |
breadcrumb.type | string | (Optional) Breadcrumb type. |
breadcrumb.category | string | (Optional) Breadcrumb category. |
breadcrumb.level | string | (Optional) Breadcrumb severity level. 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 | Span options. |
spanOptions.name | string | Span name. |
spanOptions.tags | Tags | (Optional) Key-value string pairs to attach to the span. |
callback | (span: Span | undefined) => T | Callback function to execute with the span. |
startSpanManual()
Starts a new span that requires manual completion. Complete this span manually by calling end()
or fail()
using the returned span object or by calling endSpanManual().
Name | Type | Description |
---|---|---|
spanOptions | SpanOptions | Span options. |
spanOptions.name | string | Span name. |
spanOptions.tags | Tags | (Optional) Key-value string pairs to attach to the span. |
endSpanManual()
Ends the most recent span that was started using startSpanManual(). Any older manual spans with the same name will be ignored.
Name | Type | Description |
---|---|---|
spanOptions | SpanOptions | Span options. |
spanOptions.name | string | Span name. |
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 | Platform where the error originated. Possible Values: BACKEND , DASHBOARD , SITE_EDITOR , SITE_VIEWER . |
url | URL of the site where the error originated. Only relevant for site extensions. |