summaryrefslogtreecommitdiff
path: root/script/service
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-12-21 20:39:18 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-12-21 20:39:18 +0800
commit29a4ef47a1c5be6cc9edd3296b49ea412abe78ed (patch)
tree513308814626845ebffec2b2d391c6264c1b6d99 /script/service
parent6fee44a73fd29413f112bdd85b3116430c4f2a2c (diff)
downloadlua-language-server-29a4ef47a1c5be6cc9edd3296b49ea412abe78ed.zip
发送平台统计
Diffstat (limited to 'script/service')
-rw-r--r--script/service/telemetry.lua24
1 files changed, 18 insertions, 6 deletions
diff --git a/script/service/telemetry.lua b/script/service/telemetry.lua
index f3586308..85a8b8b4 100644
--- a/script/service/telemetry.lua
+++ b/script/service/telemetry.lua
@@ -1,9 +1,10 @@
-local net = require 'service.net'
-local timer = require 'timer'
-local config = require 'config'
-local client = require 'provider.client'
-local nonil = require 'without-check-nil'
-local util = require 'utility'
+local net = require 'service.net'
+local timer = require 'timer'
+local config = require 'config'
+local client = require 'provider.client'
+local nonil = require 'without-check-nil'
+local util = require 'utility'
+local platform = require 'bee.platform'
local tokenPath = (ROOT / 'log' / 'token'):string()
local token = util.loadFile(tokenPath)
@@ -34,6 +35,16 @@ local function pushClientInfo(link)
))
end
+local function pushPlatformInfo(link)
+ send(link, string.pack('zzz'
+ , 'platform'
+ , token
+ , ('%s %s'):format(platform.OS, platform.Arch)
+ , ('%s %s'):format(platform.CRT, platform.CRTVersion)
+ , ('%s %s'):format(platform.Compiler, platform.CompilerVersion)
+ ))
+end
+
local function pushErrorLog(link)
if not log.firstError then
return
@@ -56,6 +67,7 @@ timer.wait(5, function ()
local link = net.connect('tcp', '119.45.194.183', 11577)
function link:on_connect()
pushClientInfo(link)
+ pushPlatformInfo(link)
pushErrorLog(link)
self:close()
end