> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt ## Resource: monitoring ## Article: monitoring ## Article Link: https://dev.wix.com/docs/sdk/core-modules/essentials/monitoring.md ## Article Content: # monitoring
Developer Preview 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](https://dev.wix.com/docs/sdk/articles/get-started/about-site-development.md) or when [coding in Blocks](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-blocks/code-in-blocks/about-coding-in-blocks.md). 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](https://sentry.io/). See [Monitoring Your App](https://dev.wix.com/docs/build-apps/manage-your-app/observability/monitor-your-app-with-sentry.md) 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.
Important:
Before making calls to the methods defined below using this solution, make sure you have the latest version of @wix/essentials.md and the Wix CLI installed.
## Import statement
```js
import { monitoring } from "@wix/essentials";
```
## Initializing a monitoring client
In order to use the monitoring client and report events, you need to initialize it.
```js
const monitoringClient = monitoring.getMonitoringClient();
```
## Methods
### `captureException()`
Captures an exception event and sends it to Sentry.
#### Syntax
```js
function captureException(error: Error, captureContext?: CaptureContext): void;
```
#### Parameters
| 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](https://docs.sentry.io/platforms/javascript/enriching-events/context). |
| `captureContext.contexts` | object | (Optional) Additional context to attach to the Sentry event. Learn more about [usage and limitations](https://docs.sentry.io/platforms/javascript/enriching-events/context). |
#### Example
```js
import { monitoring } from "@wix/essentials";
const monitoringClient = monitoring.getMonitoringClient();
try {
// ... code that might throw an error
} catch (error) {
monitoringClient.captureException(error, {
level: 'info',
tags: {
feature: "checkout"
},
contexts: {
checkout: {
id: "1234"
}
}
});
}
```
---
### `captureMessage()`
Captures a message event as an event in Sentry.
#### Syntax
```js
function captureMessage(message: string, captureContext?: CaptureContext): void;
```
#### Parameters
| 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](https://docs.sentry.io/platforms/javascript/enriching-events/tags) . |
| `captureContext.contexts` | object | (Optional) Additional context to attach to the Sentry event. Learn more about [usage and limitations](https://docs.sentry.io/platforms/javascript/enriching-events/tags). |
#### Example
```js
import { monitoring } from "@wix/essentials";
const monitoringClient = monitoring.getMonitoringClient();
monitoringClient.captureMessage("User reached checkout", {
level: 'info',
tags: {
feature: "checkout"
},
contexts: {
checkout: {
id: "1234"
}
}
});
```
---
### `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.
#### Syntax
```js
function addBreadcrumb(breadcrumb: Breadcrumb): void;
```
#### Parameters
| Name | Type | Description |
| ---- |--------------| ----------- |
| `breadcrumb` | Breadcrumb | Breadcrumb details. Learn more about these [properties](https://docs.sentry.io/product/issues/issue-details/breadcrumbs/#breadcrumb-attributes)|
| `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. |
#### Example
```js
import { monitoring } from "@wix/essentials";
const monitoringClient = monitoring.getMonitoringClient();
monitoringClient.addBreadcrumb({ message: "User clicked checkout", level: 'info' });
```
---
### `startSpan()`
Starts a new span and executes the provided callback function with the span as an argument.
#### Syntax
```js
function startSpan