Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Eolink
goku-api-gateway
提交
2e19c8cd
G
goku-api-gateway
项目概览
Eolink
/
goku-api-gateway
上一次同步 1 年多
通知
133
Star
2992
Fork
611
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
goku-api-gateway
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
未验证
提交
2e19c8cd
编写于
11月 06, 2019
作者:
E
Eolink
提交者:
GitHub
11月 06, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #32 from Dot-Liu/master
修改初始化sql
上级
9cc56884
45939d7f
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
252 addition
and
283 deletion
+252
-283
build/console/resources/sql/goku_ce.sql
build/console/resources/sql/goku_ce.sql
+236
-267
goku-service/application/request.go
goku-service/application/request.go
+9
-7
node/gateway/http.go
node/gateway/http.go
+7
-9
未找到文件。
build/console/resources/sql/goku_ce.sql
浏览文件 @
2e19c8cd
...
...
@@ -185,7 +185,7 @@ CREATE TABLE "goku_gateway_api" (
"protocol"
text
(
20
),
"stripSlash"
text
(
32
),
"apiType"
integer
NOT
NULL
DEFAULT
0
,
"responseDataType"
text
NOT
NULL
DEFAULT
'origin'
,
"responseDataType"
text
NOT
NULL
DEFAULT
origin
,
"linkApis"
TEXT
,
"staticResponse"
TEXT
);
...
...
@@ -319,27 +319,22 @@ CREATE TABLE "goku_node_group" (
DROP
TABLE
IF
EXISTS
"goku_node_info"
;
CREATE
TABLE
"goku_node_info"
(
"nodeID"
integer
NOT
NULL
PRIMARY
KEY
AUTOINCREMENT
,
"nodeIP"
text
(
255
)
NOT
NULL
,
"updateStatus"
integer
(
4
)
NOT
NULL
DEFAULT
0
,
"createTime"
text
,
"updateTime"
text
,
"groupID"
integer
(
11
)
NOT
NULL
DEFAULT
0
,
"nodeName"
text
(
255
)
NOT
NULL
,
"nodePort"
text
(
255
),
"nodeStatus"
integer
(
11
)
NOT
NULL
,
"version"
text
(
255
),
"sshAddress
"
text
(
255
)
DEFAULT
22
,
"sshU
serName"
text
(
255
),
"sshP
assword"
text
(
255
),
"sshPort
"
text
(
255
)
DEFAULT
22
,
"u
serName"
text
(
255
),
"p
assword"
text
(
255
),
"gatewayPath"
text
(
255
),
"sshK
ey"
text
,
"k
ey"
text
,
"authMethod"
integer
(
4
)
NOT
NULL
DEFAULT
0
,
"clusterID"
integer
(
11
)
NOT
NULL
DEFAULT
0
,
"listenAddress"
text
(
22
)
NOT
NULL
DEFAULT
''
,
"adminAddress"
text
(
22
)
NOT
NULL
DEFAULT
''
,
"nodeKey"
TEXT
(
32
)
NOT
NULL
DEFAULT
''
);
CREATE
UNIQUE
INDEX
"nodeKey_new"
ON
"goku_node_info_new"
(
"nodeKey"
ASC
"clusterID"
integer
(
11
)
NOT
NULL
DEFAULT
0
);
-- ----------------------------
...
...
@@ -409,32 +404,6 @@ CREATE TABLE "goku_table_update_record" (
"tableID"
integer
NOT
NULL
PRIMARY
KEY
AUTOINCREMENT
);
CREATE
TABLE
"goku_table_version"
(
"tableID"
INTEGER
NOT
NULL
PRIMARY
KEY
AUTOINCREMENT
,
"tableName"
TEXT
NOT
NULL
,
"version"
TEXT
NOT
NULL
);
CREATE
UNIQUE
INDEX
"tableName"
ON
"goku_table_version"
(
"tableName"
);
INSERT
INTO
"goku_table_version"
(
"tableName"
,
"version"
)
VALUES
(
'goku_node_info'
,
"3.1.1"
);
INSERT
INTO
"goku_table_version"
(
"tableName"
,
"version"
)
VALUES
(
'goku_monitor_module'
,
"3.1.1"
);
CREATE
TABLE
"goku_monitor_module"
(
"id"
INTEGER
NOT
NULL
PRIMARY
KEY
AUTOINCREMENT
,
"name"
TEXT
NOT
NULL
,
"config"
TEXT
NOT
NULL
,
"moduleStatus"
integer
NOT
NULL
DEFAULT
0
);
CREATE
UNIQUE
INDEX
"moduleName"
ON
"goku_monitor_module"
(
"name"
ASC
);
-- ----------------------------
-- Records of "sqlite_sequence"
...
...
@@ -458,17 +427,17 @@ UPDATE "sqlite_sequence" SET seq = 1 WHERE name = 'goku_admin';
-- Indexes structure for table goku_balance
-- ----------------------------
CREATE
INDEX
"balanceName"
ON
"goku_balance"
(
ON
"goku_balance"
(
"balanceName"
ASC
);
);
-- ----------------------------
-- Indexes structure for table goku_cluster
-- ----------------------------
CREATE
INDEX
"name"
ON
"goku_cluster"
(
ON
"goku_cluster"
(
"name"
ASC
);
);
-- ----------------------------
-- Auto increment value for goku_config_log
...
...
goku-service/application/request.go
浏览文件 @
2e19c8cd
...
...
@@ -3,12 +3,14 @@ package application
import
(
"bytes"
"errors"
"github.com/eolinker/goku-api-gateway/diting"
goku_labels
"github.com/eolinker/goku-api-gateway/goku-labels"
"github.com/eolinker/goku-api-gateway/node/monitor"
"io"
"net/http"
"net/url"
"github.com/eolinker/goku-api-gateway/diting"
goku_labels
"github.com/eolinker/goku-api-gateway/goku-labels"
"github.com/eolinker/goku-api-gateway/node/monitor"
// "fmt"
"time"
)
...
...
@@ -99,16 +101,16 @@ func (r *Request) Send() (*http.Response, error) {
if
err
!=
nil
{
return
nil
,
err
}
start
:=
time
.
Now
()
start
:=
time
.
Now
()
defer
func
()
{
delay
:=
time
.
Since
(
start
)
labels
:=
make
(
diting
.
Labels
)
delay
:=
time
.
Since
(
start
)
labels
:=
make
(
diting
.
Labels
)
labels
[
goku_labels
.
Proto
]
=
req
.
Proto
labels
[
goku_labels
.
Host
]
=
req
.
Host
labels
[
goku_labels
.
Path
]
=
req
.
URL
.
Path
labels
[
goku_labels
.
Method
]
=
req
.
Method
monitor
.
ProxyMonitor
.
Observe
(
float64
(
delay
.
Milliseconds
()),
labels
)
monitor
.
ProxyMonitor
.
Observe
(
float64
(
delay
/
time
.
Millisecond
),
labels
)
}()
req
.
Header
.
Set
(
"Accept-Encoding"
,
"gzip"
)
req
.
Header
=
parseHeaders
(
r
.
headers
)
...
...
node/gateway/http.go
浏览文件 @
2e19c8cd
...
...
@@ -2,13 +2,14 @@ package gateway
import
(
"fmt"
"github.com/eolinker/goku-api-gateway/diting"
goku_labels
"github.com/eolinker/goku-api-gateway/goku-labels"
"github.com/eolinker/goku-api-gateway/node/monitor"
"net/http"
"strconv"
"time"
"github.com/eolinker/goku-api-gateway/diting"
goku_labels
"github.com/eolinker/goku-api-gateway/goku-labels"
"github.com/eolinker/goku-api-gateway/node/monitor"
log
"github.com/eolinker/goku-api-gateway/goku-log"
access_log
"github.com/eolinker/goku-api-gateway/goku-node/access-log"
"github.com/eolinker/goku-api-gateway/goku-node/common"
...
...
@@ -53,7 +54,7 @@ func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
n
,
status
:=
ctx
.
Finish
()
delay
:=
time
.
Since
(
timeStart
)
delay
:=
time
.
Since
(
timeStart
)
ctx
.
LogFields
[
fields
.
RequestID
]
=
requestID
ctx
.
LogFields
[
fields
.
StatusCode
]
=
status
...
...
@@ -66,15 +67,12 @@ func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
access_log
.
Log
(
ctx
.
LogFields
)
log
.
WithFields
(
ctx
.
LogFields
)
.
Info
()
// 监控计数
labels
:=
make
(
diting
.
Labels
)
labels
:=
make
(
diting
.
Labels
)
labels
[
goku_labels
.
API
]
=
strconv
.
Itoa
(
ctx
.
ApiID
())
labels
[
goku_labels
.
Strategy
]
=
ctx
.
StrategyId
()
labels
[
goku_labels
.
Status
]
=
strconv
.
Itoa
(
status
)
monitor
.
APIMonitor
.
Observe
(
float64
(
delay
.
Milliseconds
()),
labels
)
monitor
.
APIMonitor
.
Observe
(
float64
(
delay
/
time
.
Millisecond
),
labels
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录