update to v2.0.0,新增搜索中心,并集成用户中心和日志中心;首页新增流量统计

This commit is contained in:
zlt
2019-05-09 23:28:41 +08:00
parent 5d4c30df4b
commit a68441003a
108 changed files with 2356 additions and 278 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>central-platform</artifactId>
<version>1.6.0</version>
<version>2.0.0</version>
</parent>
<artifactId>zlt-gateway</artifactId>
<packaging>pom</packaging>
+5 -1
View File
@@ -4,7 +4,7 @@
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-gateway</artifactId>
<version>1.6.0</version>
<version>2.0.0</version>
</parent>
<artifactId>zuul-gateway</artifactId>
<description>zuul网关</description>
@@ -91,6 +91,10 @@
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>eu.bitwalker</groupId>
<artifactId>UserAgentUtils</artifactId>
</dependency>
</dependencies>
<build>
@@ -0,0 +1,72 @@
package com.central.gateway.filter.pre;
import com.central.log.monitor.PointUtil;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import eu.bitwalker.useragentutils.UserAgent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
/**
* 统计分析埋点过滤器
*
* @author zlt
* @date 2018/11/20
*/
@Slf4j
@Component
public class RequestStatisticsFilter extends ZuulFilter {
@Override
public String filterType() {
return FilterConstants.PRE_TYPE;
}
@Override
public int filterOrder() {
return 0;
}
@Override
public boolean shouldFilter() {
return true;
}
@Override
public Object run() {
RequestContext ctx = RequestContext.getCurrentContext();
HttpServletRequest req = ctx.getRequest();
UserAgent userAgent = UserAgent.parseUserAgentString(req.getHeader("User-Agent"));
//埋点
PointUtil.debug("0","request-statistics","ip="+this.getIpAddr(req)
+"&browser="+userAgent.getBrowser()
+"&operatingSystem="+userAgent.getOperatingSystem());
return null;
}
/**
* 获取Ip地址
*/
public String getIpAddr(HttpServletRequest request){
String ip = request.getHeader("X-Forwarded-For");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
return ip;
}
}
@@ -108,6 +108,11 @@ zuul:
path: /api-generator/**
service-id: code-generator
strip-prefix: true
search:
path: /api-search/**
service-id: search-center
strip-prefix: true
custom-sensitive-headers: true
ssl-hostname-validation-enabled: false
hystrix: