diff options
Diffstat (limited to 'src/web_service')
| -rw-r--r-- | src/web_service/telemetry_json.cpp | 21 | ||||
| -rw-r--r-- | src/web_service/telemetry_json.h | 1 |
2 files changed, 17 insertions, 5 deletions
diff --git a/src/web_service/telemetry_json.cpp b/src/web_service/telemetry_json.cpp index 0a8f2bd9e..9156ce802 100644 --- a/src/web_service/telemetry_json.cpp +++ b/src/web_service/telemetry_json.cpp | |||
| @@ -102,16 +102,27 @@ void TelemetryJson::Complete() { | |||
| 102 | impl->SerializeSection(Telemetry::FieldType::App, "App"); | 102 | impl->SerializeSection(Telemetry::FieldType::App, "App"); |
| 103 | impl->SerializeSection(Telemetry::FieldType::Session, "Session"); | 103 | impl->SerializeSection(Telemetry::FieldType::Session, "Session"); |
| 104 | impl->SerializeSection(Telemetry::FieldType::Performance, "Performance"); | 104 | impl->SerializeSection(Telemetry::FieldType::Performance, "Performance"); |
| 105 | impl->SerializeSection(Telemetry::FieldType::UserFeedback, "UserFeedback"); | ||
| 106 | impl->SerializeSection(Telemetry::FieldType::UserConfig, "UserConfig"); | 105 | impl->SerializeSection(Telemetry::FieldType::UserConfig, "UserConfig"); |
| 107 | impl->SerializeSection(Telemetry::FieldType::UserSystem, "UserSystem"); | 106 | impl->SerializeSection(Telemetry::FieldType::UserSystem, "UserSystem"); |
| 108 | 107 | ||
| 109 | auto content = impl->TopSection().dump(); | 108 | auto content = impl->TopSection().dump(); |
| 110 | // Send the telemetry async but don't handle the errors since they were written to the log | 109 | // Send the telemetry async but don't handle the errors since they were written to the log |
| 111 | Common::DetachedTasks::AddTask( | 110 | Common::DetachedTasks::AddTask([host{impl->host}, content]() { |
| 112 | [host{impl->host}, username{impl->username}, token{impl->token}, content]() { | 111 | Client{host, "", ""}.PostJson("/telemetry", content, true); |
| 113 | Client{host, username, token}.PostJson("/telemetry", content, true); | 112 | }); |
| 114 | }); | 113 | } |
| 114 | |||
| 115 | bool TelemetryJson::SubmitTestcase() { | ||
| 116 | impl->SerializeSection(Telemetry::FieldType::App, "App"); | ||
| 117 | impl->SerializeSection(Telemetry::FieldType::Session, "Session"); | ||
| 118 | impl->SerializeSection(Telemetry::FieldType::UserFeedback, "UserFeedback"); | ||
| 119 | impl->SerializeSection(Telemetry::FieldType::UserSystem, "UserSystem"); | ||
| 120 | |||
| 121 | auto content = impl->TopSection().dump(); | ||
| 122 | Client client(impl->host, impl->username, impl->token); | ||
| 123 | auto value = client.PostJson("/gamedb/testcase", content, false); | ||
| 124 | |||
| 125 | return value.result_code == Common::WebResult::Code::Success; | ||
| 115 | } | 126 | } |
| 116 | 127 | ||
| 117 | } // namespace WebService | 128 | } // namespace WebService |
diff --git a/src/web_service/telemetry_json.h b/src/web_service/telemetry_json.h index 93371414a..dfd202829 100644 --- a/src/web_service/telemetry_json.h +++ b/src/web_service/telemetry_json.h | |||
| @@ -35,6 +35,7 @@ public: | |||
| 35 | void Visit(const Telemetry::Field<std::chrono::microseconds>& field) override; | 35 | void Visit(const Telemetry::Field<std::chrono::microseconds>& field) override; |
| 36 | 36 | ||
| 37 | void Complete() override; | 37 | void Complete() override; |
| 38 | bool SubmitTestcase() override; | ||
| 38 | 39 | ||
| 39 | private: | 40 | private: |
| 40 | struct Impl; | 41 | struct Impl; |