fix: reenable hyperdx

This commit is contained in:
Gergo Moricz 2024-07-11 23:20:51 +02:00
parent 09bca05b20
commit bd84290b9e
2 changed files with 16 additions and 16 deletions

View File

@ -4,23 +4,23 @@ import { AuthResponse, NotificationType, RateLimiterMode } from "../../src/types
import { supabase_service } from "../../src/services/supabase"; import { supabase_service } from "../../src/services/supabase";
import { withAuth } from "../../src/lib/withAuth"; import { withAuth } from "../../src/lib/withAuth";
import { RateLimiterRedis } from "rate-limiter-flexible"; import { RateLimiterRedis } from "rate-limiter-flexible";
// import { setTraceAttributes } from '@hyperdx/node-opentelemetry'; import { setTraceAttributes } from '@hyperdx/node-opentelemetry';
import { sendNotification } from "../services/notification/email_notification"; import { sendNotification } from "../services/notification/email_notification";
export async function authenticateUser(req, res, mode?: RateLimiterMode): Promise<AuthResponse> { export async function authenticateUser(req, res, mode?: RateLimiterMode): Promise<AuthResponse> {
return withAuth(supaAuthenticateUser)(req, res, mode); return withAuth(supaAuthenticateUser)(req, res, mode);
} }
// function setTrace(team_id: string, api_key: string) { function setTrace(team_id: string, api_key: string) {
// try { try {
// setTraceAttributes({ setTraceAttributes({
// team_id, team_id,
// api_key api_key
// }); });
// } catch (error) { } catch (error) {
// console.error('Error setting trace attributes:', error); console.error('Error setting trace attributes:', error);
// } }
// } }
export async function supaAuthenticateUser( export async function supaAuthenticateUser(
req, req,
res, res,
@ -99,7 +99,7 @@ export async function supaAuthenticateUser(
const plan = getPlanByPriceId(data[0].price_id); const plan = getPlanByPriceId(data[0].price_id);
// HyperDX Logging // HyperDX Logging
// setTrace(team_id, normalizedApi); setTrace(team_id, normalizedApi);
subscriptionData = { subscriptionData = {
team_id: team_id, team_id: team_id,
plan: plan plan: plan

View File

@ -5,7 +5,7 @@ import "dotenv/config";
import { getWebScraperQueue } from "./services/queue-service"; import { getWebScraperQueue } from "./services/queue-service";
import { redisClient } from "./services/rate-limiter"; import { redisClient } from "./services/rate-limiter";
import { v0Router } from "./routes/v0"; import { v0Router } from "./routes/v0";
// import { initSDK } from "@hyperdx/node-opentelemetry"; import { initSDK } from "@hyperdx/node-opentelemetry";
import cluster from "cluster"; import cluster from "cluster";
import os from "os"; import os from "os";
import { Job } from "bull"; import { Job } from "bull";
@ -72,9 +72,9 @@ if (cluster.isMaster) {
redisClient.connect(); redisClient.connect();
// HyperDX OpenTelemetry // HyperDX OpenTelemetry
// if (process.env.ENV === "production") { if (process.env.ENV === "production") {
// initSDK({ consoleCapture: true, additionalInstrumentations: [] }); initSDK({ consoleCapture: true, additionalInstrumentations: [] });
// } }
function startServer(port = DEFAULT_PORT) { function startServer(port = DEFAULT_PORT) {
const server = app.listen(Number(port), HOST, () => { const server = app.listen(Number(port), HOST, () => {