From 2654c8d47de34090e4ea13470d33ddd523f4b4b4 Mon Sep 17 00:00:00 2001 From: ajaxfan <909938737@qq.com> Date: Mon, 15 Mar 2021 16:41:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0grafana=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extend/BizServiceEbtpExtendApplication.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/BizServiceEbtpExtendApplication.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/BizServiceEbtpExtendApplication.java index 5a3691f..58523c6 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/BizServiceEbtpExtendApplication.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/BizServiceEbtpExtendApplication.java @@ -1,7 +1,9 @@ package com.chinaunicom.mall.ebtp.extend; import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; +import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; @@ -14,6 +16,7 @@ import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; import cn.hutool.core.lang.Snowflake; import cn.hutool.core.util.IdUtil; +import io.micrometer.core.instrument.MeterRegistry; @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class }) @EnableFeignClients @@ -32,4 +35,16 @@ public class BizServiceEbtpExtendApplication { return IdUtil.getSnowflake(23, 16); } + /** + * Grafana 注册项 + * + * @param applicationName 应用名称, 用于grafana应用列表 + * @return + */ + @Bean + public MeterRegistryCustomizer configurer( + @Value("${spring.application.name}") String applicationName) { + return (registry) -> registry.config().commonTags("application", applicationName); + } + } From 12e77c16075cc0691e458a8179f9879ce8ca52e4 Mon Sep 17 00:00:00 2001 From: ajaxfan <909938737@qq.com> Date: Wed, 17 Mar 2021 10:46:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=93=BE=E8=B7=AF?= =?UTF-8?q?=E8=BF=BD=E8=B8=AA=E5=92=8C=E6=80=A7=E8=83=BD=E7=9B=91=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile-test | 4 ++-- deployment-test.yaml | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile-test b/Dockerfile-test index a8bd8b6..4a3ef16 100644 --- a/Dockerfile-test +++ b/Dockerfile-test @@ -1,4 +1,4 @@ -FROM harbor.dcos.guangzhou.unicom.local/eshop/skywalking_agent_springboot_8.1.0:v1.0 +FROM harbor.dcos.guangzhou.unicom.local/eshop/jdk8_springboot_agent:v1.6 ENV LC_ALL=zh_CN.utf8 ENV LANG=zh_CN.utf8 ENV LANGUAGE=zh_CN.utf8 @@ -7,4 +7,4 @@ RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8 RUN mkdir -p /model COPY /target/classes/model/. /model/ ADD /target/biz_service_ebtp_extend-0.0.1.jar /biz_service_ebtp_extend-0.0.1.jar -ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=test", "-jar", "/biz_service_ebtp_extend-0.0.1.jar"] +ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-javaagent:/skywalking/agent/skywalking-agent.jar", "-Dspring.profiles.active=test", "-jar", "/biz_service_ebtp_extend-0.0.1.jar"] diff --git a/deployment-test.yaml b/deployment-test.yaml index c4fc4aa..fd96120 100644 --- a/deployment-test.yaml +++ b/deployment-test.yaml @@ -46,7 +46,11 @@ spec: env: # Apollo 配置中心变量设置 - name: APOLLO_CONFIGSERVICE - value: http://10.242.37.1488:6001 + value: http://10.242.37.1488:6001 + - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES + value: skywalking-oap-cluster.skywalking:11800 + - name: SW_AGENT_NAME + value: biz-service-ebtp-extend --- kind: Service apiVersion: v1