mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 08:42:13 +02:00
- 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.
48 lines
1.2 KiB
TypeScript
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;
|