Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

epip-typeorm-analyses

Package Overview
Dependencies
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

epip-typeorm-analyses

**EpipTypeormAnalyses** is a NestJS module that allows you to monitor and analyze the performance of your TypeORM queries by logging the average time and the number of executions for each query. The data is stored in Redis, and you can use tools like Graf

  • 0.0.36
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

EpipTypeormAnalyses

EpipTypeormAnalyses is a NestJS module that allows you to monitor and analyze the performance of your TypeORM queries by logging the average time and the number of executions for each query. The data is stored in Redis, and you can use tools like Grafana to visualize and report on the logged data.

Installation

To install the package, use the following npm command:

npm i epip-typeorm-analyses

Usage

To integrate the EpipTypeormAnalyses module into your NestJS application, you need to register it within your AppModule. The module requires two arguments to connect to your Redis instance: url and password. Here’s an example:

import { Module } from '@nestjs/common';
import { EpipTypeormAnalyses } from 'epip-typeorm-analyses';

@Module({
  imports: [
    // Other imports...
    EpipTypeormAnalyses.register({
      url: process.env.REDIS_URL,
      password: process.env.REDIS_PASS,
    }),
    // Other imports...
  ],
  // Other module metadata...
})
export class AppModule {}

In the above code:

  • url: The URL of your Redis instance. This is typically stored in the REDIS_URL environment variable.
  • password: The password for your Redis instance. This is typically stored in the REDIS_PASS environment variable.

Functionality

Once integrated, the EpipTypeormAnalyses module will log the average execution time and the number of executions for each TypeORM query to the specified Redis database.

Query Storage

Each query is hashed to create a unique identifier. This ensures that even if the same query is executed multiple times, it is consistently tracked using the same unique key in Redis. This unique hash is then used to store and update the performance metrics in Redis, ensuring that duplicate queries are correctly aggregated under the same entry.

Visualization and Reporting

You have two options to visualize and report the logged data:

  • Grafana Integration: You can use Grafana to create custom dashboards and reports based on the data logged by EpipTypeormAnalyses. Grafana’s powerful visualization tools allow you to monitor and analyze your application’s database performance effectively.

  • Pre-Built Reporting Tool: Alternatively, you can use a pre-built reporting tool developed by Mr. Mousavi, which is publicly available on GitLab. This tool provides various log visualization and reporting features out-of-the-box.

  1. Repository for the reporting tool: Analyse Backend(https://gitlab.com/bakhshabadi.javad/analyse-backend/)
  2. Repository by Mr. Mousavi: Mousavi’s GitLab Repo(https://gitlab.com/moein1378)

Alt Text

Conclusion

The EpipTypeormAnalyses module is a powerful tool for monitoring the performance of TypeORM queries in your NestJS application. By logging query metrics to Redis, it provides the foundation for detailed performance analysis and reporting using tools like Grafana or the pre-built reporting tool by Mr. Mousavi.

For more detailed instructions on how to use the reporting tool or to contribute to its development, please visit the linked repositories.

FAQs

Package last updated on 26 Aug 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc