fix: reenable hyperdx
This commit is contained in:
parent
09bca05b20
commit
bd84290b9e
|
@ -4,23 +4,23 @@ import { AuthResponse, NotificationType, RateLimiterMode } from "../../src/types
|
|||
import { supabase_service } from "../../src/services/supabase";
|
||||
import { withAuth } from "../../src/lib/withAuth";
|
||||
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";
|
||||
|
||||
export async function authenticateUser(req, res, mode?: RateLimiterMode): Promise<AuthResponse> {
|
||||
return withAuth(supaAuthenticateUser)(req, res, mode);
|
||||
}
|
||||
// function setTrace(team_id: string, api_key: string) {
|
||||
// try {
|
||||
// setTraceAttributes({
|
||||
// team_id,
|
||||
// api_key
|
||||
// });
|
||||
// } catch (error) {
|
||||
// console.error('Error setting trace attributes:', error);
|
||||
// }
|
||||
function setTrace(team_id: string, api_key: string) {
|
||||
try {
|
||||
setTraceAttributes({
|
||||
team_id,
|
||||
api_key
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error setting trace attributes:', error);
|
||||
}
|
||||
|
||||
// }
|
||||
}
|
||||
export async function supaAuthenticateUser(
|
||||
req,
|
||||
res,
|
||||
|
@ -99,7 +99,7 @@ export async function supaAuthenticateUser(
|
|||
|
||||
const plan = getPlanByPriceId(data[0].price_id);
|
||||
// HyperDX Logging
|
||||
// setTrace(team_id, normalizedApi);
|
||||
setTrace(team_id, normalizedApi);
|
||||
subscriptionData = {
|
||||
team_id: team_id,
|
||||
plan: plan
|
||||
|
|
|
@ -5,7 +5,7 @@ import "dotenv/config";
|
|||
import { getWebScraperQueue } from "./services/queue-service";
|
||||
import { redisClient } from "./services/rate-limiter";
|
||||
import { v0Router } from "./routes/v0";
|
||||
// import { initSDK } from "@hyperdx/node-opentelemetry";
|
||||
import { initSDK } from "@hyperdx/node-opentelemetry";
|
||||
import cluster from "cluster";
|
||||
import os from "os";
|
||||
import { Job } from "bull";
|
||||
|
@ -72,9 +72,9 @@ if (cluster.isMaster) {
|
|||
redisClient.connect();
|
||||
|
||||
// HyperDX OpenTelemetry
|
||||
// if (process.env.ENV === "production") {
|
||||
// initSDK({ consoleCapture: true, additionalInstrumentations: [] });
|
||||
// }
|
||||
if (process.env.ENV === "production") {
|
||||
initSDK({ consoleCapture: true, additionalInstrumentations: [] });
|
||||
}
|
||||
|
||||
function startServer(port = DEFAULT_PORT) {
|
||||
const server = app.listen(Number(port), HOST, () => {
|
||||
|
|
Loading…
Reference in New Issue