Socket
Book a DemoInstallSign in
Socket

@opentelemetry/instrumentation-ioredis

Package Overview
Dependencies
Maintainers
3
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/instrumentation-ioredis

OpenTelemetry instrumentation for `ioredis` database redis client for Redis

0.51.0
latest
Source
npmnpm
Version published
Weekly downloads
6.2M
8.95%
Maintainers
3
Weekly downloads
 
Created

What is @opentelemetry/instrumentation-ioredis?

@opentelemetry/instrumentation-ioredis is an npm package that provides automatic tracing and monitoring for applications using the ioredis library. It integrates with OpenTelemetry to collect and report metrics and traces for Redis operations, helping developers gain insights into the performance and behavior of their Redis interactions.

What are @opentelemetry/instrumentation-ioredis's main functionalities?

Automatic Tracing

This feature allows you to automatically trace Redis operations using the ioredis library. The code sample demonstrates how to set up the OpenTelemetry NodeTracerProvider and register the IORedisInstrumentation to start collecting traces for Redis commands.

const { NodeTracerProvider } = require('@opentelemetry/node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { IORedisInstrumentation } = require('@opentelemetry/instrumentation-ioredis');

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

registerInstrumentations({
  instrumentations: [
    new IORedisInstrumentation(),
  ],
});

const Redis = require('ioredis');
const redis = new Redis();

redis.set('key', 'value');
redis.get('key', (err, result) => {
  console.log(result);
});

Custom Attributes

This feature allows you to add custom attributes to the spans created for Redis operations. The code sample shows how to use the responseHook option to add the Redis response as an attribute to the span.

const { IORedisInstrumentation } = require('@opentelemetry/instrumentation-ioredis');

const instrumentation = new IORedisInstrumentation({
  responseHook: (span, cmdName, args, response) => {
    span.setAttribute('redis.response', response);
  },
});

const { NodeTracerProvider } = require('@opentelemetry/node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');

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

registerInstrumentations({
  instrumentations: [instrumentation],
});

const Redis = require('ioredis');
const redis = new Redis();

redis.set('key', 'value');
redis.get('key', (err, result) => {
  console.log(result);
});

Other packages similar to @opentelemetry/instrumentation-ioredis

Keywords

instrumentation

FAQs

Package last updated on 09 Jul 2025

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.