mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2026-02-05 14:56:29 -06:00
chore: Update telemetry and add new integrations
Refactored the telemetry guard to use a new sendTelemetry utility function, which allows for easier tracking of API routes. Also, added telemetry events for message sending in the Chatwoot and Typebot services. Additionally, updated the README.md to include new content creators and added new integrations with Typebot and Chatwoot services. Modified: - README.md - package.json - src/api/guards/telemetry.guard.ts - src/api/integrations/chatwoot/services/chatwoot.service.ts - src/api/integrations/typebot/services/typebot.service.ts Added: - src/utils/sendTelemetry.ts
This commit is contained in:
@@ -1,29 +1,10 @@
|
||||
import axios from 'axios';
|
||||
import { NextFunction, Request, Response } from 'express';
|
||||
import fs from 'fs';
|
||||
|
||||
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
|
||||
|
||||
interface TelemetryData {
|
||||
route: string;
|
||||
apiVersion: string;
|
||||
timestamp: Date;
|
||||
}
|
||||
import { sendTelemetry } from '../../utils/sendTelemetry';
|
||||
|
||||
class Telemetry {
|
||||
public collectTelemetry(req: Request, res: Response, next: NextFunction): void {
|
||||
const telemetry: TelemetryData = {
|
||||
route: req.path,
|
||||
apiVersion: `${packageJson.version}`,
|
||||
timestamp: new Date(),
|
||||
};
|
||||
|
||||
axios
|
||||
.post('https://log.evolution-api.com/telemetry', telemetry)
|
||||
.then(() => {})
|
||||
.catch((error) => {
|
||||
console.error('Telemetry error', error);
|
||||
});
|
||||
sendTelemetry(req.path);
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user