Browse Source

docs(sentry-plugin): Add docs on env vars available

Michael Bromley 3 months ago
parent
commit
a97daef156

+ 23 - 4
docs/docs/reference/core-plugins/sentry-plugin/index.md

@@ -11,13 +11,19 @@ import MemberDescription from '@site/src/components/MemberDescription';
 
 
 ## SentryPlugin
 ## SentryPlugin
 
 
-<GenerationInfo sourceFile="packages/sentry-plugin/src/sentry-plugin.ts" sourceLine="127" packageName="@vendure/sentry-plugin" />
+<GenerationInfo sourceFile="packages/sentry-plugin/src/sentry-plugin.ts" sourceLine="146" packageName="@vendure/sentry-plugin" />
 
 
 This plugin integrates the [Sentry](https://sentry.io) error tracking & performance monitoring
 This plugin integrates the [Sentry](https://sentry.io) error tracking & performance monitoring
 service with your Vendure server. In addition to capturing errors, it also provides built-in
 service with your Vendure server. In addition to capturing errors, it also provides built-in
 support for [tracing](https://docs.sentry.io/product/sentry-basics/concepts/tracing/) as well as
 support for [tracing](https://docs.sentry.io/product/sentry-basics/concepts/tracing/) as well as
 enriching your Sentry events with additional context about the request.
 enriching your Sentry events with additional context about the request.
 
 
+:::info
+This documentation applies from v3.5.0 of the plugin, which works differently to previous
+versions. Documentation for prior versions can
+be found [here](https://github.com/vendure-ecommerce/vendure/blob/1bb9cf8ca1584bce026ccc82f33f866b766ef47d/packages/sentry-plugin/src/sentry-plugin.ts).
+:::
+
 ## Pre-requisites
 ## Pre-requisites
 
 
 This plugin depends on access to Sentry, which can be self-hosted or used as a cloud service.
 This plugin depends on access to Sentry, which can be self-hosted or used as a cloud service.
@@ -34,12 +40,25 @@ which you will need to provide to the plugin.
 npm install --save @vendure/sentry-plugin
 npm install --save @vendure/sentry-plugin
 ```
 ```
 
 
+## Environment Variables
+
+The following environment variables are used to control how the Sentry
+integration behaves:
+
+- `SENTRY_DSN`: (required) Sentry Data Source Name
+- `SENTRY_TRACES_SAMPLE_RATE`: Number between 0 and 1
+- `SENTRY_PROFILES_SAMPLE_RATE`: Number between 0 and 1
+- `SENTRY_ENABLE_LOGS`: Boolean. Captures calls to the console API as logs in Sentry. Default `false`
+- `SENTRY_CAPTURE_LOG_LEVELS`: 'debug' | 'info' | 'warn' | 'error' | 'log' | 'assert' | 'trace'
+
 ## Configuration
 ## Configuration
 
 
 Setting up the Sentry plugin requires two steps:
 Setting up the Sentry plugin requires two steps:
 
 
 ### Step 1: Preload the Sentry instrument file
 ### Step 1: Preload the Sentry instrument file
 
 
+Make sure the `SENTRY_DSN` environment variable is defined.
+
 The Sentry SDK must be initialized before your application starts. This is done by preloading
 The Sentry SDK must be initialized before your application starts. This is done by preloading
 the instrument file when starting your Vendure server:
 the instrument file when starting your Vendure server:
 
 
@@ -77,7 +96,7 @@ export const config: VendureConfig = {
 
 
 This plugin includes built-in support for [tracing](https://docs.sentry.io/product/sentry-basics/concepts/tracing/), which allows you to see the performance of your.
 This plugin includes built-in support for [tracing](https://docs.sentry.io/product/sentry-basics/concepts/tracing/), which allows you to see the performance of your.
 To enable tracing, preload the instrument file as described in [Step 1](#step-1-preload-the-sentry-instrument-file).
 To enable tracing, preload the instrument file as described in [Step 1](#step-1-preload-the-sentry-instrument-file).
-This make sure that the Sentry SDK is initialized before any other code is executed.
+This ensures that the Sentry SDK is initialized before any other code is executed.
 
 
 You can also set the `tracesSampleRate` and `profilesSampleRate` options to control the sample rate for
 You can also set the `tracesSampleRate` and `profilesSampleRate` options to control the sample rate for
 tracing and profiling, with the following environment variables:
 tracing and profiling, with the following environment variables:
@@ -122,7 +141,7 @@ You should then be able to see the error in your Sentry dashboard (it may take a
 ```ts title="Signature"
 ```ts title="Signature"
 class SentryPlugin {
 class SentryPlugin {
     static options: SentryPluginOptions = {} as any;
     static options: SentryPluginOptions = {} as any;
-    init(options: SentryPluginOptions) => ;
+    init(options?: SentryPluginOptions) => ;
 }
 }
 ```
 ```
 
 
@@ -135,7 +154,7 @@ class SentryPlugin {
 
 
 ### init
 ### init
 
 
-<MemberInfo kind="method" type={`(options: <a href='/reference/core-plugins/sentry-plugin/sentry-plugin-options#sentrypluginoptions'>SentryPluginOptions</a>) => `}   />
+<MemberInfo kind="method" type={`(options?: <a href='/reference/core-plugins/sentry-plugin/sentry-plugin-options#sentrypluginoptions'>SentryPluginOptions</a>) => `}   />
 
 
 
 
 
 

+ 3 - 0
docs/docs/reference/core-plugins/sentry-plugin/sentry-plugin-options.md

@@ -28,6 +28,9 @@ interface SentryPluginOptions {
 <MemberInfo kind="property" type={`boolean`} default={`false`}   />
 <MemberInfo kind="property" type={`boolean`} default={`false`}   />
 
 
 Whether to include the error test mutation in the admin API.
 Whether to include the error test mutation in the admin API.
+When enabled, a `createTestError` mutation becomes available in
+the Admin API, which can be used to create different types of error
+to check that the integration is working correctly.
 
 
 
 
 </div>
 </div>

+ 6 - 6
docs/docs/reference/dashboard/components/asset-gallery.md

@@ -19,12 +19,12 @@ A component for displaying a gallery of assets.
 
 
 ```tsx
 ```tsx
  <AssetGallery
  <AssetGallery
-onSelect={handleAssetSelect}
-multiSelect="manual"
-initialSelectedAssets={initialSelectedAssets}
-fixedHeight={false}
-displayBulkActions={false}
-/>
+  onSelect={handleAssetSelect}
+  multiSelect="manual"
+  initialSelectedAssets={initialSelectedAssets}
+  fixedHeight={false}
+  displayBulkActions={false}
+  />
 ```
 ```
 
 
 ```ts title="Signature"
 ```ts title="Signature"

+ 3 - 3
docs/docs/reference/dashboard/form-components/password-input.md

@@ -9,14 +9,14 @@ import GenerationInfo from '@site/src/components/GenerationInfo';
 import MemberDescription from '@site/src/components/MemberDescription';
 import MemberDescription from '@site/src/components/MemberDescription';
 
 
 
 
-## PasswordInput
+## PasswordFormInput
 
 
-<GenerationInfo sourceFile="packages/dashboard/src/lib/components/data-input/password-input.tsx" sourceLine="12" packageName="@vendure/dashboard" />
+<GenerationInfo sourceFile="packages/dashboard/src/lib/components/data-input/password-form-input.tsx" sourceLine="12" packageName="@vendure/dashboard" />
 
 
 A component for displaying a password input.
 A component for displaying a password input.
 
 
 ```ts title="Signature"
 ```ts title="Signature"
-function PasswordInput(props: Readonly<DashboardFormComponentProps>): void
+function PasswordFormInput(props: Readonly<DashboardFormComponentProps>): void
 ```
 ```
 Parameters
 Parameters
 
 

+ 3 - 3
docs/docs/reference/dashboard/hooks/use-alerts.md

@@ -17,18 +17,18 @@ Returns information about all registered Alerts, including how many are
 active and at what severity.
 active and at what severity.
 
 
 ```ts title="Signature"
 ```ts title="Signature"
-function useAlerts(): { alerts: Alert[]; activeCount: number; highestSeverity: AlertSeverity }
+function useAlerts(): { alerts: AlertEntry[]; activeCount: number; highestSeverity: AlertSeverity }
 ```
 ```
 
 
 
 
-## Alert
+## AlertEntry
 
 
 <GenerationInfo sourceFile="packages/dashboard/src/lib/hooks/use-alerts.ts" sourceLine="13" packageName="@vendure/dashboard" since="3.5.0" />
 <GenerationInfo sourceFile="packages/dashboard/src/lib/hooks/use-alerts.ts" sourceLine="13" packageName="@vendure/dashboard" since="3.5.0" />
 
 
 An individual Alert item.
 An individual Alert item.
 
 
 ```ts title="Signature"
 ```ts title="Signature"
-interface Alert {
+interface AlertEntry {
     definition: DashboardAlertDefinition;
     definition: DashboardAlertDefinition;
     active: boolean;
     active: boolean;
     currentSeverity?: AlertSeverity;
     currentSeverity?: AlertSeverity;

+ 22 - 3
packages/sentry-plugin/src/sentry-plugin.ts

@@ -21,6 +21,12 @@ const SentryOptionsProvider = {
  * support for [tracing](https://docs.sentry.io/product/sentry-basics/concepts/tracing/) as well as
  * support for [tracing](https://docs.sentry.io/product/sentry-basics/concepts/tracing/) as well as
  * enriching your Sentry events with additional context about the request.
  * enriching your Sentry events with additional context about the request.
  *
  *
+ * :::info
+ * This documentation applies from v3.5.0 of the plugin, which works differently to previous
+ * versions. Documentation for prior versions can
+ * be found [here](https://github.com/vendure-ecommerce/vendure/blob/1bb9cf8ca1584bce026ccc82f33f866b766ef47d/packages/sentry-plugin/src/sentry-plugin.ts).
+ * :::
+ *
  * ## Pre-requisites
  * ## Pre-requisites
  *
  *
  * This plugin depends on access to Sentry, which can be self-hosted or used as a cloud service.
  * This plugin depends on access to Sentry, which can be self-hosted or used as a cloud service.
@@ -37,12 +43,25 @@ const SentryOptionsProvider = {
  * npm install --save \@vendure/sentry-plugin
  * npm install --save \@vendure/sentry-plugin
  * ```
  * ```
  *
  *
+ * ## Environment Variables
+ *
+ * The following environment variables are used to control how the Sentry
+ * integration behaves:
+ *
+ * - `SENTRY_DSN`: (required) Sentry Data Source Name
+ * - `SENTRY_TRACES_SAMPLE_RATE`: Number between 0 and 1
+ * - `SENTRY_PROFILES_SAMPLE_RATE`: Number between 0 and 1
+ * - `SENTRY_ENABLE_LOGS`: Boolean. Captures calls to the console API as logs in Sentry. Default `false`
+ * - `SENTRY_CAPTURE_LOG_LEVELS`: 'debug' | 'info' | 'warn' | 'error' | 'log' | 'assert' | 'trace'
+ *
  * ## Configuration
  * ## Configuration
  *
  *
  * Setting up the Sentry plugin requires two steps:
  * Setting up the Sentry plugin requires two steps:
  *
  *
  * ### Step 1: Preload the Sentry instrument file
  * ### Step 1: Preload the Sentry instrument file
  *
  *
+ * Make sure the `SENTRY_DSN` environment variable is defined.
+ *
  * The Sentry SDK must be initialized before your application starts. This is done by preloading
  * The Sentry SDK must be initialized before your application starts. This is done by preloading
  * the instrument file when starting your Vendure server:
  * the instrument file when starting your Vendure server:
  *
  *
@@ -80,7 +99,7 @@ const SentryOptionsProvider = {
  *
  *
  * This plugin includes built-in support for [tracing](https://docs.sentry.io/product/sentry-basics/concepts/tracing/), which allows you to see the performance of your.
  * This plugin includes built-in support for [tracing](https://docs.sentry.io/product/sentry-basics/concepts/tracing/), which allows you to see the performance of your.
  * To enable tracing, preload the instrument file as described in [Step 1](#step-1-preload-the-sentry-instrument-file).
  * To enable tracing, preload the instrument file as described in [Step 1](#step-1-preload-the-sentry-instrument-file).
- * This make sure that the Sentry SDK is initialized before any other code is executed.
+ * This ensures that the Sentry SDK is initialized before any other code is executed.
  *
  *
  * You can also set the `tracesSampleRate` and `profilesSampleRate` options to control the sample rate for
  * You can also set the `tracesSampleRate` and `profilesSampleRate` options to control the sample rate for
  * tracing and profiling, with the following environment variables:
  * tracing and profiling, with the following environment variables:
@@ -142,8 +161,8 @@ const SentryOptionsProvider = {
 export class SentryPlugin {
 export class SentryPlugin {
     static options: SentryPluginOptions = {} as any;
     static options: SentryPluginOptions = {} as any;
 
 
-    static init(options: SentryPluginOptions) {
-        this.options = options;
+    static init(options?: SentryPluginOptions) {
+        this.options = options ?? {};
         return this;
         return this;
     }
     }
 }
 }

+ 4 - 0
packages/sentry-plugin/src/types.ts

@@ -8,6 +8,10 @@ export interface SentryPluginOptions {
     /**
     /**
      * @description
      * @description
      * Whether to include the error test mutation in the admin API.
      * Whether to include the error test mutation in the admin API.
+     * When enabled, a `createTestError` mutation becomes available in
+     * the Admin API, which can be used to create different types of error
+     * to check that the integration is working correctly.
+     *
      * @default false
      * @default false
      */
      */
     includeErrorTestMutation?: boolean;
     includeErrorTestMutation?: boolean;