mirror of
https://github.com/freedbygrace/DynamoDNS.git
synced 2026-08-28 11:17:07 +00:00
Add advanced metrics with historical trends for improved monitoring.
Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9111ef36-26c8-4085-84ca-a35dc1fec1b5 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7083d608-d6d3-4a6a-9a27-6286c5109627/6f351edb-9d50-48b2-b6c0-785aca497103.jpg
This commit is contained in:
@@ -118,6 +118,18 @@ export const webhookDeliveryLogs = pgTable("webhook_delivery_logs", {
|
|||||||
createdAt: timestamp("created_at").defaultNow().notNull(),
|
createdAt: timestamp("created_at").defaultNow().notNull(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Performance metrics for historical data and trends
|
||||||
|
export const dnsMetrics = pgTable("dns_metrics", {
|
||||||
|
id: uuid("id").defaultRandom().primaryKey(),
|
||||||
|
domainId: uuid("domain_id").references(() => domains.id, { onDelete: "cascade" }),
|
||||||
|
recordId: uuid("record_id").references(() => dnsRecords.id, { onDelete: "cascade" }),
|
||||||
|
metricType: text("metric_type").notNull(), // response_time, uptime, propagation, etc.
|
||||||
|
value: jsonb("value").notNull(), // Flexible metric value storage
|
||||||
|
source: text("source"), // Source of the metric (provider, third-party, etc.)
|
||||||
|
tags: text("tags").array(), // For additional filtering/grouping
|
||||||
|
timestamp: timestamp("timestamp").defaultNow().notNull(),
|
||||||
|
});
|
||||||
|
|
||||||
// Custom roles table for user-defined roles beyond system defaults
|
// Custom roles table for user-defined roles beyond system defaults
|
||||||
export const customRoles = pgTable("custom_roles", {
|
export const customRoles = pgTable("custom_roles", {
|
||||||
id: uuid("id").defaultRandom().primaryKey(),
|
id: uuid("id").defaultRandom().primaryKey(),
|
||||||
@@ -267,6 +279,15 @@ export const insertWebhookDeliveryLogSchema = createInsertSchema(webhookDelivery
|
|||||||
retryCount: true,
|
retryCount: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const insertDnsMetricSchema = createInsertSchema(dnsMetrics).pick({
|
||||||
|
domainId: true,
|
||||||
|
recordId: true,
|
||||||
|
metricType: true,
|
||||||
|
value: true,
|
||||||
|
source: true,
|
||||||
|
tags: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
export type InsertUser = z.infer<typeof insertUserSchema>;
|
export type InsertUser = z.infer<typeof insertUserSchema>;
|
||||||
@@ -288,6 +309,7 @@ export type InsertApiToken = z.infer<typeof insertApiTokenSchema>;
|
|||||||
export type ApiToken = typeof apiTokens.$inferSelect;
|
export type ApiToken = typeof apiTokens.$inferSelect;
|
||||||
|
|
||||||
export type DnsHistory = typeof dnsHistory.$inferSelect;
|
export type DnsHistory = typeof dnsHistory.$inferSelect;
|
||||||
|
export type DnsMetric = typeof dnsMetrics.$inferSelect;
|
||||||
export type CustomRole = typeof customRoles.$inferSelect;
|
export type CustomRole = typeof customRoles.$inferSelect;
|
||||||
export type Group = typeof groups.$inferSelect;
|
export type Group = typeof groups.$inferSelect;
|
||||||
export type GroupMember = typeof groupMembers.$inferSelect;
|
export type GroupMember = typeof groupMembers.$inferSelect;
|
||||||
@@ -301,6 +323,7 @@ export type InsertWebhook = z.infer<typeof insertWebhookSchema>;
|
|||||||
export type Webhook = typeof webhooks.$inferSelect;
|
export type Webhook = typeof webhooks.$inferSelect;
|
||||||
export type InsertWebhookDeliveryLog = z.infer<typeof insertWebhookDeliveryLogSchema>;
|
export type InsertWebhookDeliveryLog = z.infer<typeof insertWebhookDeliveryLogSchema>;
|
||||||
export type WebhookDeliveryLog = typeof webhookDeliveryLogs.$inferSelect;
|
export type WebhookDeliveryLog = typeof webhookDeliveryLogs.$inferSelect;
|
||||||
|
export type InsertDnsMetric = z.infer<typeof insertDnsMetricSchema>;
|
||||||
|
|
||||||
// Role Types
|
// Role Types
|
||||||
// System default roles - these will still be available alongside custom roles
|
// System default roles - these will still be available alongside custom roles
|
||||||
@@ -361,6 +384,17 @@ export const dnsHistoryRelations = relations(dnsHistory, ({ one }) => ({
|
|||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
export const dnsMetricsRelations = relations(dnsMetrics, ({ one }) => ({
|
||||||
|
domain: one(domains, {
|
||||||
|
fields: [dnsMetrics.domainId],
|
||||||
|
references: [domains.id],
|
||||||
|
}),
|
||||||
|
record: one(dnsRecords, {
|
||||||
|
fields: [dnsMetrics.recordId],
|
||||||
|
references: [dnsRecords.id],
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
|
||||||
export const providersRelations = relations(providers, ({ many }) => ({
|
export const providersRelations = relations(providers, ({ many }) => ({
|
||||||
domains: many(domains),
|
domains: many(domains),
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user