TelemetryPlugin
The TelemetryPlugin is used to instrument the Vendure application and collect telemetry data using OpenTelemetry.
Installation
npm install @vendure/telemetry-plugin
For a complete guide to setting up and working with Open Telemetry, see the Implementing Open Telemetry guide.
Configuration
The plugin is configured via the TelemetryPlugin.init() method. This method accepts an options object
which defines the OtelLogger options and method hooks.
Example
Preloading the SDK
In order to use the OpenTelemetry SDK, you must preload it before the Vendure server is started.
This is done by using the --require flag when starting the server with a custom preload script.
Create a file named instrumentation.ts in the root of your project and add the following code:
The server would then be started with the following command:
or for development with ts-node:
options
TelemetryPluginOptionsconstructor
(methodHooksService: MethodHooksService, options: TelemetryPluginOptions) => TelemetryPlugininit
(options: TelemetryPluginOptions) =>