Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c7f06ee2
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c7f06ee2
编写于
4月 20, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: make telemetry work
上级
61334de8
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
42 addition
and
16 deletion
+42
-16
include/common/tglobal.h
include/common/tglobal.h
+6
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+17
-4
source/dnode/mnode/impl/inc/mndInt.h
source/dnode/mnode/impl/inc/mndInt.h
+0
-1
source/dnode/mnode/impl/src/mndTelem.c
source/dnode/mnode/impl/src/mndTelem.c
+10
-6
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+3
-3
tests/script/tmp/data.sim
tests/script/tmp/data.sim
+6
-1
未找到文件。
include/common/tglobal.h
浏览文件 @
c7f06ee2
...
@@ -32,7 +32,6 @@ extern char tsLocalEp[];
...
@@ -32,7 +32,6 @@ extern char tsLocalEp[];
extern
uint16_t
tsServerPort
;
extern
uint16_t
tsServerPort
;
extern
int32_t
tsVersion
;
extern
int32_t
tsVersion
;
extern
int32_t
tsStatusInterval
;
extern
int32_t
tsStatusInterval
;
extern
bool
tsEnableTelemetryReporting
;
// common
// common
extern
int32_t
tsRpcTimer
;
extern
int32_t
tsRpcTimer
;
...
@@ -82,6 +81,12 @@ extern uint16_t tsMonitorPort;
...
@@ -82,6 +81,12 @@ extern uint16_t tsMonitorPort;
extern
int32_t
tsMonitorMaxLogs
;
extern
int32_t
tsMonitorMaxLogs
;
extern
bool
tsMonitorComp
;
extern
bool
tsMonitorComp
;
// telem
extern
bool
tsEnableTelem
;
extern
int32_t
tsTelemInterval
;
extern
char
tsTelemServer
[];
extern
uint16_t
tsTelemPort
;
// query buffer management
// query buffer management
extern
int32_t
tsQueryBufferSize
;
// maximum allowed usage buffer size in MB for each data node during query processing
extern
int32_t
tsQueryBufferSize
;
// maximum allowed usage buffer size in MB for each data node during query processing
extern
int64_t
tsQueryBufferSizeBytes
;
// maximum allowed usage buffer size in byte for each data node
extern
int64_t
tsQueryBufferSizeBytes
;
// maximum allowed usage buffer size in byte for each data node
...
...
source/common/src/tglobal.c
浏览文件 @
c7f06ee2
...
@@ -30,7 +30,6 @@ char tsLocalEp[TSDB_EP_LEN] = {0}; // Local End Point, hostname:port
...
@@ -30,7 +30,6 @@ char tsLocalEp[TSDB_EP_LEN] = {0}; // Local End Point, hostname:port
uint16_t
tsServerPort
=
6030
;
uint16_t
tsServerPort
=
6030
;
int32_t
tsVersion
=
30000000
;
int32_t
tsVersion
=
30000000
;
int32_t
tsStatusInterval
=
1
;
// second
int32_t
tsStatusInterval
=
1
;
// second
bool
tsEnableTelemetryReporting
=
false
;
// common
// common
int32_t
tsRpcTimer
=
300
;
int32_t
tsRpcTimer
=
300
;
...
@@ -75,6 +74,12 @@ uint16_t tsMonitorPort = 6043;
...
@@ -75,6 +74,12 @@ uint16_t tsMonitorPort = 6043;
int32_t
tsMonitorMaxLogs
=
100
;
int32_t
tsMonitorMaxLogs
=
100
;
bool
tsMonitorComp
=
false
;
bool
tsMonitorComp
=
false
;
// telem
bool
tsEnableTelem
=
false
;
int32_t
tsTelemInterval
=
86400
;
char
tsTelemServer
[
TSDB_FQDN_LEN
]
=
"telemetry.taosdata.com"
;
uint16_t
tsTelemPort
=
80
;
/*
/*
* denote if the server needs to compress response message at the application layer to client, including query rsp,
* denote if the server needs to compress response message at the application layer to client, including query rsp,
* metricmeta rsp, and multi-meter query rsp message body. The client compress the submit message to server.
* metricmeta rsp, and multi-meter query rsp message body. The client compress the submit message to server.
...
@@ -354,7 +359,6 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
...
@@ -354,7 +359,6 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddDir
(
pCfg
,
"dataDir"
,
tsDataDir
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddDir
(
pCfg
,
"dataDir"
,
tsDataDir
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pCfg
,
"minimalDataDirGB"
,
2
.
0
f
,
0
.
001
f
,
10000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pCfg
,
"minimalDataDirGB"
,
2
.
0
f
,
0
.
001
f
,
10000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxNumOfDistinctRes"
,
tsMaxNumOfDistinctResults
,
10
*
10000
,
10000
*
10000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxNumOfDistinctRes"
,
tsMaxNumOfDistinctResults
,
10
*
10000
,
10000
*
10000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"telemetryReporting"
,
tsEnableTelemetryReporting
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxConnections"
,
tsMaxConnections
,
1
,
100000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxConnections"
,
tsMaxConnections
,
1
,
100000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxShellConns"
,
tsMaxShellConns
,
10
,
50000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxShellConns"
,
tsMaxShellConns
,
10
,
50000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"statusInterval"
,
tsStatusInterval
,
1
,
30
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"statusInterval"
,
tsStatusInterval
,
1
,
30
,
0
)
!=
0
)
return
-
1
;
...
@@ -430,12 +434,17 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
...
@@ -430,12 +434,17 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddInt32
(
pCfg
,
"numOfSnodeUniqueThreads"
,
tsNumOfSnodeUniqueThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"numOfSnodeUniqueThreads"
,
tsNumOfSnodeUniqueThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"monitor"
,
tsEnableMonitor
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"monitor"
,
tsEnableMonitor
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"monitorInterval"
,
tsMonitorInterval
,
1
,
36
0000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"monitorInterval"
,
tsMonitorInterval
,
1
,
20
0000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddString
(
pCfg
,
"monitorFqdn"
,
tsMonitorFqdn
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddString
(
pCfg
,
"monitorFqdn"
,
tsMonitorFqdn
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"monitorPort"
,
tsMonitorPort
,
1
,
65056
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"monitorPort"
,
tsMonitorPort
,
1
,
65056
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"monitorMaxLogs"
,
tsMonitorMaxLogs
,
1
,
1000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"monitorMaxLogs"
,
tsMonitorMaxLogs
,
1
,
1000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"monitorComp"
,
tsMonitorComp
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"monitorComp"
,
tsMonitorComp
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"telemetryReporting"
,
tsEnableTelem
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"telemetryInterval"
,
tsTelemInterval
,
1
,
200000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddString
(
pCfg
,
"telemetryServer"
,
tsTelemServer
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"telemetryPort"
,
tsTelemPort
,
1
,
65056
,
0
)
!=
0
)
return
-
1
;
return
0
;
return
0
;
}
}
...
@@ -528,7 +537,6 @@ static void taosSetSystemCfg(SConfig *pCfg) {
...
@@ -528,7 +537,6 @@ static void taosSetSystemCfg(SConfig *pCfg) {
static
int32_t
taosSetServerCfg
(
SConfig
*
pCfg
)
{
static
int32_t
taosSetServerCfg
(
SConfig
*
pCfg
)
{
tsDataSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalDataDirGB"
)
->
fval
;
tsDataSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalDataDirGB"
)
->
fval
;
tsMaxNumOfDistinctResults
=
cfgGetItem
(
pCfg
,
"maxNumOfDistinctRes"
)
->
i32
;
tsMaxNumOfDistinctResults
=
cfgGetItem
(
pCfg
,
"maxNumOfDistinctRes"
)
->
i32
;
tsEnableTelemetryReporting
=
cfgGetItem
(
pCfg
,
"telemetryReporting"
)
->
bval
;
tsMaxConnections
=
cfgGetItem
(
pCfg
,
"maxConnections"
)
->
i32
;
tsMaxConnections
=
cfgGetItem
(
pCfg
,
"maxConnections"
)
->
i32
;
tsMaxShellConns
=
cfgGetItem
(
pCfg
,
"maxShellConns"
)
->
i32
;
tsMaxShellConns
=
cfgGetItem
(
pCfg
,
"maxShellConns"
)
->
i32
;
tsStatusInterval
=
cfgGetItem
(
pCfg
,
"statusInterval"
)
->
i32
;
tsStatusInterval
=
cfgGetItem
(
pCfg
,
"statusInterval"
)
->
i32
;
...
@@ -572,6 +580,11 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
...
@@ -572,6 +580,11 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsMonitorMaxLogs
=
cfgGetItem
(
pCfg
,
"monitorMaxLogs"
)
->
i32
;
tsMonitorMaxLogs
=
cfgGetItem
(
pCfg
,
"monitorMaxLogs"
)
->
i32
;
tsMonitorComp
=
cfgGetItem
(
pCfg
,
"monitorComp"
)
->
bval
;
tsMonitorComp
=
cfgGetItem
(
pCfg
,
"monitorComp"
)
->
bval
;
tsEnableTelem
=
cfgGetItem
(
pCfg
,
"telemetryReporting"
)
->
bval
;
tsTelemInterval
=
cfgGetItem
(
pCfg
,
"telemetryInterval"
)
->
i32
;
tstrncpy
(
tsTelemServer
,
cfgGetItem
(
pCfg
,
"telemetryServer"
)
->
str
,
TSDB_FQDN_LEN
);
tsTelemPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"telemetryPort"
)
->
i32
;
if
(
tsQueryBufferSize
>=
0
)
{
if
(
tsQueryBufferSize
>=
0
)
{
tsQueryBufferSizeBytes
=
tsQueryBufferSize
*
1048576UL
;
tsQueryBufferSizeBytes
=
tsQueryBufferSize
*
1048576UL
;
}
}
...
...
source/dnode/mnode/impl/inc/mndInt.h
浏览文件 @
c7f06ee2
...
@@ -67,7 +67,6 @@ typedef struct {
...
@@ -67,7 +67,6 @@ typedef struct {
}
SProfileMgmt
;
}
SProfileMgmt
;
typedef
struct
{
typedef
struct
{
bool
enable
;
SRWLatch
lock
;
SRWLatch
lock
;
char
email
[
TSDB_FQDN_LEN
];
char
email
[
TSDB_FQDN_LEN
];
}
STelemMgmt
;
}
STelemMgmt
;
...
...
source/dnode/mnode/impl/src/mndTelem.c
浏览文件 @
c7f06ee2
...
@@ -21,9 +21,6 @@
...
@@ -21,9 +21,6 @@
#include "thttp.h"
#include "thttp.h"
#include "tjson.h"
#include "tjson.h"
#define TELEMETRY_SERVER "telemetry.taosdata.com"
#define TELEMETRY_PORT 80
typedef
struct
{
typedef
struct
{
int64_t
numOfDnode
;
int64_t
numOfDnode
;
int64_t
numOfMnode
;
int64_t
numOfMnode
;
...
@@ -62,6 +59,12 @@ static void mndGetStat(SMnode* pMnode, SMnodeStat* pStat) {
...
@@ -62,6 +59,12 @@ static void mndGetStat(SMnode* pMnode, SMnodeStat* pStat) {
sdbRelease
(
pSdb
,
pVgroup
);
sdbRelease
(
pSdb
,
pVgroup
);
}
}
pStat
->
numOfChildTable
=
100
;
pStat
->
numOfColumn
=
200
;
pStat
->
totalPoints
=
300
;
pStat
->
totalStorage
=
400
;
pStat
->
compStorage
=
500
;
}
}
static
void
mndBuildRuntimeInfo
(
SMnode
*
pMnode
,
SJson
*
pJson
)
{
static
void
mndBuildRuntimeInfo
(
SMnode
*
pMnode
,
SJson
*
pJson
)
{
...
@@ -122,12 +125,14 @@ static char* mndBuildTelemetryReport(SMnode* pMnode) {
...
@@ -122,12 +125,14 @@ static char* mndBuildTelemetryReport(SMnode* pMnode) {
static
int32_t
mndProcessTelemTimer
(
SNodeMsg
*
pReq
)
{
static
int32_t
mndProcessTelemTimer
(
SNodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pNode
;
SMnode
*
pMnode
=
pReq
->
pNode
;
STelemMgmt
*
pMgmt
=
&
pMnode
->
telemMgmt
;
STelemMgmt
*
pMgmt
=
&
pMnode
->
telemMgmt
;
if
(
!
pMgmt
->
enable
)
return
0
;
if
(
!
tsEnableTelem
)
return
0
;
taosWLockLatch
(
&
pMgmt
->
lock
);
taosWLockLatch
(
&
pMgmt
->
lock
);
char
*
pCont
=
mndBuildTelemetryReport
(
pMnode
);
char
*
pCont
=
mndBuildTelemetryReport
(
pMnode
);
if
(
pCont
!=
NULL
)
{
if
(
pCont
!=
NULL
)
{
taosSendHttpReport
(
TELEMETRY_SERVER
,
TELEMETRY_PORT
,
pCont
,
strlen
(
pCont
),
HTTP_FLAT
);
if
(
taosSendHttpReport
(
tsTelemServer
,
tsTelemPort
,
pCont
,
strlen
(
pCont
),
HTTP_FLAT
)
!=
0
)
{
mError
(
"failed to send telemetry msg"
);
}
taosMemoryFree
(
pCont
);
taosMemoryFree
(
pCont
);
}
}
taosWUnLockLatch
(
&
pMgmt
->
lock
);
taosWUnLockLatch
(
&
pMgmt
->
lock
);
...
@@ -138,7 +143,6 @@ int32_t mndInitTelem(SMnode* pMnode) {
...
@@ -138,7 +143,6 @@ int32_t mndInitTelem(SMnode* pMnode) {
STelemMgmt
*
pMgmt
=
&
pMnode
->
telemMgmt
;
STelemMgmt
*
pMgmt
=
&
pMnode
->
telemMgmt
;
taosInitRWLatch
(
&
pMgmt
->
lock
);
taosInitRWLatch
(
&
pMgmt
->
lock
);
pMgmt
->
enable
=
tsEnableTelemetryReporting
;
taosGetEmail
(
pMgmt
->
email
,
sizeof
(
pMgmt
->
email
));
taosGetEmail
(
pMgmt
->
email
,
sizeof
(
pMgmt
->
email
));
mndSetMsgHandle
(
pMnode
,
TDMT_MND_TELEM_TIMER
,
mndProcessTelemTimer
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_TELEM_TIMER
,
mndProcessTelemTimer
);
...
...
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
c7f06ee2
...
@@ -45,7 +45,6 @@
...
@@ -45,7 +45,6 @@
#define MQ_TIMER_MS 3000
#define MQ_TIMER_MS 3000
#define TRNAS_TIMER_MS 6000
#define TRNAS_TIMER_MS 6000
#define TELEM_TIMER_MS 86400000
static
void
*
mndBuildTimerMsg
(
int32_t
*
pContLen
)
{
static
void
*
mndBuildTimerMsg
(
int32_t
*
pContLen
)
{
SMTimerReq
timerReq
=
{
0
};
SMTimerReq
timerReq
=
{
0
};
...
@@ -97,7 +96,7 @@ static void mndPullupTelem(void *param, void *tmrId) {
...
@@ -97,7 +96,7 @@ static void mndPullupTelem(void *param, void *tmrId) {
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
READ_QUEUE
,
&
rpcMsg
);
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
READ_QUEUE
,
&
rpcMsg
);
}
}
taosTmrReset
(
mndPullupTelem
,
TELEM_TIMER_MS
,
pMnode
,
pMnode
->
timer
,
&
pMnode
->
telemTimer
);
taosTmrReset
(
mndPullupTelem
,
tsTelemInterval
*
1000
,
pMnode
,
pMnode
->
timer
,
&
pMnode
->
telemTimer
);
}
}
static
int32_t
mndInitTimer
(
SMnode
*
pMnode
)
{
static
int32_t
mndInitTimer
(
SMnode
*
pMnode
)
{
...
@@ -117,7 +116,8 @@ static int32_t mndInitTimer(SMnode *pMnode) {
...
@@ -117,7 +116,8 @@ static int32_t mndInitTimer(SMnode *pMnode) {
return
-
1
;
return
-
1
;
}
}
if
(
taosTmrReset
(
mndPullupTelem
,
60000
,
pMnode
,
pMnode
->
timer
,
&
pMnode
->
telemTimer
))
{
int32_t
interval
=
tsTelemInterval
<
10
?
tsTelemInterval
:
10
;
if
(
taosTmrReset
(
mndPullupTelem
,
interval
*
1000
,
pMnode
,
pMnode
->
timer
,
&
pMnode
->
telemTimer
))
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
return
-
1
;
}
}
...
...
tests/script/tmp/data.sim
浏览文件 @
c7f06ee2
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c telemetryReporting -v 1
system sh/cfg.sh -n dnode1 -c telemetryInterval -v 1
system sh/cfg.sh -n dnode1 -c telemetryServer -v localhost
system sh/cfg.sh -n dnode1 -c telemetryPort -v 80
return
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
sql connect
sql connect
return
sql create database db
sql create database db
sql create table db.tb (ts timestamp, i int)
sql create table db.tb (ts timestamp, i int)
sql insert into db.tb values(now, 1)
sql insert into db.tb values(now, 1)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录