提交 728b6f98 编写于 作者: wu-sheng's avatar wu-sheng

recovery webui to project, ready to solve compile issues with new arch.

上级 a5489b91
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<modules> <modules>
<module>skywalking-commons</module> <module>skywalking-commons</module>
<module>skywalking-alarm</module> <module>skywalking-alarm</module>
<!--<module>skywalking-webui</module>--> <module>skywalking-webui</module>
<module>skywalking-sniffer</module> <module>skywalking-sniffer</module>
<module>skywalking-storage-center</module> <module>skywalking-storage-center</module>
<module>skywalking-opentracing-kit</module> <module>skywalking-opentracing-kit</module>
......
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.a.eye</groupId>
<parent>
<artifactId>skywalking</artifactId>
<groupId>com.a.eye</groupId>
<version>2.0-2016</version>
</parent>
<artifactId>skywalking-webui</artifactId> <artifactId>skywalking-webui</artifactId>
<version>2.0-2016</version>
<url>http://maven.apache.org</url>
<packaging>war</packaging> <packaging>war</packaging>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.spring.version>4.1.6.RELEASE</project.spring.version> <project.spring.version>4.1.6.RELEASE</project.spring.version>
</properties> </properties>
<build> <build>
<finalName>skywalking</finalName> <finalName>skywalking</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build> </build>
<dependencies> <dependencies>
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-network</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-logging-api</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.a.eye</groupId>
<artifactId>skywalking-logging-impl-log4j2</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId> <artifactId>spring-webmvc</artifactId>
...@@ -86,16 +87,6 @@ ...@@ -86,16 +87,6 @@
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>5.1.36</version> <version>5.1.36</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>1.1.2</version>
</dependency>
<dependency> <dependency>
<groupId>org.aspectj</groupId> <groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId> <artifactId>aspectjweaver</artifactId>
...@@ -106,12 +97,6 @@ ...@@ -106,12 +97,6 @@
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
<version>2.2.2</version> <version>2.2.2</version>
</dependency> </dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.5.0</version>
</dependency>
<dependency> <dependency>
<groupId>com.zaxxer</groupId> <groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId> <artifactId>HikariCP</artifactId>
......
package com.a.eye.skywalking.web.controller;
import com.a.eye.skywalking.web.dto.LoginUserInfo;
import com.a.eye.skywalking.web.common.BaseController;
import com.a.eye.skywalking.web.dao.inter.IAuthFileMaintainDao;
import com.a.eye.skywalking.web.dao.inter.ISystemConfigMaintainDao;
import com.a.eye.skywalking.web.util.StringUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Map;
import java.util.Properties;
/**
* Created by xin on 16-3-29.
*/
@RequestMapping("/usr/applications/authfile")
@Controller
public class AuthFileController extends BaseController {
private Logger logger = LogManager.getLogger(AuthFileController.class);
@Autowired
private ISystemConfigMaintainDao systemConfigMaintainDao;
@Autowired
private IAuthFileMaintainDao authFileMaintainDao;
@RequestMapping("/todownload/{applicationCode}")
public String toDownloadFile(@PathVariable("applicationCode") String applicationCode, HttpServletRequest request) {
request.setAttribute("applicationId", applicationCode);
return "usr/authfile/download";
}
@RequestMapping("/download/{applicationCode}")
public void exportApplicationAuthFile(HttpServletRequest request, HttpServletResponse response,
@PathVariable("applicationCode") String applicationCode, String authType) throws Exception {
if (StringUtil.isBlank(applicationCode)) {
return;
}
LoginUserInfo loginUserInfo = fetchLoginUserInfoFromSession(request);
String filepath = "sky-walking.auth";
response.reset();
response.setContentType("application/octet-stream");
String fileName = URLDecoder.decode(filepath, "utf-8");
java.net.URLEncoder.encode(fileName, "utf-8");
response.addHeader("Content-Disposition",
"attachment;" + "filename=\"" + URLEncoder.encode(fileName, "utf-8") + "\"");
Properties properties = authFileMaintainDao.queryAuthKeysToProperties(authType);
String propertyValue;
for (Map.Entry<Object, Object> value : properties.entrySet()) {
propertyValue = String.valueOf(value.getValue());
if (propertyValue.startsWith("#")) {
logger.info("{}", propertyValue.substring(1));
value.setValue(systemConfigMaintainDao.querySystemConfigByKey(propertyValue.substring(1)).getConfValue());
continue;
}
if (propertyValue.startsWith("$")) {
if (request.getParameter((propertyValue.substring(1))) != null) {
value.setValue(request.getParameter(propertyValue.substring(1)));
}
}
}
properties.setProperty("skywalking.user_id", loginUserInfo.getUid());
properties.setProperty("skywalking.application_code", applicationCode);
File file = new File(request.getServletContext().getRealPath("/") + File.separator + "download" + File.separator + fileName);
file.delete();
FileOutputStream stream = new FileOutputStream(file);
properties.store(stream, "");
stream.flush();
stream.close();
FileInputStream inputStream = new FileInputStream(file);
BufferedOutputStream output = null;
BufferedInputStream input = null;
OutputStream os = null;
try {
os = response.getOutputStream();
byte[] bytes = new byte[1024];
while ((inputStream.read(bytes)) != -1) {
os.write(bytes);
}
} catch (Exception e) {
logger.error("Failed to download the auth file.", e);
} finally {
os.flush();
os.close();
inputStream.close();
if (input != null) {
input.close();
}
if (output != null) {
output.close();
}
}
return;
}
}
package com.a.eye.skywalking.web.dao.impl;
import com.a.eye.skywalking.web.dao.inter.IAuthFileMaintainDao;
import com.a.eye.skywalking.web.util.DBConnectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;
@Repository
public class AuthFileMaintainDao implements IAuthFileMaintainDao {
@Autowired
private DBConnectUtil dbConnectUtil;
@Override
public Properties queryAuthKeysToProperties(String authType) throws SQLException {
final Properties properties = new Properties();
String sql = "select auth_file_config.key, auth_file_config.value" + authType + " from auth_file_config where auth_file_config.sts = ? ";
Connection connection = dbConnectUtil.getConnection();
try {
PreparedStatement preparedStatement = connection.prepareStatement(sql);
preparedStatement.setString(1, "A");
ResultSet resultSet = preparedStatement.executeQuery();
while (resultSet.next()) {
properties.setProperty(resultSet.getString("key"), resultSet.getString("value" + authType));
}
} catch (Exception e) {
throw new RuntimeException("Failed to query auth key by authType[" + authType + "]", e);
} finally {
if (connection != null)
connection.close();
}
return properties;
}
}
package com.a.eye.skywalking.web.dao.inter;
import java.sql.SQLException;
import java.util.Properties;
/**
* Created by xin on 16-3-29.
*/
public interface IAuthFileMaintainDao {
Properties queryAuthKeysToProperties(String authType) throws SQLException;
}
package com.a.eye.skywalking.web.entity;
/**
* Created by xin on 16-3-29.
*/
public class SystemConfig {
private String configId;
private String confKey;
private String confValue;
private String valueType;
private String valueDesc;
public void setConfigId(String configId) {
this.configId = configId;
}
public String getConfigId() {
return configId;
}
public void setConfKey(String confKey) {
this.confKey = confKey;
}
public String getConfKey() {
return confKey;
}
public void setConfValue(String confValue) {
this.confValue = confValue;
}
public String getConfValue() {
return confValue;
}
public void setValueType(String valueType) {
this.valueType = valueType;
}
public String getValueType() {
return valueType;
}
public void setValueDesc(String valueDesc) {
this.valueDesc = valueDesc;
}
public String getValueDesc() {
return valueDesc;
}
}
package com.a.eye.skywalking.web.util;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;
/**
* Created by xin on 16-3-21.
*/
@Repository
public class HBaseUtils {
@Value("#{configProperties['hbaseconfig.quorum']}")
private String quorum;
@Value("#{configProperties['hbaseconfig.client_port']}")
private String clientPort;
private static Logger logger = LogManager.getLogger(HBaseUtils.class);
private Connection connection = null;
public Connection getConnection() {
if (connection == null) {
try {
Configuration configuration = HBaseConfiguration.create();
configuration.set("hbase.zookeeper.quorum", quorum);
configuration.set("hbase.zookeeper.property.clientPort", clientPort);
connection = ConnectionFactory.createConnection(configuration);
} catch (Exception e) {
logger.error("Create table[{}] failed", "connection hbase fail", e);
throw new RuntimeException("Fatal error");
}
}
return connection;
}
}
hbaseconfig.quorum=10.1.241.18,10.1.241.19,10.1.241.20
hbaseconfig.client_port=29181
jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://10.1.241.20:31306/sw_db jdbc.url=jdbc:mysql://10.1.241.20:31306/sw_db
jdbc.username=sw_dbusr01 jdbc.username=sw_dbusr
jdbc.password=sw_dbusr01 jdbc.password=sw_dbusr
jdbc.maxTotal=200 jdbc.maxTotal=200
jdbc.maxIdle=50 jdbc.maxIdle=50
jdbc.maxWaitMillis=1000 jdbc.maxWaitMillis=1000
......
...@@ -196,76 +196,9 @@ SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; ...@@ -196,76 +196,9 @@ SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
CREATE TABLE `auth_file_config` (
`config_id` INT(11) NOT NULL,
`key` VARCHAR(200) NOT NULL,
`value0` VARCHAR(200) NULL,
`value1` VARCHAR(200) NULL DEFAULT NULL,
`value2` VARCHAR(200) NULL DEFAULT NULL,
`value3` VARCHAR(200) NULL DEFAULT NULL,
`value4` VARCHAR(200) NULL DEFAULT NULL,
`key_desc` VARCHAR(500) NULL,
`sts` VARCHAR(2) NULL,
PRIMARY KEY (`config_id`));
CREATE TABLE `sw_chain_info` (
`id` INT NOT NULL AUTO_INCREMENT,
`viewpoint` VARCHAR(1024) NULL,
`cid` VARCHAR(32) NULL,
`uid` VARCHAR(32) NULL,
`parentLevelId` VARCHAR(32) NULL,
`levelId` INT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `id_UNIQUE` (`id` ASC));
# 请参考文档和环境进行修改
INSERT INTO `system_config` (`config_id`,`conf_key`,`conf_value`,`val_type`,`val_desc`,`create_time`,`sts`,`modify_time`) VALUES (1000,'mail_info','{\"mail.host\":\"mail.asiainfo.com\",\"mail.transport.protocol\":\"smtp\",\"mail.smtp.auth\":\"true\",\"mail.smtp.starttls.enable\":\"false\",\"mail.username\":\"testA\",\"mail.password\":\"******\",\"mail.sender\":\"mailSender@asiainfo.com\"}','json','默认邮件发送人信息','2015-12-10 11:54:06','A','2015-12-10 11:54:06');
INSERT INTO `system_config` (`config_id`,`conf_key`,`conf_value`,`val_type`,`val_desc`,`create_time`,`sts`,`modify_time`) VALUES (1001,'portal_addr','http://10.1.235.197:48080/skywalking/','string','默认门户地址','2015-12-10 15:23:53','A','2015-12-10 15:23:53');
INSERT INTO `system_config` (`config_id`,`conf_key`,`conf_value`,`val_type`,`val_desc`,`create_time`,`sts`,`modify_time`) VALUES (1002,'servers_addr','10.1.235.197:34000;10.1.235.197:35000;','string','日志采集地址','2015-12-10 15:23:53','A','2015-12-10 15:23:53');
INSERT INTO `system_config` (`config_id`,`conf_key`,`conf_value`,`val_type`,`val_desc`,`create_time`,`sts`,`modify_time`) VALUES (1003,'servers_addr_1','XXX.XXX.XXX.XXX:34000;','string','日志采集地址-外网','2015-12-10 15:23:53','A','2015-12-10 15:23:53');
INSERT INTO `system_config` (`config_id`,`conf_key`,`conf_value`,`val_type`,`val_desc`,`create_time`,`sts`,`modify_time`) VALUES ('1004', 'alarm_type_info', '[{"type":"default","label":"exception","desc":"System Exception"},{"type":"ExecuteTime-PossibleError","label":"remark","desc":"Excution Time > 5s"},{"type":"ExecuteTime-Warning","label":"remark","desc":"Excution Time > 500ms"}]', 'json', '告警类型', '2016-04-18 16:04:51', 'A', '2016-04-18 16:04:53');
# init default value of auth_file_config
INSERT INTO `auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('1', 'buriedpoint.printf', 'false', 'false', '是否打印数据', 'A');
INSERT INTO `auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('2', 'buriedpoint.max_exception_stack_length', '4000', '4000', '埋点异常的最大长度', 'A');
INSERT INTO `auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('3', 'buriedpoint.businesskey_max_length', '300', '300', '业务字段的最大长度', 'A');
INSERT INTO `auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('4', 'buriedpoint.exclusive_exceptions', '$exclusiveException', '$exclusiveException', '过滤异常', 'A');
INSERT INTO `auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('5', 'sender.connect_percent', '100', '100', '最大发送者的连接数阀比例', 'A');
INSERT INTO `auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('6', 'sender.servers_addr', '#servers_addr', '#servers_addr_1', '发送服务端配置', 'A');
INSERT INTO `auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('7', 'sender.max_copy_num', '2', '2', '最大发送的副本数量', 'A');
INSERT INTO `auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('8', 'sender.max_send_length', '20000', '20000', '发送的最大长度', 'A');
INSERT INTO `auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('9', 'sender.retry_get_sender_wait_interval', '2000', '2000', '当没有Sender时,尝试获取sender的等待周期', 'A');
INSERT INTO `auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('10', 'consumer.max_consumer', '2', '2', '最大消费线程数', 'A');
INSERT INTO `auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('11', 'consumer.max_wait_time', '5', '5', '消费者最大等待时间', 'A');
INSERT INTO `auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('12', 'consumer.consumer_fail_retry_wait_interval', '50', '50', '发送失败等待时间 ', 'A');
INSERT INTO `auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('13', 'buffer.buffer_max_size', '18000', '18000', '每个Buffer的最大个数', 'A');
INSERT INTO `auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('14', 'buffer.pool_size', '5', '5', 'Buffer池的最大长度', 'A');
INSERT INTO `auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('15', 'senderchecker.check_polling_time', '200', '200', '发送检查线程检查周期', 'A');
INSERT INTO `auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('16', 'skywalking.charset', 'UTF-8', 'UTF-8', 'skywalking数据编码', 'A');
INSERT INTO `auth_file_config` (`config_id`,`key`,`value0`,`value1`,`value2`,`value3`,`value4`,`key_desc`,`sts`) VALUES ('17','plugin.customlocalmethodinterceptorplugin.is_enable','false','false',NULL,NULL,NULL,'自定义本地方法插件是否开启','A');
INSERT INTO `auth_file_config` (`config_id`,`key`,`value0`,`value1`,`value2`,`value3`,`value4`,`key_desc`,`sts`) VALUES ('18','plugin.customlocalmethodinterceptorplugin.package_prefix','','',NULL,NULL,NULL,'自定义插件拦截的包前缀','A');
INSERT INTO `auth_file_config` (`config_id`,`key`,`value0`,`value1`,`value2`,`value3`,`value4`,`key_desc`,`sts`) VALUES ('19','plugin.customlocalmethodinterceptorplugin.record_param_enable','false','false',NULL,NULL,NULL,'自定义插件是否记录入参',NULL);
# alter table since 2016-4-8 # alter table since 2016-4-8
ALTER TABLE `application_info` ALTER TABLE `application_info`
ADD COLUMN `update_time` DATETIME NULL AFTER `sts`, ADD COLUMN `update_time` DATETIME NULL AFTER `sts`,
ADD COLUMN `app_desc` VARCHAR(1024) NULL AFTER `update_time`; ADD COLUMN `app_desc` VARCHAR(1024) NULL AFTER `update_time`;
# alter table since 2016-5-26
# 新增sw_chain_detail,用于调用链分析表
-- -----------------------------------------------------
-- Table `sw_chain_detail`
-- -----------------------------------------------------
CREATE TABLE `sw_chain_detail` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`viewpoint` varchar(8192) COLLATE utf8_bin DEFAULT NULL,
`treeId` varchar(40) COLLATE utf8_bin DEFAULT NULL,
`uid` varchar(32) COLLATE utf8_bin DEFAULT NULL,
`traceLevelId` varchar(32) COLLATE utf8_bin DEFAULT NULL,
`create_time` timestamp NULL DEFAULT NULL,
`update_time` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8146 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册