Files
Nawaz Dhandala 147ff47aa2 feat: Add ProfilesService and ingestion service for OpenTelemetry profiles
- Introduced `profiles_service.proto` to define the ProfilesService for exporting resource profiles.
- Implemented `OtelProfilesIngestService` to handle ingestion of profiles, including processing and flushing to the database.
- Created `ProfilesQueueService` to manage profile ingestion jobs.
- Added comprehensive tests for `OtelProfilesIngestService`, covering stack frame resolution, timestamp parsing, and row building for profiles and samples.
2026-03-27 10:15:55 +00:00

48 lines
1.2 KiB
TypeScript

import AnalyticsBaseModel from "./AnalyticsBaseModel/AnalyticsBaseModel";
import Log from "./Log";
import Metric from "./Metric";
import Span from "./Span";
import ExceptionInstance from "./ExceptionInstance";
import MonitorLog from "./MonitorLog";
import Profile from "./Profile";
import ProfileSample from "./ProfileSample";
const AnalyticsModels: Array<{ new (): AnalyticsBaseModel }> = [
Log,
Span,
Metric,
ExceptionInstance,
MonitorLog,
Profile,
ProfileSample,
];
const modelTypeMap: { [key: string]: { new (): AnalyticsBaseModel } } = {};
type GetModelTypeByName = (
tableName: string,
) => (new () => AnalyticsBaseModel) | null;
export const getModelTypeByName: GetModelTypeByName = (
tableName: string,
): (new () => AnalyticsBaseModel) | null => {
if (modelTypeMap[tableName]) {
return modelTypeMap[tableName] || null;
}
const modelType: { new (): AnalyticsBaseModel } | undefined =
AnalyticsModels.find((modelType: { new (): AnalyticsBaseModel }) => {
return new modelType().tableName === tableName;
});
if (!modelType) {
return null;
}
modelTypeMap[tableName] = modelType;
return modelType;
};
export default AnalyticsModels;