[TD-1625]
This commit is contained in:
parent
82b21d6eef
commit
fa874237b2
|
@ -272,6 +272,29 @@ function install_config() {
|
|||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# user email
|
||||
#EMAIL_PATTERN='^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$'
|
||||
#EMAIL_PATTERN='^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$'
|
||||
#EMAIL_PATTERN="^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$"
|
||||
echo
|
||||
echo -e -n "${GREEN}Enter your email address for priority support or enter empty to skip${NC}: "
|
||||
read emailAddr
|
||||
while true; do
|
||||
if [ ! -z "$emailAddr" ]; then
|
||||
# check the format of the emailAddr
|
||||
#if [[ "$emailAddr" =~ $EMAIL_PATTERN ]]; then
|
||||
# Write the email address to temp file
|
||||
email_file="${install_main_dir}/email"
|
||||
${csudo} bash -c "echo $emailAddr > ${email_file}"
|
||||
break
|
||||
#else
|
||||
# read -p "Please enter the correct email address: " emailAddr
|
||||
#fi
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ extern int32_t tsStatusInterval;
|
|||
extern int32_t tsNumOfMnodes;
|
||||
extern int32_t tsEnableVnodeBak;
|
||||
extern int32_t tsEnableTelemetryReporting;
|
||||
extern char tsEmail[];
|
||||
|
||||
// common
|
||||
extern int tsRpcTimer;
|
||||
|
|
|
@ -42,6 +42,7 @@ int32_t tsStatusInterval = 1; // second
|
|||
int32_t tsNumOfMnodes = 3;
|
||||
int32_t tsEnableVnodeBak = 1;
|
||||
int32_t tsEnableTelemetryReporting = 1;
|
||||
char tsEmail[TSDB_FQDN_LEN] = {0};
|
||||
|
||||
// common
|
||||
int32_t tsRpcTimer = 1000;
|
||||
|
|
|
@ -41,7 +41,7 @@ static pthread_t tsTelemetryThread;
|
|||
|
||||
#define TELEMETRY_SERVER "telemetry.taosdata.com"
|
||||
#define TELEMETRY_PORT 80
|
||||
#define REPORT_INTERVAL 86400
|
||||
#define REPORT_INTERVAL 100 // 86400
|
||||
|
||||
static void beginObject(SBufferWriter* bw) {
|
||||
tbufWriteChar(bw, '{');
|
||||
|
@ -177,7 +177,8 @@ static void addMemoryInfo(SBufferWriter* bw) {
|
|||
static void addVersionInfo(SBufferWriter* bw) {
|
||||
addStringField(bw, "version", version);
|
||||
addStringField(bw, "buildInfo", buildinfo);
|
||||
addStringField(bw, "gitInfo", gitinfo);
|
||||
addStringField(bw, "gitInfo", gitinfo);
|
||||
addStringField(bw, "email", tsEmail);
|
||||
}
|
||||
|
||||
static void addRuntimeInfo(SBufferWriter* bw) {
|
||||
|
@ -243,7 +244,7 @@ static void sendTelemetryReport() {
|
|||
static void* telemetryThread(void* param) {
|
||||
struct timespec end = {0};
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
end.tv_sec += 300; // wait 5 minutes before send first report
|
||||
end.tv_sec += 10; //300; // wait 5 minutes before send first report
|
||||
|
||||
while (1) {
|
||||
if (sem_timedwait(&tsExitSem, &end) == 0) {
|
||||
|
@ -261,11 +262,25 @@ static void* telemetryThread(void* param) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void dnodeGetEmail(char* filepath) {
|
||||
int fd = open(filepath, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (taosTRead(fd, (void *)tsEmail, TSDB_FQDN_LEN) < 0) {
|
||||
dError("failed to read %d bytes from file %s since %s", TSDB_FQDN_LEN, filepath, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int32_t dnodeInitTelemetry() {
|
||||
if (!tsEnableTelemetryReporting) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
dnodeGetEmail("/usr/local/taos/email");
|
||||
|
||||
if (tsem_init(&tsExitSem, 0, 0) == -1) {
|
||||
// just log the error, it is ok for telemetry to fail
|
||||
dTrace("failed to create semaphore for telemetry, reason:%s", strerror(errno));
|
||||
|
|
Loading…
Reference in New Issue