(ixsentry) add a library method to upload a payload directly to sentry
This commit is contained in:
		| @@ -1,6 +1,10 @@ | ||||
| # Changelog | ||||
| All changes to this project will be documented in this file. | ||||
|  | ||||
| ## [9.2.7] - 2020-04-14 | ||||
|  | ||||
| (ixsentry) add a library method to upload a payload directly to sentry | ||||
|  | ||||
| ## [9.2.6] - 2020-04-14 | ||||
|  | ||||
| (ixcobra) snake server / handle invalid incoming json messages + cobra subscriber in fluentd mode insert a created_at timestamp entry | ||||
|   | ||||
| @@ -64,7 +64,8 @@ namespace ix | ||||
|     std::string SentryClient::computeAuthHeader() | ||||
|     { | ||||
|         std::string securityHeader("Sentry sentry_version=5"); | ||||
|         securityHeader += ",sentry_client=ws/1.0.0"; | ||||
|         securityHeader += ",sentry_client=ws/"; | ||||
|         securityHeader += std::string(IX_WEBSOCKET_VERSION); | ||||
|         securityHeader += ",sentry_timestamp=" + std::to_string(SentryClient::getTimestamp()); | ||||
|         securityHeader += ",sentry_key=" + _publicKey; | ||||
|         securityHeader += ",sentry_secret=" + _secretKey; | ||||
| @@ -286,4 +287,26 @@ namespace ix | ||||
|  | ||||
|         _httpClient->performRequest(args, onResponseCallback); | ||||
|     } | ||||
|  | ||||
|     void SentryClient::uploadPayload( | ||||
|         const Json::Value& payload, | ||||
|         const std::string& project, | ||||
|         const std::string& key, | ||||
|         bool verbose, | ||||
|         const OnResponseCallback& onResponseCallback) | ||||
|     { | ||||
|         auto args = _httpClient->createRequest(); | ||||
|         args->extraHeaders["X-Sentry-Auth"] = SentryClient::computeAuthHeader(); | ||||
|         args->verb = HttpClient::kPost; | ||||
|         args->connectTimeout = 60; | ||||
|         args->transferTimeout = 5 * 60; | ||||
|         args->followRedirects = true; | ||||
|         args->verbose = verbose; | ||||
|         args->logger = [](const std::string& msg) { ix::IXCoreLogger::Log(msg.c_str()); }; | ||||
|  | ||||
|         args->url = _url; | ||||
|         args->body = _jsonWriter.write(payload); | ||||
|  | ||||
|         _httpClient->performRequest(args, onResponseCallback); | ||||
|     } | ||||
| } // namespace ix | ||||
|   | ||||
| @@ -36,6 +36,13 @@ namespace ix | ||||
|             bool verbose, | ||||
|             const OnResponseCallback& onResponseCallback); | ||||
|  | ||||
|         void uploadPayload( | ||||
|             const Json::Value& payload, | ||||
|             const std::string& project, | ||||
|             const std::string& key, | ||||
|             bool verbose, | ||||
|             const OnResponseCallback& onResponseCallback); | ||||
|  | ||||
|     private: | ||||
|         int64_t getTimestamp(); | ||||
|         std::string computeAuthHeader(); | ||||
|   | ||||
| @@ -6,4 +6,4 @@ | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #define IX_WEBSOCKET_VERSION "9.2.6" | ||||
| #define IX_WEBSOCKET_VERSION "9.2.7" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user