Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
润土的好友猹
SkyWalking
提交
bd9d21fc
S
SkyWalking
项目概览
润土的好友猹
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bd9d21fc
编写于
10月 29, 2017
作者:
P
peng-yongsheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The handler in UI module with jetty server start successful.
上级
cf544f44
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
144 addition
and
9 deletion
+144
-9
apm-collector/apm-collector-boot/src/main/java/org/skywalking/apm/collector/boot/CollectorBootStartUp.java
...g/skywalking/apm/collector/boot/CollectorBootStartUp.java
+1
-1
apm-collector/apm-collector-grpc-manager/collector-grpc-manager-provider/src/main/java/org/skywalking/apm/collector/grpc/manager/GRPCManagerProvider.java
...lking/apm/collector/grpc/manager/GRPCManagerProvider.java
+18
-2
apm-collector/apm-collector-grpc-manager/collector-grpc-manager-provider/src/main/java/org/skywalking/apm/collector/grpc/manager/service/GRPCManagerServiceImpl.java
...ollector/grpc/manager/service/GRPCManagerServiceImpl.java
+15
-2
apm-collector/apm-collector-jetty-manager/collector-jetty-manager-provider/src/main/java/org/skywalking/apm/collector/jetty/manager/JettyManagerProvider.java
...ing/apm/collector/jetty/manager/JettyManagerProvider.java
+18
-2
apm-collector/apm-collector-jetty-manager/collector-jetty-manager-provider/src/main/java/org/skywalking/apm/collector/jetty/manager/service/JettyManagerServiceImpl.java
...lector/jetty/manager/service/JettyManagerServiceImpl.java
+15
-2
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/skywalking/apm/collector/ui/jetty/UIModuleJettyProvider.java
...walking/apm/collector/ui/jetty/UIModuleJettyProvider.java
+2
-0
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/application/ApplicationsGetHandler.java
.../ui/jetty/handler/application/ApplicationsGetHandler.java
+75
-0
未找到文件。
apm-collector/apm-collector-boot/src/main/java/org/skywalking/apm/collector/boot/CollectorBootStartUp.java
浏览文件 @
bd9d21fc
...
...
@@ -52,7 +52,7 @@ public class CollectorBootStartUp {
}
try
{
Thread
.
sleep
(
1
0000
);
Thread
.
sleep
(
6
0000
);
}
catch
(
InterruptedException
e
)
{
}
}
...
...
apm-collector/apm-collector-grpc-manager/collector-grpc-manager-provider/src/main/java/org/skywalking/apm/collector/grpc/manager/GRPCManagerProvider.java
浏览文件 @
bd9d21fc
...
...
@@ -18,18 +18,28 @@
package
org.skywalking.apm.collector.grpc.manager
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Properties
;
import
org.skywalking.apm.collector.core.module.Module
;
import
org.skywalking.apm.collector.core.module.ModuleProvider
;
import
org.skywalking.apm.collector.core.module.ServiceNotProvidedException
;
import
org.skywalking.apm.collector.grpc.manager.service.GRPCManagerService
;
import
org.skywalking.apm.collector.grpc.manager.service.GRPCManagerServiceImpl
;
import
org.skywalking.apm.collector.server.ServerException
;
import
org.skywalking.apm.collector.server.grpc.GRPCServer
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author peng-yongsheng
*/
public
class
GRPCManagerProvider
extends
ModuleProvider
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
GRPCManagerProvider
.
class
);
private
Map
<
String
,
GRPCServer
>
servers
=
new
HashMap
<>();
@Override
public
String
name
()
{
return
"gRPC"
;
}
...
...
@@ -39,7 +49,7 @@ public class GRPCManagerProvider extends ModuleProvider {
}
@Override
public
void
prepare
(
Properties
config
)
throws
ServiceNotProvidedException
{
this
.
registerServiceImplementation
(
GRPCManagerService
.
class
,
new
GRPCManagerServiceImpl
());
this
.
registerServiceImplementation
(
GRPCManagerService
.
class
,
new
GRPCManagerServiceImpl
(
servers
));
}
@Override
public
void
start
(
Properties
config
)
throws
ServiceNotProvidedException
{
...
...
@@ -47,7 +57,13 @@ public class GRPCManagerProvider extends ModuleProvider {
}
@Override
public
void
notifyAfterCompleted
()
throws
ServiceNotProvidedException
{
servers
.
values
().
forEach
(
server
->
{
try
{
server
.
start
();
}
catch
(
ServerException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
});
}
@Override
public
String
[]
requiredModules
()
{
...
...
apm-collector/apm-collector-grpc-manager/collector-grpc-manager-provider/src/main/java/org/skywalking/apm/collector/grpc/manager/service/GRPCManagerServiceImpl.java
浏览文件 @
bd9d21fc
...
...
@@ -18,17 +18,25 @@
package
org.skywalking.apm.collector.grpc.manager.service
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.skywalking.apm.collector.server.Server
;
import
org.skywalking.apm.collector.server.ServerException
;
import
org.skywalking.apm.collector.server.grpc.GRPCServer
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author peng-yongsheng
*/
public
class
GRPCManagerServiceImpl
implements
GRPCManagerService
{
private
Map
<
String
,
GRPCServer
>
servers
=
new
HashMap
<>();
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
GRPCManagerServiceImpl
.
class
);
private
final
Map
<
String
,
GRPCServer
>
servers
;
public
GRPCManagerServiceImpl
(
Map
<
String
,
GRPCServer
>
servers
)
{
this
.
servers
=
servers
;
}
@Override
public
Server
getElseCreateServer
(
String
host
,
int
port
)
{
String
id
=
host
+
String
.
valueOf
(
port
);
...
...
@@ -36,6 +44,11 @@ public class GRPCManagerServiceImpl implements GRPCManagerService {
return
servers
.
get
(
id
);
}
else
{
GRPCServer
server
=
new
GRPCServer
(
host
,
port
);
try
{
server
.
initialize
();
}
catch
(
ServerException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
servers
.
put
(
id
,
server
);
return
server
;
}
...
...
apm-collector/apm-collector-jetty-manager/collector-jetty-manager-provider/src/main/java/org/skywalking/apm/collector/jetty/manager/JettyManagerProvider.java
浏览文件 @
bd9d21fc
...
...
@@ -18,18 +18,28 @@
package
org.skywalking.apm.collector.jetty.manager
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Properties
;
import
org.skywalking.apm.collector.core.module.Module
;
import
org.skywalking.apm.collector.core.module.ModuleProvider
;
import
org.skywalking.apm.collector.core.module.ServiceNotProvidedException
;
import
org.skywalking.apm.collector.jetty.manager.service.JettyManagerService
;
import
org.skywalking.apm.collector.jetty.manager.service.JettyManagerServiceImpl
;
import
org.skywalking.apm.collector.server.ServerException
;
import
org.skywalking.apm.collector.server.jetty.JettyServer
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author peng-yongsheng
*/
public
class
JettyManagerProvider
extends
ModuleProvider
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
JettyManagerProvider
.
class
);
private
Map
<
String
,
JettyServer
>
servers
=
new
HashMap
<>();
@Override
public
String
name
()
{
return
"jetty"
;
}
...
...
@@ -39,7 +49,7 @@ public class JettyManagerProvider extends ModuleProvider {
}
@Override
public
void
prepare
(
Properties
config
)
throws
ServiceNotProvidedException
{
this
.
registerServiceImplementation
(
JettyManagerService
.
class
,
new
JettyManagerServiceImpl
());
this
.
registerServiceImplementation
(
JettyManagerService
.
class
,
new
JettyManagerServiceImpl
(
servers
));
}
@Override
public
void
start
(
Properties
config
)
throws
ServiceNotProvidedException
{
...
...
@@ -47,7 +57,13 @@ public class JettyManagerProvider extends ModuleProvider {
}
@Override
public
void
notifyAfterCompleted
()
throws
ServiceNotProvidedException
{
servers
.
values
().
forEach
(
server
->
{
try
{
server
.
start
();
}
catch
(
ServerException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
});
}
@Override
public
String
[]
requiredModules
()
{
...
...
apm-collector/apm-collector-jetty-manager/collector-jetty-manager-provider/src/main/java/org/skywalking/apm/collector/jetty/manager/service/JettyManagerServiceImpl.java
浏览文件 @
bd9d21fc
...
...
@@ -18,17 +18,25 @@
package
org.skywalking.apm.collector.jetty.manager.service
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.skywalking.apm.collector.server.Server
;
import
org.skywalking.apm.collector.server.ServerException
;
import
org.skywalking.apm.collector.server.jetty.JettyServer
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author peng-yongsheng
*/
public
class
JettyManagerServiceImpl
implements
JettyManagerService
{
private
Map
<
String
,
JettyServer
>
servers
=
new
HashMap
<>();
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
JettyManagerServiceImpl
.
class
);
private
final
Map
<
String
,
JettyServer
>
servers
;
public
JettyManagerServiceImpl
(
Map
<
String
,
JettyServer
>
servers
)
{
this
.
servers
=
servers
;
}
@Override
public
Server
getElseCreateServer
(
String
host
,
int
port
,
String
contextPath
)
{
String
id
=
host
+
String
.
valueOf
(
port
);
...
...
@@ -36,6 +44,11 @@ public class JettyManagerServiceImpl implements JettyManagerService {
return
servers
.
get
(
id
);
}
else
{
JettyServer
server
=
new
JettyServer
(
host
,
port
,
contextPath
);
try
{
server
.
initialize
();
}
catch
(
ServerException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
servers
.
put
(
id
,
server
);
return
server
;
}
...
...
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/skywalking/apm/collector/ui/jetty/UIModuleJettyProvider.java
浏览文件 @
bd9d21fc
...
...
@@ -29,6 +29,7 @@ import org.skywalking.apm.collector.jetty.manager.JettyManagerModule;
import
org.skywalking.apm.collector.jetty.manager.service.JettyManagerService
;
import
org.skywalking.apm.collector.server.Server
;
import
org.skywalking.apm.collector.ui.UIModule
;
import
org.skywalking.apm.collector.ui.jetty.handler.application.ApplicationsGetHandler
;
/**
* @author peng-yongsheng
...
...
@@ -57,6 +58,7 @@ public class UIModuleJettyProvider extends ModuleProvider {
try
{
JettyManagerService
managerService
=
getManager
().
find
(
JettyManagerModule
.
NAME
).
getService
(
JettyManagerService
.
class
);
Server
jettyServer
=
managerService
.
getElseCreateServer
(
host
,
port
,
contextPath
);
jettyServer
.
addHandler
(
new
ApplicationsGetHandler
());
ModuleRegisterService
moduleRegisterService
=
getManager
().
find
(
ClusterModule
.
NAME
).
getService
(
ModuleRegisterService
.
class
);
moduleRegisterService
.
register
(
UIModule
.
NAME
,
this
.
name
(),
new
UIModuleRegistration
(
host
,
port
,
contextPath
));
...
...
apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/application/ApplicationsGetHandler.java
0 → 100644
浏览文件 @
bd9d21fc
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.ui.jetty.handler.application
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonObject
;
import
javax.servlet.http.HttpServletRequest
;
import
org.skywalking.apm.collector.server.jetty.ArgumentsParseException
;
import
org.skywalking.apm.collector.server.jetty.JettyHandler
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author peng-yongsheng
*/
public
class
ApplicationsGetHandler
extends
JettyHandler
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ApplicationsGetHandler
.
class
);
@Override
public
String
pathSpec
()
{
return
"/applications"
;
}
// private ApplicationService service = new ApplicationService();
@Override
protected
JsonElement
doGet
(
HttpServletRequest
req
)
throws
ArgumentsParseException
{
if
(!
req
.
getParameterMap
().
containsKey
(
"startTime"
)
||
!
req
.
getParameterMap
().
containsKey
(
"endTime"
))
{
throw
new
ArgumentsParseException
(
"must contains startTime. endTime parameter"
);
}
String
startTimeStr
=
req
.
getParameter
(
"startTime"
);
String
endTimeStr
=
req
.
getParameter
(
"endTime"
);
logger
.
debug
(
"applications get start time: {}, end time: {}"
,
startTimeStr
,
endTimeStr
);
long
startTime
;
try
{
startTime
=
Long
.
parseLong
(
startTimeStr
);
}
catch
(
NumberFormatException
e
)
{
throw
new
ArgumentsParseException
(
"start time must be long"
);
}
long
endTime
;
try
{
endTime
=
Long
.
parseLong
(
endTimeStr
);
}
catch
(
NumberFormatException
e
)
{
throw
new
ArgumentsParseException
(
"end time must be long"
);
}
// return service.getApplications(startTime, endTime);
JsonObject
result
=
new
JsonObject
();
result
.
addProperty
(
"result"
,
"Yes"
);
return
result
;
}
@Override
protected
JsonElement
doPost
(
HttpServletRequest
req
)
throws
ArgumentsParseException
{
throw
new
UnsupportedOperationException
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录