Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
7c173acc
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
7c173acc
编写于
8月 05, 2021
作者:
X
Xin.Zh
提交者:
GitHub
8月 05, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add license header (#7197)
上级
6d9c6d3b
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
379 addition
and
33 deletion
+379
-33
alert/app/app.go
alert/app/app.go
+15
-0
alert/app/expr/expr.go
alert/app/expr/expr.go
+15
-0
alert/app/expr/expr_test.go
alert/app/expr/expr_test.go
+15
-0
alert/app/expr/funcs.go
alert/app/expr/funcs.go
+15
-0
alert/app/expr/funcs_test.go
alert/app/expr/funcs_test.go
+15
-0
alert/app/route.go
alert/app/route.go
+15
-0
alert/app/rule.go
alert/app/rule.go
+15
-0
alert/app/rule_test.go
alert/app/rule_test.go
+15
-0
alert/cmd/alert/main.go
alert/cmd/alert/main.go
+15
-0
alert/models/models.go
alert/models/models.go
+15
-0
alert/models/rule.go
alert/models/rule.go
+15
-0
alert/utils/config.go
alert/utils/config.go
+15
-0
alert/utils/log/log.go
alert/utils/log/log.go
+15
-0
importSampleData/app/main.go
importSampleData/app/main.go
+15
-0
importSampleData/import/import_config.go
importSampleData/import/import_config.go
+15
-0
src/connector/odbc/examples/go/odbc.go
src/connector/odbc/examples/go/odbc.go
+15
-0
tests/comparisonTest/influxdb/main.go
tests/comparisonTest/influxdb/main.go
+15
-0
tests/gotest/case001/case001.go
tests/gotest/case001/case001.go
+1
-0
tests/script/general/http/bug.go
tests/script/general/http/bug.go
+25
-10
tests/script/general/http/httpTestNew.go
tests/script/general/http/httpTestNew.go
+15
-0
tests/script/general/http/httpTest_cloud.go
tests/script/general/http/httpTest_cloud.go
+19
-4
tests/script/general/http/httpTest_private.go
tests/script/general/http/httpTest_private.go
+20
-5
tests/script/general/http/telegrafTest.go
tests/script/general/http/telegrafTest.go
+29
-14
tests/stress/main.go
tests/stress/main.go
+15
-0
未找到文件。
alert/app/app.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
app
package
app
import
(
import
(
...
...
alert/app/expr/expr.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
expr
package
expr
import
(
import
(
...
...
alert/app/expr/expr_test.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
expr
package
expr
import
"testing"
import
"testing"
...
...
alert/app/expr/funcs.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
expr
package
expr
import
(
import
(
...
...
alert/app/expr/funcs_test.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
expr
package
expr
import
(
import
(
...
...
alert/app/route.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
app
package
app
import
(
import
(
...
...
alert/app/rule.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
app
package
app
import
(
import
(
...
...
alert/app/rule_test.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
app
package
app
import
(
import
(
...
...
alert/cmd/alert/main.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
main
package
main
import
(
import
(
...
...
alert/models/models.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
models
package
models
import
(
import
(
...
...
alert/models/rule.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
models
package
models
import
"time"
import
"time"
...
...
alert/utils/config.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
utils
package
utils
import
(
import
(
...
...
alert/utils/log/log.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
log
package
log
import
(
import
(
...
...
importSampleData/app/main.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
main
package
main
import
(
import
(
...
...
importSampleData/import/import_config.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
dataimport
package
dataimport
import
(
import
(
...
...
src/connector/odbc/examples/go/odbc.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
main
package
main
import
(
import
(
...
...
tests/comparisonTest/influxdb/main.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
main
package
main
import
(
import
(
...
...
tests/gotest/case001/case001.go
浏览文件 @
7c173acc
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
* You should have received a copy of the GNU Affero General Public License
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
package
main
package
main
import
(
import
(
...
...
tests/script/general/http/bug.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
main
package
main
import
(
import
(
...
@@ -184,7 +199,7 @@ func exec(client *http.Client, sql string) {
...
@@ -184,7 +199,7 @@ func exec(client *http.Client, sql string) {
if
(
request
<
103
)
{
if
(
request
<
103
)
{
return
return
}
}
atomic
.
AddInt64
(
&
period
,
spend
)
atomic
.
AddInt64
(
&
period
,
spend
)
if
request
%
5000
==
0
&&
request
!=
0
{
if
request
%
5000
==
0
&&
request
!=
0
{
requestAvg
:=
float64
(
period
)
/
float64
(
1000000
)
/
float64
(
request
)
requestAvg
:=
float64
(
period
)
/
float64
(
1000000
)
/
float64
(
request
)
...
@@ -204,7 +219,7 @@ func insertTable(conn int) {
...
@@ -204,7 +219,7 @@ func insertTable(conn int) {
tbStart
:=
conn
*
config
.
TablePerConn
+
config
.
TableStart
tbStart
:=
conn
*
config
.
TablePerConn
+
config
.
TableStart
tmStart
:=
config
.
DataBegin
tmStart
:=
config
.
DataBegin
for
j
:=
0
;
j
<
config
.
DataNum
;
j
++
{
for
j
:=
0
;
j
<
config
.
DataNum
;
j
++
{
for
i
:=
0
;
i
<
config
.
TablePerConn
;
i
++
{
for
i
:=
0
;
i
<
config
.
TablePerConn
;
i
++
{
tmVal
:=
int64
(
j
)
*
int64
(
config
.
DataInterval
)
+
tmStart
+
1
tmVal
:=
int64
(
j
)
*
int64
(
config
.
DataInterval
)
+
tmStart
+
1
...
@@ -214,7 +229,7 @@ func insertTable(conn int) {
...
@@ -214,7 +229,7 @@ func insertTable(conn int) {
if
config
.
DataRandom
{
if
config
.
DataRandom
{
dataVal
=
rand
.
Intn
(
1000
)
dataVal
=
rand
.
Intn
(
1000
)
}
}
sql
:=
fmt
.
Sprintf
(
"import into %s.%s%d values(%d, %d)"
,
config
.
DbName
,
config
.
TablePrefix
,
tbIndex
,
tmVal
,
dataVal
)
sql
:=
fmt
.
Sprintf
(
"import into %s.%s%d values(%d, %d)"
,
config
.
DbName
,
config
.
TablePrefix
,
tbIndex
,
tmVal
,
dataVal
)
exec
(
client
,
sql
)
exec
(
client
,
sql
)
time
.
Sleep
(
time
.
Millisecond
*
time
.
Duration
(
10
))
time
.
Sleep
(
time
.
Millisecond
*
time
.
Duration
(
10
))
...
@@ -282,7 +297,7 @@ func selectData(wg *sync.WaitGroup, conn int) {
...
@@ -282,7 +297,7 @@ func selectData(wg *sync.WaitGroup, conn int) {
client
:=
&
http
.
Client
{}
client
:=
&
http
.
Client
{}
tbStart
:=
conn
*
config
.
TablePerConn
+
config
.
TableStart
tbStart
:=
conn
*
config
.
TablePerConn
+
config
.
TableStart
for
j
:=
0
;
j
<
config
.
DataNum
;
j
++
{
for
j
:=
0
;
j
<
config
.
DataNum
;
j
++
{
tbIndex
:=
0
+
tbStart
tbIndex
:=
0
+
tbStart
...
@@ -292,10 +307,10 @@ func selectData(wg *sync.WaitGroup, conn int) {
...
@@ -292,10 +307,10 @@ func selectData(wg *sync.WaitGroup, conn int) {
sql
+=
fmt
.
Sprintf
(
",'%s%d'"
,
config
.
TablePrefix
,
tbIndex
)
sql
+=
fmt
.
Sprintf
(
",'%s%d'"
,
config
.
TablePrefix
,
tbIndex
)
}
}
sql
+=
") group by orgno"
sql
+=
") group by orgno"
//sql := fmt.Sprintf("select count(*) from db.mt")
//sql := fmt.Sprintf("select count(*) from db.mt")
//sql := fmt.Sprintf("select max(i),min(i) from db.mt", config.TablePrefix, tbIndex)
//sql := fmt.Sprintf("select max(i),min(i) from db.mt", config.TablePrefix, tbIndex)
exec
(
client
,
sql
)
exec
(
client
,
sql
)
time
.
Sleep
(
time
.
Millisecond
*
time
.
Duration
(
10
))
time
.
Sleep
(
time
.
Millisecond
*
time
.
Duration
(
10
))
}
}
...
@@ -303,17 +318,17 @@ func selectData(wg *sync.WaitGroup, conn int) {
...
@@ -303,17 +318,17 @@ func selectData(wg *sync.WaitGroup, conn int) {
func
main
()
{
func
main
()
{
filename
:=
flag
.
String
(
"config"
,
"taos_cloud.json"
,
"config file name"
)
filename
:=
flag
.
String
(
"config"
,
"taos_cloud.json"
,
"config file name"
)
flag
.
Parse
()
flag
.
Parse
()
readFile
(
*
filename
)
readFile
(
*
filename
)
fmt
.
Println
(
"
\n
================http test start======================"
)
fmt
.
Println
(
"
\n
================http test start======================"
)
var
wg
sync
.
WaitGroup
var
wg
sync
.
WaitGroup
fmt
.
Println
(
"
\n
================select data ========================"
)
fmt
.
Println
(
"
\n
================select data ========================"
)
for
i
:=
0
;
i
<
config
.
ConnNum
;
i
++
{
for
i
:=
0
;
i
<
config
.
ConnNum
;
i
++
{
wg
.
Add
(
1
)
wg
.
Add
(
1
)
...
...
tests/script/general/http/httpTestNew.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
main
package
main
import
(
import
(
...
...
tests/script/general/http/httpTest_cloud.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
main
package
main
import
(
import
(
...
@@ -184,7 +199,7 @@ func exec(client *http.Client, sql string) {
...
@@ -184,7 +199,7 @@ func exec(client *http.Client, sql string) {
if
(
request
<
103
)
{
if
(
request
<
103
)
{
return
return
}
}
atomic
.
AddInt64
(
&
period
,
spend
)
atomic
.
AddInt64
(
&
period
,
spend
)
if
request
%
5000
==
0
&&
request
!=
0
{
if
request
%
5000
==
0
&&
request
!=
0
{
requestAvg
:=
float64
(
period
)
/
float64
(
1000000
)
/
float64
(
request
)
requestAvg
:=
float64
(
period
)
/
float64
(
1000000
)
/
float64
(
request
)
...
@@ -333,11 +348,11 @@ func selectData(wg *sync.WaitGroup, conn int) {
...
@@ -333,11 +348,11 @@ func selectData(wg *sync.WaitGroup, conn int) {
func
main
()
{
func
main
()
{
filename
:=
flag
.
String
(
"config"
,
"taos_cloud.json"
,
"config file name"
)
filename
:=
flag
.
String
(
"config"
,
"taos_cloud.json"
,
"config file name"
)
flag
.
Parse
()
flag
.
Parse
()
readFile
(
*
filename
)
readFile
(
*
filename
)
fmt
.
Println
(
"
\n
================http test start======================"
)
fmt
.
Println
(
"
\n
================http test start======================"
)
var
wg
sync
.
WaitGroup
var
wg
sync
.
WaitGroup
...
...
tests/script/general/http/httpTest_private.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
main
package
main
import
(
import
(
...
@@ -184,7 +199,7 @@ func exec(client *http.Client, sql string) {
...
@@ -184,7 +199,7 @@ func exec(client *http.Client, sql string) {
if
(
request
<
103
)
{
if
(
request
<
103
)
{
return
return
}
}
atomic
.
AddInt64
(
&
period
,
spend
)
atomic
.
AddInt64
(
&
period
,
spend
)
if
request
%
5000
==
0
&&
request
!=
0
{
if
request
%
5000
==
0
&&
request
!=
0
{
requestAvg
:=
float64
(
period
)
/
float64
(
1000000
)
/
float64
(
request
)
requestAvg
:=
float64
(
period
)
/
float64
(
1000000
)
/
float64
(
request
)
...
@@ -256,7 +271,7 @@ func insertTable(conn int) {
...
@@ -256,7 +271,7 @@ func insertTable(conn int) {
sql
+=
fmt
.
Sprintf
(
"(%d, %d)"
,
tmVal
,
dataVal
)
sql
+=
fmt
.
Sprintf
(
"(%d, %d)"
,
tmVal
,
dataVal
)
}
}
exec
(
client
,
sql
)
exec
(
client
,
sql
)
if
config
.
WaitTime
!=
0
{
if
config
.
WaitTime
!=
0
{
time
.
Sleep
(
time
.
Millisecond
*
time
.
Duration
(
config
.
WaitTime
))
time
.
Sleep
(
time
.
Millisecond
*
time
.
Duration
(
config
.
WaitTime
))
...
@@ -333,11 +348,11 @@ func selectData(wg *sync.WaitGroup, conn int) {
...
@@ -333,11 +348,11 @@ func selectData(wg *sync.WaitGroup, conn int) {
func
main
()
{
func
main
()
{
filename
:=
flag
.
String
(
"config"
,
"taos_cloud.json"
,
"config file name"
)
filename
:=
flag
.
String
(
"config"
,
"taos_cloud.json"
,
"config file name"
)
flag
.
Parse
()
flag
.
Parse
()
readFile
(
*
filename
)
readFile
(
*
filename
)
fmt
.
Println
(
"
\n
================http test start======================"
)
fmt
.
Println
(
"
\n
================http test start======================"
)
var
wg
sync
.
WaitGroup
var
wg
sync
.
WaitGroup
...
...
tests/script/general/http/telegrafTest.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
main
package
main
import
(
import
(
...
@@ -68,7 +83,7 @@ func readConf(filename string) {
...
@@ -68,7 +83,7 @@ func readConf(filename string) {
fmt
.
Println
(
"LoopNum:"
,
config
.
LoopNum
)
fmt
.
Println
(
"LoopNum:"
,
config
.
LoopNum
)
fmt
.
Println
(
"dbName:"
,
config
.
DbName
)
fmt
.
Println
(
"dbName:"
,
config
.
DbName
)
fmt
.
Println
(
"dataBegin:"
,
config
.
DataBegin
)
fmt
.
Println
(
"dataBegin:"
,
config
.
DataBegin
)
fmt
.
Println
(
"================http token============================="
)
fmt
.
Println
(
"================http token============================="
)
token
,
err
=
getToken
()
token
,
err
=
getToken
()
url
=
fmt
.
Sprintf
(
"http://%s:%d/telegraf/%s"
,
config
.
HostIp
,
6020
,
config
.
DbName
)
url
=
fmt
.
Sprintf
(
"http://%s:%d/telegraf/%s"
,
config
.
HostIp
,
6020
,
config
.
DbName
)
...
@@ -90,9 +105,9 @@ func readReq(filename string) {
...
@@ -90,9 +105,9 @@ func readReq(filename string) {
defer
file
.
Close
()
defer
file
.
Close
()
data
,
_
:=
ioutil
.
ReadAll
(
file
)
data
,
_
:=
ioutil
.
ReadAll
(
file
)
template
=
string
(
data
[
:
])
template
=
string
(
data
[
:
])
//fmt.Println(template)
//fmt.Println(template)
}
}
...
@@ -154,13 +169,13 @@ func exec(client *http.Client, sql string) {
...
@@ -154,13 +169,13 @@ func exec(client *http.Client, sql string) {
var
jsonResult
JsonResult
var
jsonResult
JsonResult
err
=
json
.
Unmarshal
(
data
,
&
jsonResult
)
err
=
json
.
Unmarshal
(
data
,
&
jsonResult
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
"parse json error: "
,
string
(
data
[
:
]))
fmt
.
Println
(
"parse json error: "
,
string
(
data
[
:
]))
resp
.
Body
.
Close
()
resp
.
Body
.
Close
()
continue
continue
}
}
atomic
.
AddInt64
(
&
request
,
1
)
atomic
.
AddInt64
(
&
request
,
1
)
atomic
.
AddInt64
(
&
period
,
spend
)
atomic
.
AddInt64
(
&
period
,
spend
)
if
request
%
1000
==
0
&&
request
!=
0
{
if
request
%
1000
==
0
&&
request
!=
0
{
...
@@ -179,16 +194,16 @@ func exec(client *http.Client, sql string) {
...
@@ -179,16 +194,16 @@ func exec(client *http.Client, sql string) {
func
writeData
(
wg
*
sync
.
WaitGroup
,
tbIndex
int
)
{
func
writeData
(
wg
*
sync
.
WaitGroup
,
tbIndex
int
)
{
defer
wg
.
Done
()
defer
wg
.
Done
()
client
:=
&
http
.
Client
{}
client
:=
&
http
.
Client
{}
tbName
:=
fmt
.
Sprintf
(
"t%d"
,
tbIndex
)
tbName
:=
fmt
.
Sprintf
(
"t%d"
,
tbIndex
)
for
j
:=
0
;
j
<
config
.
LoopNum
;
j
++
{
for
j
:=
0
;
j
<
config
.
LoopNum
;
j
++
{
tmVal
:=
fmt
.
Sprintf
(
"%d"
,
int64
(
j
)
*
int64
(
10000
)
+
config
.
DataBegin
)
tmVal
:=
fmt
.
Sprintf
(
"%d"
,
int64
(
j
)
*
int64
(
10000
)
+
config
.
DataBegin
)
//fmt.Println(tmVal)
//fmt.Println(tmVal)
req1
:=
strings
.
Replace
(
template
,
"panshi-gsl"
,
tbName
,
-
1
)
req1
:=
strings
.
Replace
(
template
,
"panshi-gsl"
,
tbName
,
-
1
)
req2
:=
strings
.
Replace
(
req1
,
"1536750390000"
,
tmVal
,
-
1
)
req2
:=
strings
.
Replace
(
req1
,
"1536750390000"
,
tmVal
,
-
1
)
//fmt.Println(req2)
//fmt.Println(req2)
exec
(
client
,
req2
)
exec
(
client
,
req2
)
}
}
...
@@ -196,17 +211,17 @@ func writeData(wg *sync.WaitGroup, tbIndex int) {
...
@@ -196,17 +211,17 @@ func writeData(wg *sync.WaitGroup, tbIndex int) {
func
main
()
{
func
main
()
{
filename
:=
flag
.
String
(
"config"
,
"telegraf.json"
,
"config file name"
)
filename
:=
flag
.
String
(
"config"
,
"telegraf.json"
,
"config file name"
)
flag
.
Parse
()
flag
.
Parse
()
readReq
(
"telegraf.req"
)
readReq
(
"telegraf.req"
)
readConf
(
*
filename
)
readConf
(
*
filename
)
fmt
.
Println
(
"
\n
================telegraf test start======================"
)
fmt
.
Println
(
"
\n
================telegraf test start======================"
)
var
wg
sync
.
WaitGroup
var
wg
sync
.
WaitGroup
for
i
:=
0
;
i
<
config
.
MachineNum
;
i
++
{
for
i
:=
0
;
i
<
config
.
MachineNum
;
i
++
{
wg
.
Add
(
1
)
wg
.
Add
(
1
)
go
writeData
(
&
wg
,
i
)
go
writeData
(
&
wg
,
i
)
...
...
tests/stress/main.go
浏览文件 @
7c173acc
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
main
package
main
import
(
import
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录