projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement a metrics daemon to expose Prometheus metrics
[quassel.git]
/
src
/
core
/
core.cpp
diff --git
a/src/core/core.cpp
b/src/core/core.cpp
index
9f9e1c6
..
b0c02c1
100644
(file)
--- a/
src/core/core.cpp
+++ b/
src/core/core.cpp
@@
-1,5
+1,5
@@
/***************************************************************************
/***************************************************************************
- * Copyright (C) 2005-201
8
by the Quassel Project *
+ * Copyright (C) 2005-201
9
by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-187,7
+187,9
@@
void Core::init()
qInfo() << "Core is currently not configured! Please connect with a Quassel Client for basic setup.";
}
}
qInfo() << "Core is currently not configured! Please connect with a Quassel Client for basic setup.";
}
}
- else {
+
+ // This checks separately because config-from-environment might have only configured the core just now
+ if (_configured) {
if (Quassel::isOptionSet("add-user")) {
bool success = createUser();
throw ExitException{success ? EXIT_SUCCESS : EXIT_FAILURE};
if (Quassel::isOptionSet("add-user")) {
bool success = createUser();
throw ExitException{success ? EXIT_SUCCESS : EXIT_FAILURE};
@@
-211,6
+213,14
@@
void Core::init()
_identServer = new IdentServer(this);
}
_identServer = new IdentServer(this);
}
+ if (Quassel::isOptionSet("metrics-daemon")) {
+ _metricsServer = new MetricsServer(this);
+#ifdef HAVE_SSL
+ _server.setMetricsServer(_metricsServer);
+ _v6server.setMetricsServer(_metricsServer);
+#endif
+ }
+
Quassel::registerReloadHandler([]() {
// Currently, only reloading SSL certificates and the sysident cache is supported
if (Core::instance()) {
Quassel::registerReloadHandler([]() {
// Currently, only reloading SSL certificates and the sysident cache is supported
if (Core::instance()) {
@@
-672,6
+682,10
@@
bool Core::startListening()
_identServer->startListening();
}
_identServer->startListening();
}
+ if (_metricsServer) {
+ _metricsServer->startListening();
+ }
+
return success;
}
return success;
}
@@
-681,6
+695,10
@@
void Core::stopListening(const QString& reason)
_identServer->stopListening(reason);
}
_identServer->stopListening(reason);
}
+ if (_metricsServer) {
+ _metricsServer->stopListening(reason);
+ }
+
bool wasListening = false;
if (_server.isListening()) {
wasListening = true;
bool wasListening = false;
if (_server.isListening()) {
wasListening = true;