mirror of https://github.com/ZhongFuCheng3y/austin
parent
e3fe1e12c7
commit
f196f07d38
@ -0,0 +1,23 @@
|
||||
package com.java3y.austin.stream.callback;
|
||||
|
||||
import io.lettuce.core.RedisFuture;
|
||||
import io.lettuce.core.api.async.RedisAsyncCommands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* redis pipeline接口定义
|
||||
*
|
||||
* @author 3y
|
||||
*/
|
||||
public interface RedisPipelineCallBack {
|
||||
|
||||
/**
|
||||
* 具体执行逻辑
|
||||
*
|
||||
* @param redisAsyncCommands
|
||||
* @return
|
||||
*/
|
||||
List<RedisFuture<?>> invoke(RedisAsyncCommands redisAsyncCommands);
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.java3y.austin.stream.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 简单的埋点信息
|
||||
* @author 3y
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SimpleAnchorInfo {
|
||||
|
||||
|
||||
/**
|
||||
* 具体点位
|
||||
*/
|
||||
private int state;
|
||||
|
||||
/**
|
||||
* 业务Id(数据追踪使用)
|
||||
* 生成逻辑参考 TaskInfoUtils
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 生成时间
|
||||
*/
|
||||
private long timestamp;
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.java3y.austin.stream.function;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.java3y.austin.common.domain.AnchorInfo;
|
||||
import org.apache.flink.api.common.functions.FlatMapFunction;
|
||||
import org.apache.flink.util.Collector;
|
||||
|
||||
/**
|
||||
* @author 3y
|
||||
* @date 2022/2/22
|
||||
* process 处理
|
||||
*/
|
||||
public class AustinFlatMapFunction implements FlatMapFunction<String, AnchorInfo> {
|
||||
|
||||
@Override
|
||||
public void flatMap(String value, Collector<AnchorInfo> collector) throws Exception {
|
||||
AnchorInfo anchorInfo = JSON.parseObject(value, AnchorInfo.class);
|
||||
collector.collect(anchorInfo);
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
package com.java3y.austin.stream.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 3y
|
||||
* @date 2022/2/15
|
||||
* 获取SpringContext对象
|
||||
*/
|
||||
@Slf4j
|
||||
public class SpringContextUtils {
|
||||
private static ApplicationContext context;
|
||||
|
||||
/**
|
||||
* XML配置
|
||||
*/
|
||||
private static List<String> xmlPath = new ArrayList<>();
|
||||
|
||||
public static ApplicationContext loadContext(String path) {
|
||||
return loadContext(new String[]{path});
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过spring.xml文件配置将信息 装载 context
|
||||
*
|
||||
* @param paths
|
||||
* @return
|
||||
*/
|
||||
public static synchronized ApplicationContext loadContext(String[] paths) {
|
||||
if (null != paths && paths.length > 0) {
|
||||
List<String> newPaths = new ArrayList<>();
|
||||
for (String path : paths) {
|
||||
if (!xmlPath.contains(path)) {
|
||||
newPaths.add(path);
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(newPaths)) {
|
||||
String[] array = new String[newPaths.size()];
|
||||
for (int i = 0; i < newPaths.size(); i++) {
|
||||
array[i] = newPaths.get(i);
|
||||
xmlPath.add(newPaths.get(i));
|
||||
}
|
||||
if (null == context) {
|
||||
context = new ClassPathXmlApplicationContext(array);
|
||||
} else {
|
||||
context = new ClassPathXmlApplicationContext(array, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据bean的class来查找对象
|
||||
*
|
||||
* @param clazz
|
||||
* @return
|
||||
*/
|
||||
public static <T> T getBean(Class<T> clazz) {
|
||||
return context.getBean(clazz);
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
|
||||
<bean id="flinkUtils" class="com.java3y.austin.stream.utils.FlinkUtils"></bean>
|
||||
|
||||
</beans>
|
||||
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.java3y.austin.web.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 全链路 请求参数
|
||||
*
|
||||
* @author 3y
|
||||
* @date 2022/2/22
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DataParam {
|
||||
/**
|
||||
* 传入userId查看用户的链路信息
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
|
||||
/**
|
||||
* 业务Id(数据追踪使用)
|
||||
* 生成逻辑参考 TaskInfoUtils
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
|
||||
}
|
Loading…
Reference in new issue