Skip to content

Latest commit

 

History

History
 
 

instrumentation-prisma-client

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

OpenTelemetry Prisma Client Instrumentation for Node.js

NPM version Apache 2.0 License

This module provides automatic instrumentation for @prisma/client.

NOTE

This is an unofficial plugin for the Prisma client. The Prisma team is working on official support for OpenTelemetry and progress can be tracked at https://github.com/prisma/client-planning/issues/21. Once the official support reaches the same level of capabilities of opentelemetry-instrumentation-prisma-client, the opentelemetry-instrumentation-prisma-client will be marked as deprecated.

Installation

npm install --save opentelemetry-instrumentation-prisma-client

Supported Versions

  • >=3.8.0

Usage

For further automatic instrumentation instruction see the @opentelemetry/instrumentation package.

const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { PrismaClientInstrumentation } = require('opentelemetry-instrumentation-prisma-client');

const tracerProvider = new NodeTracerProvider();
tracerProvider.register();

registerInstrumentations({
  instrumentations: [
    new PrismaClientInstrumentation()
  ]
});

Configuration

Name Type Default Value Description
spanAttributes Attributes undefined An optional set of Opentelemetry Attributes to be added to the span. For example spanAttributes: {[SemanticAttributes.DB_SYSTEM]: 'postgresql'}

License

Apache 2.0 - See LICENSE for more information.