refactor: update proto file paths to use relative directory resolution

This commit is contained in:
Nawaz Dhandala
2026-04-02 15:23:13 +01:00
parent 4e2ca87752
commit cdbbcdfe27
2 changed files with 9 additions and 5 deletions

View File

@@ -9,24 +9,27 @@ import {
import CaptureSpan from "Common/Server/Utils/Telemetry/CaptureSpan";
import protobuf from "protobufjs";
import logger from "Common/Server/Utils/Logger";
import path from "path";
// Load proto file for OTel
const PROTO_DIR: string = path.resolve(__dirname, "..", "ProtoFiles", "OTel", "v1");
// Create a root namespace
const LogsProto: protobuf.Root = protobuf.loadSync(
"/usr/src/app/ProtoFiles/OTel/v1/logs.proto",
path.join(PROTO_DIR, "logs.proto"),
);
const TracesProto: protobuf.Root = protobuf.loadSync(
"/usr/src/app/ProtoFiles/OTel/v1/traces.proto",
path.join(PROTO_DIR, "traces.proto"),
);
const MetricsProto: protobuf.Root = protobuf.loadSync(
"/usr/src/app/ProtoFiles/OTel/v1/metrics.proto",
path.join(PROTO_DIR, "metrics.proto"),
);
const ProfilesProto: protobuf.Root = protobuf.loadSync(
"/usr/src/app/ProtoFiles/OTel/v1/profiles.proto",
path.join(PROTO_DIR, "profiles.proto"),
);
// Lookup the message type

View File

@@ -10,12 +10,13 @@ import BadRequestException from "Common/Types/Exception/BadRequestException";
import { JSONObject } from "Common/Types/JSON";
import ObjectID from "Common/Types/ObjectID";
import protobuf from "protobufjs";
import path from "path";
import zlib from "zlib";
import ProfilesQueueService from "./Queue/ProfilesQueueService";
// Load pprof proto schema
const PprofProto: protobuf.Root = protobuf.loadSync(
"/usr/src/app/ProtoFiles/pprof/profile.proto",
path.resolve(__dirname, "..", "ProtoFiles", "pprof", "profile.proto"),
);
const PprofProfile: protobuf.Type = PprofProto.lookupType(
"perftools.profiles.Profile",