-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Supports Bulletin to view all metrics. (#2584)
Signed-off-by: tomsun28 <tomsun28@outlook.com> Co-authored-by: YuLuo <yuluo08290126@gmail.com> Co-authored-by: tomsun28 <tomsun28@outlook.com> Co-authored-by: kerwin612 <kerwin612@qq.com>
- Loading branch information
1 parent
5eef247
commit 5d416e8
Showing
31 changed files
with
2,081 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
common/src/main/java/org/apache/hertzbeat/common/entity/manager/bulletin/Bulletin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.hertzbeat.common.entity.manager.bulletin; | ||
|
||
import static io.swagger.v3.oas.annotations.media.Schema.AccessMode.READ_WRITE; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Convert; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EntityListeners; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.apache.hertzbeat.common.entity.manager.JsonLongListAttributeConverter; | ||
import org.apache.hertzbeat.common.entity.manager.JsonTagListAttributeConverter; | ||
import org.apache.hertzbeat.common.entity.manager.TagItem; | ||
import org.springframework.data.annotation.CreatedBy; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedBy; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
/** | ||
* Bulletin | ||
*/ | ||
@Entity | ||
@Data | ||
@Schema(description = "Bulletin") | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@EntityListeners(AuditingEntityListener.class) | ||
@Table(name = "hzb_bulletin") | ||
public class Bulletin { | ||
|
||
@Id | ||
@Schema(description = "Bulletin ID", example = "1") | ||
private Long id; | ||
|
||
@Schema(description = "Bulletin Name", example = "Bulletin1", accessMode = READ_WRITE) | ||
private String name; | ||
|
||
@Schema(description = "Monitor IDs", example = "1") | ||
@Column(name = "monitor_ids", length = 5000) | ||
@Convert(converter = JsonLongListAttributeConverter.class) | ||
private List<Long> monitorIds; | ||
|
||
@Schema(description = "Monitor Type eg: jvm, tomcat", example = "jvm", accessMode = READ_WRITE) | ||
private String app; | ||
|
||
|
||
@Schema(description = "Monitor Fields") | ||
@Column(length = 4096, columnDefinition = "json") | ||
private String fields; | ||
|
||
@Schema(description = "Tags(status:success,env:prod)", example = "{name: key1, value: value1}", | ||
accessMode = READ_WRITE) | ||
@Convert(converter = JsonTagListAttributeConverter.class) | ||
@Column(length = 2048) | ||
private List<TagItem> tags; | ||
|
||
@Schema(title = "The creator of this record", example = "tom", accessMode = READ_WRITE) | ||
@CreatedBy | ||
private String creator; | ||
|
||
@Schema(title = "The modifier of this record", example = "tom", accessMode = READ_WRITE) | ||
@LastModifiedBy | ||
private String modifier; | ||
|
||
@Schema(title = "Record create time", example = "2024-07-02T20:09:34.903217", accessMode = READ_WRITE) | ||
@CreatedDate | ||
private LocalDateTime gmtCreate; | ||
|
||
@Schema(title = "Record modify time", example = "2024-07-02T20:09:34.903217", accessMode = READ_WRITE) | ||
@LastModifiedDate | ||
private LocalDateTime gmtUpdate; | ||
} |
52 changes: 52 additions & 0 deletions
52
common/src/main/java/org/apache/hertzbeat/common/entity/manager/bulletin/BulletinDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
|
||
package org.apache.hertzbeat.common.entity.manager.bulletin; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import lombok.Data; | ||
|
||
/** | ||
* Bulletin DTO | ||
*/ | ||
@Data | ||
public class BulletinDto { | ||
|
||
/** | ||
* Bulletin name | ||
*/ | ||
private String name; | ||
|
||
/** | ||
* Monitor type eg: jvm, tomcat | ||
*/ | ||
private String app; | ||
|
||
|
||
/** | ||
* Monitor fields | ||
*/ | ||
private Map<String, List<String>> fields; | ||
|
||
/** | ||
* Monitor ids | ||
*/ | ||
private List<Long> monitorIds; | ||
|
||
} |
135 changes: 135 additions & 0 deletions
135
...rc/main/java/org/apache/hertzbeat/common/entity/manager/bulletin/BulletinMetricsData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.hertzbeat.common.entity.manager.bulletin; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* Bulletin Metrics Data | ||
*/ | ||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Schema(description = "Bulletin Metrics Data") | ||
public class BulletinMetricsData { | ||
|
||
/** | ||
* Bulletin Name | ||
*/ | ||
@Schema(title = "Bulletin Name") | ||
private String name; | ||
|
||
/** | ||
* Content Data | ||
*/ | ||
@Schema(description = "Content Data") | ||
private List<Data> content; | ||
|
||
/** | ||
* Bulletin Metrics Data | ||
*/ | ||
@lombok.Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public static class Data { | ||
|
||
/** | ||
* Monitor Name | ||
*/ | ||
@Schema(title = "Monitor name") | ||
private String monitorName; | ||
|
||
/** | ||
* Monitor ID | ||
*/ | ||
@Schema(title = "Monitor ID") | ||
private Long monitorId; | ||
|
||
/** | ||
* Monitor IP | ||
*/ | ||
@Schema(title = "Monitor IP") | ||
private String host; | ||
|
||
/** | ||
* Monitor Metrics | ||
*/ | ||
@Schema(title = "Monitor Metrics") | ||
private List<Metric> metrics; | ||
} | ||
|
||
/** | ||
* Metrics Data | ||
*/ | ||
@lombok.Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Schema(description = "Metrics Data") | ||
public static class Metric{ | ||
|
||
/** | ||
* Metric type | ||
*/ | ||
@Schema(title = "Metric type") | ||
private String name; | ||
|
||
/** | ||
* Metric fields | ||
*/ | ||
@Schema(title = "Metric fields") | ||
private List<List<Field>> fields; | ||
} | ||
|
||
|
||
/** | ||
* Metrics field | ||
*/ | ||
@lombok.Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Schema(description = "Metrics field") | ||
public static class Field{ | ||
|
||
/** | ||
* Field name | ||
*/ | ||
@Schema(title = "Field name") | ||
private String key; | ||
|
||
/** | ||
* Field unit | ||
*/ | ||
@Schema(title = "Field unit") | ||
private String unit; | ||
|
||
/** | ||
* Field value | ||
*/ | ||
@Schema(title = "Field value") | ||
private String value; | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
common/src/main/java/org/apache/hertzbeat/common/entity/manager/bulletin/BulletinVo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.hertzbeat.common.entity.manager.bulletin; | ||
|
||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.apache.hertzbeat.common.entity.manager.TagItem; | ||
|
||
/** | ||
* Bulletin Vo | ||
*/ | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class BulletinVo { | ||
|
||
/** | ||
* Bulletin ID | ||
*/ | ||
private Long id; | ||
|
||
/** | ||
* Bulletin name | ||
*/ | ||
private String name; | ||
|
||
/** | ||
* Bulletin metrics | ||
*/ | ||
private List<String> metrics; | ||
|
||
/** | ||
* Bulletin tags | ||
*/ | ||
private List<TagItem> tags; | ||
|
||
/** | ||
* Bulletin monitor ID | ||
*/ | ||
private List<Long> monitorId; | ||
|
||
/** | ||
* Bulletin monitor name | ||
*/ | ||
private String app; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.