Skip to main content

TelemetryPluginOptions

Configuration options for the TelemetryPlugin.

Signature
interface TelemetryPluginOptions {    loggerOptions?: OtelLoggerOptions;    methodHooks?: Array<MethodHookConfig<any>>;}

loggerOptions

The options for the OtelLogger.

For example, to also include logging to the console, you can use the following:

Ts
import { LogLevel } from '@vendure/core';import { TelemetryPlugin } from '@vendure/telemetry-plugin';TelemetryPlugin.init({    loggerOptions: {        console: LogLevel.Verbose,    },});

methodHooks

propertyArray<MethodHookConfig<any>>Experimental

Status: Developer Preview

This API may change in a future release.

Method hooks allow you to add extra telemetry actions to specific methods. To define hooks on a method, use the registerMethodHooks function.

Example

Ts
import { TelemetryPlugin, registerMethodHooks } from '@vendure/telemetry-plugin';TelemetryPlugin.init({  methodHooks: [    registerMethodHooks(ProductService, {      // Define some hooks for the `findOne` method      findOne: {        // This will be called before the method is executed        pre: ({ args: [ctx, productId], span }) => {          span.setAttribute('productId', productId);        },        // This will be called after the method is executed        post: ({ result, span }) => {          span.setAttribute('found', !!result);        },      },    }),  ],});
Was this chapter helpful?
Report Issue
Edited Feb 2, 2026·Edit this page