Socket
Book a DemoInstallSign in
Socket

opentelemetry-instrumentation-typeorm

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opentelemetry-instrumentation-typeorm

open telemetry instrumentation for the `typeorm` module

latest
Source
npmnpm
Version
0.41.0
Version published
Weekly downloads
71K
11.48%
Maintainers
1
Weekly downloads
 
Created
Source

OpenTelemetry TypeORM Instrumentation for Node.js

NPM version

This module provides automatic instrumentation for TypeORM.

Installation

npm install --save opentelemetry-instrumentation-typeorm

Supported Versions

This instrumentation supports >0.2.28:

Usage

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

const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { TypeormInstrumentation } = require('opentelemetry-instrumentation-typeorm');

const tracerProvider = new NodeTracerProvider({
  // be sure to disable old plugin
  plugins: {
    typeorm: { enabled: false, path: 'opentelemetry-plugin-typeorm' }
  }
});

registerInstrumentations({
  tracerProvider,
  instrumentations: [
    new TypeormInstrumentation({
      // see under for available configuration
    })
  ]
});

TypeORM Instrumentation Options

TypeORM instrumentation has few options available to choose from. You can set the following:

OptionsTypeDescription
responseHookTypeormResponseCustomAttributesFunctionHook called before response is returned, which allows to add custom attributes to span.
moduleVersionAttributeNamestringIf passed, a span attribute will be added to all spans with key of the provided moduleVersionAttributeName and value of the patched module version
suppressInternalInstrumentationbooleanTypeorm operation use mongodb/postgres/mysql/mariadb/etc. under the hood. If, for example, postgres instrumentation is enabled, a postgres operation will also create a postgres span describing the communication. Setting the suppressInternalInstrumentation config value to true will cause the instrumentation to suppress instrumentation of underlying operations.
enableInternalInstrumentationbooleanSome methods such as getManyAndCount can generate internally multiple spans. To instrument those set this to true
collectParametersbooleanset to true if you want to capture the parameter values for parameterized SQL queries (may leak sensitive information)

This extension (and many others) was developed by Aspecto with ❤️

Keywords

typeorm

FAQs

Package last updated on 21 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts