Skip to content

Commit

Permalink
refactor: update prometheus module change run.mone to org.apache (apa…
Browse files Browse the repository at this point in the history
  • Loading branch information
shanwb authored Sep 13, 2024
1 parent 2046258 commit a55bc77
Show file tree
Hide file tree
Showing 147 changed files with 409 additions and 417 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import com.xiaomi.mone.tpc.common.vo.UserVo;
import com.xiaomi.mone.tpc.login.util.UserUtil;
import com.xiaomi.mone.tpc.login.vo.AuthUserVo;
import com.xiaomi.youpin.prometheus.agent.api.service.PrometheusAlertService;
import com.xiaomi.youpin.prometheus.agent.param.alert.RuleAlertParam;
import org.apache.ozhera.prometheus.agent.api.service.PrometheusAlertService;
import org.apache.ozhera.prometheus.agent.param.alert.RuleAlertParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
Expand Down Expand Up @@ -66,7 +66,7 @@ public Result addRule(JsonObject param,String identifyId, String user) {
Result result = null;
try {
RuleAlertParam ruleAlertParam = new Gson().fromJson(new Gson().toJson(param), RuleAlertParam.class);
com.xiaomi.youpin.prometheus.agent.result.Result ruleAlert = prometheusAlertService.createRuleAlert(ruleAlertParam);
org.apache.ozhera.prometheus.agent.result.Result ruleAlert = prometheusAlertService.createRuleAlert(ruleAlertParam);
result = new Gson().fromJson(new Gson().toJson(ruleAlert), Result.class);

log.info("open alert add, request : {} ,result:{}",new Gson().toJson(ruleAlertParam),new Gson().toJson(ruleAlert));
Expand All @@ -84,7 +84,7 @@ public Result editRule(Integer alertId,JsonObject param,String identifyId, Stri
log.info("open alert update api param :{}",param.toString());
try {
RuleAlertParam ruleAlertParam = new Gson().fromJson(new Gson().toJson(param), RuleAlertParam.class);
com.xiaomi.youpin.prometheus.agent.result.Result ruleAlert = prometheusAlertService.UpdateRuleAlert(String.valueOf(alertId),ruleAlertParam);
org.apache.ozhera.prometheus.agent.result.Result ruleAlert = prometheusAlertService.UpdateRuleAlert(String.valueOf(alertId),ruleAlertParam);
result = new Gson().fromJson(new Gson().toJson(ruleAlert), Result.class);

log.info("open alert update request,alertId:{}, param : {} ,result:{}",alertId,new Gson().toJson(ruleAlertParam),new Gson().toJson(ruleAlert));
Expand All @@ -100,7 +100,7 @@ public Result delRule(Integer alertId,String identifyId, String user) {

Result result = null;
try {
com.xiaomi.youpin.prometheus.agent.result.Result ruleAlert = prometheusAlertService.DeleteRuleAlert(String.valueOf(alertId));
org.apache.ozhera.prometheus.agent.result.Result ruleAlert = prometheusAlertService.DeleteRuleAlert(String.valueOf(alertId));
result = new Gson().fromJson(new Gson().toJson(ruleAlert), Result.class);

log.info("open alert delete request,alertId:{}, result:{}",alertId,new Gson().toJson(ruleAlert));
Expand All @@ -116,7 +116,7 @@ public Result enableRule(Integer alertId,Integer pauseStatus,String identifyId,

Result result = null;
try {
com.xiaomi.youpin.prometheus.agent.result.Result ruleAlert = prometheusAlertService.EnabledRuleAlert(String.valueOf(alertId),String.valueOf(pauseStatus));
org.apache.ozhera.prometheus.agent.result.Result ruleAlert = prometheusAlertService.EnabledRuleAlert(String.valueOf(alertId),String.valueOf(pauseStatus));
result = new Gson().fromJson(new Gson().toJson(ruleAlert), Result.class);

log.info("open alert enableRule request,alertId:{}, pauseStatus:{},result:{}",alertId,pauseStatus,new Gson().toJson(ruleAlert));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import com.google.gson.JsonObject;
import org.apache.ozhera.monitor.result.Result;
import org.apache.ozhera.monitor.service.scrapeJob.ScrapeJob;
import com.xiaomi.youpin.prometheus.agent.api.service.PrometheusScrapeJobService;
import com.xiaomi.youpin.prometheus.agent.param.scrapeConfig.ScrapeConfigParam;
import org.apache.ozhera.prometheus.agent.api.service.PrometheusScrapeJobService;
import org.apache.ozhera.prometheus.agent.param.scrapeConfig.ScrapeConfigParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Value;
Expand All @@ -42,7 +42,7 @@ public Result addScrapeJob(JsonObject param, String identifyId, String user) {
Result result = null;
try {
ScrapeConfigParam scrapeConfigParam = new Gson().fromJson(new Gson().toJson(param), ScrapeConfigParam.class);
com.xiaomi.youpin.prometheus.agent.result.Result scrapeResult = prometheusScrapeJobService.CreateScrapeConfig(scrapeConfigParam);
org.apache.ozhera.prometheus.agent.result.Result scrapeResult = prometheusScrapeJobService.CreateScrapeConfig(scrapeConfigParam);
log.info("addScrapeJob: {}", scrapeResult);
result = new Gson().fromJson(new Gson().toJson(scrapeResult), Result.class);

Expand All @@ -58,7 +58,7 @@ public Result editScrapeJob(Integer jobId, JsonObject param, String identifyId,
Result result = null;
try {
ScrapeConfigParam scrapeConfigParam = new Gson().fromJson(new Gson().toJson(param), ScrapeConfigParam.class);
com.xiaomi.youpin.prometheus.agent.result.Result scrapeResult = prometheusScrapeJobService.UpdateScrapeConfig(String.valueOf(jobId), scrapeConfigParam);
org.apache.ozhera.prometheus.agent.result.Result scrapeResult = prometheusScrapeJobService.UpdateScrapeConfig(String.valueOf(jobId), scrapeConfigParam);
log.info("editScrapeJob: {}", scrapeResult);
result = new Gson().fromJson(new Gson().toJson(scrapeResult), Result.class);
log.info("open scrape job edit, request : {} ,result:{}", new Gson().toJson(scrapeConfigParam), new Gson().toJson(scrapeResult));
Expand All @@ -72,7 +72,7 @@ public Result editScrapeJob(Integer jobId, JsonObject param, String identifyId,
public Result delScrapeJob(Integer jobId, String identifyId, String user) {
Result result = null;
try {
com.xiaomi.youpin.prometheus.agent.result.Result scrapeResult = prometheusScrapeJobService.DeleteScrapeConfig(String.valueOf(jobId));
org.apache.ozhera.prometheus.agent.result.Result scrapeResult = prometheusScrapeJobService.DeleteScrapeConfig(String.valueOf(jobId));
log.info("delScrapeJob: {}", scrapeResult);
result = new Gson().fromJson(new Gson().toJson(scrapeResult), Result.class);
log.info("open scrape job delete, request : {} ,result:{}", jobId, new Gson().toJson(scrapeResult));
Expand All @@ -86,7 +86,7 @@ public Result delScrapeJob(Integer jobId, String identifyId, String user) {
public Result queryScrapeJob(Integer jobId, String identifyId, String user) {
Result result = null;
try {
com.xiaomi.youpin.prometheus.agent.result.Result scrapeResult = prometheusScrapeJobService.GetScrapeConfig(String.valueOf(jobId));
org.apache.ozhera.prometheus.agent.result.Result scrapeResult = prometheusScrapeJobService.GetScrapeConfig(String.valueOf(jobId));
log.info("queryScrapeJob: {}", scrapeResult);
result = new Gson().fromJson(new Gson().toJson(scrapeResult), Result.class);
log.info("open scrape job query, request : {} ,result:{}", jobId, new Gson().toJson(scrapeResult));
Expand All @@ -100,7 +100,7 @@ public Result queryScrapeJob(Integer jobId, String identifyId, String user) {
public Result queryScrapeJobByName(String name, String identifyId, String user) {
Result result = null;
try {
com.xiaomi.youpin.prometheus.agent.result.Result scrapeResult = prometheusScrapeJobService.GetScrapeConfigByName(name);
org.apache.ozhera.prometheus.agent.result.Result scrapeResult = prometheusScrapeJobService.GetScrapeConfigByName(name);
log.info("queryScrapeJobByName: {}", scrapeResult);
result = new Gson().fromJson(new Gson().toJson(scrapeResult), Result.class);
log.info("open scrape job query, request : {} ,result:{}", name, new Gson().toJson(scrapeResult));
Expand Down
4 changes: 2 additions & 2 deletions ozhera-prometheus-agent/ozhera-prometheus-agent-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<parent>
<groupId>org.apache.ozhera</groupId>
<artifactId>ozhera-prometheus-agent</artifactId>
<groupId>run.mone</groupId>
<version>1.0.0-jdk21</version>
<version>2.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xiaomi.youpin.prometheus.agent.api.bo;
package org.apache.ozhera.prometheus.agent.api.bo;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xiaomi.youpin.prometheus.agent.api.bo;
package org.apache.ozhera.prometheus.agent.api.bo;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xiaomi.youpin.prometheus.agent.api.service;
package org.apache.ozhera.prometheus.agent.api.service;

import com.xiaomi.youpin.prometheus.agent.param.alert.RuleAlertParam;
import com.xiaomi.youpin.prometheus.agent.result.Result;
import org.apache.ozhera.prometheus.agent.param.alert.RuleAlertParam;
import org.apache.ozhera.prometheus.agent.result.Result;

/**
* @author zhangxiaowei6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xiaomi.youpin.prometheus.agent.api.service;
package org.apache.ozhera.prometheus.agent.api.service;


import com.xiaomi.youpin.prometheus.agent.api.bo.PrometheusReq;
import com.xiaomi.youpin.prometheus.agent.api.bo.Result;
import org.apache.ozhera.prometheus.agent.api.bo.PrometheusReq;
import org.apache.ozhera.prometheus.agent.api.bo.Result;

import java.util.Set;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xiaomi.youpin.prometheus.agent.api.service;
package org.apache.ozhera.prometheus.agent.api.service;

import com.xiaomi.youpin.prometheus.agent.param.scrapeConfig.ScrapeConfigParam;
import com.xiaomi.youpin.prometheus.agent.result.Result;
import org.apache.ozhera.prometheus.agent.param.scrapeConfig.ScrapeConfigParam;
import org.apache.ozhera.prometheus.agent.result.Result;

/**
* @author zhangxiaowei6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<parent>
<groupId>org.apache.ozhera</groupId>
<artifactId>ozhera-prometheus-agent</artifactId>
<groupId>run.mone</groupId>
<version>1.0.0-jdk21</version>
<version>2.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xiaomi.youpin.prometheus.agent;
package org.apache.ozhera.prometheus.agent;

import com.xiaomi.youpin.prometheus.agent.client.Client;
import org.apache.ozhera.prometheus.agent.client.Client;
import lombok.extern.slf4j.Slf4j;

@Slf4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xiaomi.youpin.prometheus.agent.alertManagerClient;
package org.apache.ozhera.prometheus.agent.alertManagerClient;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.aliyun.arms20190808.models.CreateOrUpdateAlertRuleResponse;
Expand All @@ -27,15 +27,15 @@
import com.aliyun.arms20190808.models.ListNotificationPoliciesResponseBody;
import com.google.common.base.Stopwatch;
import com.google.gson.Gson;
import com.xiaomi.youpin.prometheus.agent.client.Client;
import com.xiaomi.youpin.prometheus.agent.entity.RuleAlertEntity;
import com.xiaomi.youpin.prometheus.agent.enums.RuleAlertStatusEnum;
import com.xiaomi.youpin.prometheus.agent.operators.ali.AliPrometheusOperator;
import com.xiaomi.youpin.prometheus.agent.param.alertManager.Rule;
import com.xiaomi.youpin.prometheus.agent.param.prometheus.ali.AliNotifyObjects;
import com.xiaomi.youpin.prometheus.agent.param.prometheus.ali.AliNotifyRule;
import com.xiaomi.youpin.prometheus.agent.service.prometheus.RuleAlertService;
import com.xiaomi.youpin.prometheus.agent.util.CommitPoolUtil;
import org.apache.ozhera.prometheus.agent.client.Client;
import org.apache.ozhera.prometheus.agent.entity.RuleAlertEntity;
import org.apache.ozhera.prometheus.agent.enums.RuleAlertStatusEnum;
import org.apache.ozhera.prometheus.agent.operators.ali.AliPrometheusOperator;
import org.apache.ozhera.prometheus.agent.param.alertManager.Rule;
import org.apache.ozhera.prometheus.agent.param.prometheus.ali.AliNotifyObjects;
import org.apache.ozhera.prometheus.agent.param.prometheus.ali.AliNotifyRule;
import org.apache.ozhera.prometheus.agent.service.prometheus.RuleAlertService;
import org.apache.ozhera.prometheus.agent.util.CommitPoolUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xiaomi.youpin.prometheus.agent.alertManagerClient;
package org.apache.ozhera.prometheus.agent.alertManagerClient;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.google.common.base.Stopwatch;
import com.google.gson.Gson;
import com.xiaomi.youpin.prometheus.agent.client.Client;
import com.xiaomi.youpin.prometheus.agent.entity.RuleAlertEntity;
import com.xiaomi.youpin.prometheus.agent.param.alertManager.AlertManagerConfig;
import com.xiaomi.youpin.prometheus.agent.param.alertManager.Group;
import com.xiaomi.youpin.prometheus.agent.param.alertManager.Rule;
import com.xiaomi.youpin.prometheus.agent.service.prometheus.RuleAlertService;
import com.xiaomi.youpin.prometheus.agent.util.CommitPoolUtil;
import com.xiaomi.youpin.prometheus.agent.util.FileUtil;
import com.xiaomi.youpin.prometheus.agent.util.Http;
import com.xiaomi.youpin.prometheus.agent.util.YamlUtil;
import org.apache.ozhera.prometheus.agent.client.Client;
import org.apache.ozhera.prometheus.agent.entity.RuleAlertEntity;
import org.apache.ozhera.prometheus.agent.param.alertManager.AlertManagerConfig;
import org.apache.ozhera.prometheus.agent.param.alertManager.Group;
import org.apache.ozhera.prometheus.agent.param.alertManager.Rule;
import org.apache.ozhera.prometheus.agent.service.prometheus.RuleAlertService;
import org.apache.ozhera.prometheus.agent.util.CommitPoolUtil;
import org.apache.ozhera.prometheus.agent.util.FileUtil;
import org.apache.ozhera.prometheus.agent.util.Http;
import org.apache.ozhera.prometheus.agent.util.YamlUtil;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
Expand All @@ -42,7 +42,7 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;

import static com.xiaomi.youpin.prometheus.agent.Commons.HTTP_POST;
import static org.apache.ozhera.prometheus.agent.Commons.HTTP_POST;

@Slf4j
public class AlertManagerClient implements Client {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xiaomi.youpin.prometheus.agent.alertManagerClient;
package org.apache.ozhera.prometheus.agent.alertManagerClient;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.google.common.base.Stopwatch;
import com.google.gson.Gson;
import com.xiaomi.youpin.prometheus.agent.client.Client;
import com.xiaomi.youpin.prometheus.agent.entity.RuleAlertEntity;
import com.xiaomi.youpin.prometheus.agent.param.alertManager.AlertManagerConfig;
import com.xiaomi.youpin.prometheus.agent.param.alertManager.Group;
import com.xiaomi.youpin.prometheus.agent.param.alertManager.Rule;
import com.xiaomi.youpin.prometheus.agent.service.prometheus.RuleAlertService;
import com.xiaomi.youpin.prometheus.agent.util.CommitPoolUtil;
import com.xiaomi.youpin.prometheus.agent.util.FileUtil;
import com.xiaomi.youpin.prometheus.agent.util.Http;
import com.xiaomi.youpin.prometheus.agent.util.YamlUtil;
import org.apache.ozhera.prometheus.agent.client.Client;
import org.apache.ozhera.prometheus.agent.entity.RuleAlertEntity;
import org.apache.ozhera.prometheus.agent.param.alertManager.AlertManagerConfig;
import org.apache.ozhera.prometheus.agent.param.alertManager.Group;
import org.apache.ozhera.prometheus.agent.param.alertManager.Rule;
import org.apache.ozhera.prometheus.agent.service.prometheus.RuleAlertService;
import org.apache.ozhera.prometheus.agent.util.CommitPoolUtil;
import org.apache.ozhera.prometheus.agent.util.FileUtil;
import org.apache.ozhera.prometheus.agent.util.Http;
import org.apache.ozhera.prometheus.agent.util.YamlUtil;
import io.fabric8.kubernetes.api.model.PodList;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClient;
Expand All @@ -48,7 +48,7 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;

import static com.xiaomi.youpin.prometheus.agent.Commons.HTTP_GET;
import static org.apache.ozhera.prometheus.agent.Commons.HTTP_GET;

/**
* @author zhangxiaowei6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xiaomi.youpin.prometheus.agent.client;
package org.apache.ozhera.prometheus.agent.client;

public interface Client {
public void GetLocalConfigs();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xiaomi.youpin.prometheus.agent.operators;
package org.apache.ozhera.prometheus.agent.operators;

/**
* @author zhangxiaowei6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xiaomi.youpin.prometheus.agent.operators.ali;
package org.apache.ozhera.prometheus.agent.operators.ali;

public class AliAlertMessageTemplate {
public static final String ALERT_MESSAGE_TEMPLATE = "{\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xiaomi.youpin.prometheus.agent.operators.ali;
package org.apache.ozhera.prometheus.agent.operators.ali;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.aliyun.arms20190808.Client;
Expand Down Expand Up @@ -49,9 +49,9 @@
import com.aliyun.teaopenapi.models.Config;
import com.aliyun.teautil.models.RuntimeOptions;
import com.google.gson.Gson;
import com.xiaomi.youpin.prometheus.agent.operators.BasicOperator;
import com.xiaomi.youpin.prometheus.agent.param.alertManager.Rule;
import com.xiaomi.youpin.prometheus.agent.param.prometheus.ali.AliLabel;
import org.apache.ozhera.prometheus.agent.operators.BasicOperator;
import org.apache.ozhera.prometheus.agent.param.alertManager.Rule;
import org.apache.ozhera.prometheus.agent.param.prometheus.ali.AliLabel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

Expand All @@ -60,7 +60,7 @@
import java.util.List;
import java.util.Map;

import static com.xiaomi.youpin.prometheus.agent.operators.ali.AliAlertMessageTemplate.ALERT_MESSAGE_TEMPLATE;
import static org.apache.ozhera.prometheus.agent.operators.ali.AliAlertMessageTemplate.ALERT_MESSAGE_TEMPLATE;

/**
* @author zhangxiaowei6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xiaomi.youpin.prometheus.agent.operators.local;
package org.apache.ozhera.prometheus.agent.operators.local;

import com.xiaomi.youpin.prometheus.agent.operators.BasicOperator;
import org.apache.ozhera.prometheus.agent.operators.BasicOperator;
import lombok.extern.slf4j.Slf4j;

/**
Expand Down
Loading

0 comments on commit a55bc77

Please sign in to comment.