(cobra2sentry bot) take a sentry client as input instead of a dsn
This commit is contained in:
parent
adf6aa1d6c
commit
d4e1f71e3c
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <ixcobra/IXCobraConnection.h>
|
#include <ixcobra/IXCobraConnection.h>
|
||||||
#include <ixsentry/IXSentryClient.h>
|
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
@ -20,7 +19,7 @@ namespace ix
|
|||||||
int cobra_to_sentry_bot(const CobraConfig& config,
|
int cobra_to_sentry_bot(const CobraConfig& config,
|
||||||
const std::string& channel,
|
const std::string& channel,
|
||||||
const std::string& filter,
|
const std::string& filter,
|
||||||
const std::string& dsn,
|
SentryClient& sentryClient,
|
||||||
bool verbose,
|
bool verbose,
|
||||||
bool strict,
|
bool strict,
|
||||||
size_t maxQueueSize,
|
size_t maxQueueSize,
|
||||||
@ -84,8 +83,7 @@ namespace ix
|
|||||||
std::thread t2(heartbeat);
|
std::thread t2(heartbeat);
|
||||||
|
|
||||||
auto sentrySender =
|
auto sentrySender =
|
||||||
[&queueManager, verbose, &errorSending, &sentCount, &stop, &throttled, &dsn] {
|
[&queueManager, verbose, &errorSending, &sentCount, &stop, &throttled, &sentryClient] {
|
||||||
SentryClient sentryClient(dsn);
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ixcobra/IXCobraConfig.h>
|
#include <ixcobra/IXCobraConfig.h>
|
||||||
|
#include <ixsentry/IXSentryClient.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace ix
|
namespace ix
|
||||||
@ -13,7 +14,7 @@ namespace ix
|
|||||||
int cobra_to_sentry_bot(const CobraConfig& config,
|
int cobra_to_sentry_bot(const CobraConfig& config,
|
||||||
const std::string& channel,
|
const std::string& channel,
|
||||||
const std::string& filter,
|
const std::string& filter,
|
||||||
const std::string& dsn,
|
SentryClient& sentryClient,
|
||||||
bool verbose,
|
bool verbose,
|
||||||
bool strict,
|
bool strict,
|
||||||
size_t maxQueueSize,
|
size_t maxQueueSize,
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include <ixsnake/IXSnakeServer.h>
|
#include <ixsnake/IXSnakeServer.h>
|
||||||
#include <ixwebsocket/IXHttpServer.h>
|
#include <ixwebsocket/IXHttpServer.h>
|
||||||
#include <ixwebsocket/IXUserAgent.h>
|
#include <ixwebsocket/IXUserAgent.h>
|
||||||
|
#include <ixsentry/IXSentryClient.h>
|
||||||
|
|
||||||
using namespace ix;
|
using namespace ix;
|
||||||
|
|
||||||
@ -157,13 +158,15 @@ TEST_CASE("Cobra_to_sentry_bot", "[foo]")
|
|||||||
oss << scheme << "xxxxxxx:yyyyyyy@localhost:" << sentryPort << "/1234567";
|
oss << scheme << "xxxxxxx:yyyyyyy@localhost:" << sentryPort << "/1234567";
|
||||||
std::string dsn = oss.str();
|
std::string dsn = oss.str();
|
||||||
|
|
||||||
|
SentryClient sentryClient(dsn);
|
||||||
|
|
||||||
// Only run the bot for 3 seconds
|
// Only run the bot for 3 seconds
|
||||||
int runtime = 3;
|
int runtime = 3;
|
||||||
|
|
||||||
int sentCount = cobra_to_sentry_bot(config,
|
int sentCount = cobra_to_sentry_bot(config,
|
||||||
channel,
|
channel,
|
||||||
filter,
|
filter,
|
||||||
dsn,
|
sentryClient,
|
||||||
verbose,
|
verbose,
|
||||||
strict,
|
strict,
|
||||||
maxQueueSize,
|
maxQueueSize,
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <ixwebsocket/IXNetSystem.h>
|
#include <ixwebsocket/IXNetSystem.h>
|
||||||
#include <ixwebsocket/IXSocket.h>
|
#include <ixwebsocket/IXSocket.h>
|
||||||
#include <ixwebsocket/IXUserAgent.h>
|
#include <ixwebsocket/IXUserAgent.h>
|
||||||
|
#include <ixsentry/IXSentryClient.h>
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -447,10 +448,12 @@ int main(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
bool enableHeartbeat = true;
|
bool enableHeartbeat = true;
|
||||||
int runtime = -1;
|
int runtime = -1;
|
||||||
|
ix::SentryClient sentryClient(dsn);
|
||||||
|
|
||||||
ret = ix::cobra_to_sentry_bot(cobraConfig,
|
ret = ix::cobra_to_sentry_bot(cobraConfig,
|
||||||
channel,
|
channel,
|
||||||
filter,
|
filter,
|
||||||
dsn,
|
sentryClient,
|
||||||
verbose,
|
verbose,
|
||||||
strict,
|
strict,
|
||||||
maxQueueSize,
|
maxQueueSize,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user