Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
*/
@Entity
@Table(name = "hzb_alert_define_monitor_bind", indexes = {
@Index(name = "index_alert_define_monitor", columnList = "alertDefineId"),
@Index(name = "index_alert_define_monitor", columnList = "monitor_id")
@Index(name = "idx_alert_define_id", columnList = "alert_define_id"),
@Index(name = "idx_monitor_id", columnList = "monitor_id")
})
@Data
@Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
*/
@Entity
@Table(name = "hzb_collector_monitor_bind", indexes = {
@Index(name = "index_collector_monitor", columnList = "collector"),
@Index(name = "index_collector_monitor", columnList = "monitor_id")
@Index(name = "idx_collector_monitor_collector", columnList = "collector"),
@Index(name = "idx_collector_monitor_monitor_id", columnList = "monitor_id")
})
@Data
@Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
*/
@Entity
@Table(name = "hzb_monitor", indexes = {
@Index(name = "monitor_query_index", columnList = "app"),
@Index(name = "monitor_query_index", columnList = "instance"),
@Index(name = "monitor_query_index", columnList = "name")
@Index(name = "idx_hzb_monitor_app", columnList = "app"),
@Index(name = "idx_hzb_monitor_instance", columnList = "instance"),
@Index(name = "idx_hzb_monitor_name", columnList = "name")
})
@Data
@Builder
Expand All @@ -62,51 +62,51 @@
@Schema(description = "Monitor Entity")
@EntityListeners(AuditingEntityListener.class)
public class Monitor {

@Id
@Schema(title = "Monitor task ID", example = "87584674384", accessMode = READ_ONLY)
private Long id;

@Schema(title = "Collect task ID", example = "43243543543", accessMode = READ_ONLY)
private Long jobId;

@Schema(title = "task name", example = "Api-TanCloud.cn", accessMode = READ_WRITE)
@Size(max = 100)
private String name;

@Schema(title = "Type of monitoring", example = "TanCloud", accessMode = READ_WRITE)
@Size(max = 100)
private String app;

@Schema(title = "Scrape type: static | http_sd | dns_sd | zookeeper_sd", example = "static", accessMode = READ_WRITE)
@Size(max = 100)
private String scrape;

@Schema(title = "the monitor target: ip/domain+port or ip/domain", example = "192.167.25.11:8081", accessMode = READ_WRITE)
@Size(max = 100)
@HostValid
private String instance;

@Schema(title = "Monitoring of the acquisition interval time in seconds", example = "600", accessMode = READ_WRITE)
@Min(10)
private Integer intervals;

@Schema(title = "Schedule type: interval | cron", example = "interval", accessMode = READ_WRITE)
@Size(max = 20)
private String scheduleType;

@Schema(title = "Cron expression when scheduleType is cron", example = "0/5 * * * * ?", accessMode = READ_WRITE)
@Size(max = 100)
private String cronExpression;

@Schema(title = "Task status 0: Paused, 1: Up, 2: Down", accessMode = READ_WRITE)
@Min(0)
@Max(4)
private byte status;

@Schema(title = "Task type 0: Normal, 1: push auto create, 2: discovery auto create")
private byte type;

@Schema(title = "task label", example = "{env:test}", accessMode = READ_WRITE)
@Convert(converter = JsonMapAttributeConverter.class)
@Column(length = 4096)
Expand All @@ -116,23 +116,23 @@ public class Monitor {
@Convert(converter = JsonMapAttributeConverter.class)
@Column(length = 4096)
private Map<String, String> annotations;

@Schema(title = "Monitor note description", example = "Availability monitoring of the SAAS website TanCloud", accessMode = READ_WRITE)
@Size(max = 255)
private String description;

@Schema(title = "The creator of this record", example = "tom", accessMode = READ_ONLY)
@CreatedBy
private String creator;

@Schema(title = "The modifier of this record", example = "tom", accessMode = READ_ONLY)
@LastModifiedBy
private String modifier;

@Schema(title = "Record create time", example = "2024-07-02T20:09:34.903217", accessMode = READ_ONLY)
@CreatedDate
private LocalDateTime gmtCreate;

@Schema(title = "Record modify time", example = "2024-07-02T20:09:34.903217", accessMode = READ_ONLY)
@LastModifiedDate
private LocalDateTime gmtUpdate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
*/
@Entity
@Table(name = "hzb_monitor_bind", indexes = {
@Index(name = "index_monitor_bind", columnList = "bizId"),
@Index(name = "index_monitor_bind", columnList = "biz_id"),
@Index(name = "index_monitor_bin", columnList = "monitor_id")
})
@Data
Expand All @@ -59,7 +59,7 @@ public class MonitorBind {

@Schema(title = "key string: ip:port")
private String keyStr;

@Schema(title = "connect bind id", example = "87432674384")
private Long bizId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@
* Monitor parameter values
*/
@Entity
@Table(name = "hzb_param", indexes = { @Index(columnList = "monitorId") },
uniqueConstraints = @UniqueConstraint(columnNames = {"monitorId", "field"}))
@Table(
name = "hzb_param",
indexes = {@Index(name = "idx_hzb_param_monitor_id", columnList = "monitor_id")},
uniqueConstraints = {@UniqueConstraint(name = "uk_hzb_param_monitor_field", columnNames = {"monitor_id", "field"})}
)
@Data
@Builder
@AllArgsConstructor
Expand All @@ -68,13 +71,15 @@ public class Param {
* Monitor ID
*/
@Schema(title = "Monitor task ID", example = "875846754543", accessMode = READ_WRITE)
@Column(name = "monitor_id")
private Long monitorId;

/**
* Parameter Field Identifier
*/
@Schema(title = "Parameter identifier field", example = "port", accessMode = READ_WRITE)
@Size(max = 100)
@Column(name = "field")
@NotBlank(message = "field can not null")
private String field;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
@Entity
@Table(name = "hzb_status_page_incident_component_bind", indexes = {
@Index(name = "index_incident_component", columnList = "incident_id"),
@Index(name = "index_incident_component", columnList = "component_id")
})
@Data
@Builder
Expand All @@ -59,7 +58,7 @@ public class StatusPageIncidentComponentBind {
@Schema(title = "Incident ID", example = "87432674384")
@Column(name = "incident_id")
private Long incidentId;

@Schema(title = "Component ID", example = "87432674336")
@Column(name = "component_id")
private Long componentId;
Expand All @@ -71,5 +70,5 @@ public class StatusPageIncidentComponentBind {
@Schema(title = "Record modify time", example = "1612198444000")
@LastModifiedDate
private LocalDateTime gmtUpdate;

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
*/
@Entity
@Table(name = "hzb_push_metrics", indexes = {
@Index(name = "push_query_index", columnList = "monitorId"),
@Index(name = "push_query_index", columnList = "time")
@Index(name = "idx_push_metrics_monitor_id", columnList = "monitor_id"),
@Index(name = "idx_push_metrics_time", columnList = "time")
})
@Data
@Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
*/
@Entity
@Table(name = "hzb_history", indexes = {
@Index(name = "history_query_index", columnList = "instance"),
@Index(name = "history_query_index", columnList = "app"),
@Index(name = "history_query_index", columnList = "metrics"),
@Index(name = "history_query_index", columnList = "metric")
@Index(name = "idx_hzb_history_instance", columnList = "instance"),
@Index(name = "idx_hzb_history_app", columnList = "app"),
@Index(name = "idx_hzb_history_metrics", columnList = "metrics"),
@Index(name = "idx_hzb_history_metric", columnList = "metric")
})
@Data
@Builder
Expand All @@ -65,7 +65,7 @@ public class History {

@Schema(title = "Monitoring Metric usage speed count")
private String metric;

@Column(length = 5000)
private String metricLabels;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@
* PluginParam
*/
@Entity
@Table(name = "hzb_plugin_param", indexes = { @Index(columnList = "pluginMetadataId") },
uniqueConstraints = @UniqueConstraint(columnNames = {"pluginMetadataId", "field"}))
@Table(
name = "hzb_plugin_param",
indexes = {@Index(name = "idx_hzb_plugin_param_plugin_metadata_id", columnList = "plugin_metadata_id")},
uniqueConstraints = @UniqueConstraint(name = "uk_hzb_plugin_param_metadata_field", columnNames = {"plugin_metadata_id", "field"})
)
@Data
@Builder
@AllArgsConstructor
Expand All @@ -65,8 +68,9 @@ public class PluginParam {
/**
* Monitor ID
*/
@Schema(title = "Plugin task ID", example = "875846754543", accessMode = READ_WRITE)
@NotNull
@Column(name = "plugin_metadata_id")
@Schema(title = "Plugin task ID", example = "875846754543", accessMode = READ_WRITE)
private Long pluginMetadataId;

/**
Expand All @@ -75,6 +79,7 @@ public class PluginParam {
@Schema(title = "Parameter identifier field", example = "port", accessMode = READ_WRITE)
@Size(max = 100)
@NotNull
@Column(name = "field")
private String field;

/**
Expand Down
Loading
Loading