.BANCHO. Add Datadog stats report

This commit is contained in:
Nyo 2016-10-06 23:06:59 +02:00
parent 05f09ad35b
commit f155b0567c
2 changed files with 25 additions and 0 deletions

View File

@ -56,6 +56,10 @@ class config:
self.config.get("discord","boturl")
self.config.get("discord","devgroup")
self.config.get("datadog", "enable")
self.config.get("datadog", "apikey")
self.config.get("datadog", "appkey")
self.config.get("irc","enable")
self.config.get("irc","port")
self.config.get("irc","hostname")
@ -104,6 +108,11 @@ class config:
self.config.set("discord", "boturl", "")
self.config.set("discord", "devgroup", "")
self.config.add_section("datadog")
self.config.set("datadog", "enable")
self.config.set("datadog", "apikey")
self.config.set("datadog", "appkey")
self.config.add_section("irc")
self.config.set("irc", "enable", "1")
self.config.set("irc", "port", "6667")

16
pep.py
View File

@ -13,6 +13,7 @@ from raven.contrib.tornado import AsyncSentryClient
from common import generalUtils
from common.constants import bcolors
from common.db import dbConnector
from common.ddog import datadogClient
from common.log import logUtils as log
from common.ripple import userUtils
from common.web import schiavo
@ -190,6 +191,21 @@ if __name__ == "__main__":
except:
consoleHelper.printColored("[!] Error while starting sentry client! Please check your config.ini and run the server again", bcolors.RED)
# Set up datadog
try:
if generalUtils.stringToBool(glob.conf.config["datadog"]["enable"]):
glob.dog = datadogClient.datadogClient(
glob.conf.config["datadog"]["apikey"],
glob.conf.config["datadog"]["appkey"],
[
datadogClient.periodicCheck("online_users", lambda: len(glob.tokens.tokens)),
datadogClient.periodicCheck("multiplayer_matches", lambda: len(glob.matches.matches)),
])
else:
consoleHelper.printColored("[!] Warning! Datadog stats tracking is disabled!", bcolors.YELLOW)
except:
consoleHelper.printColored("[!] Error while starting Datadog client! Please check your config.ini and run the server again", bcolors.RED)
# Cloudflare memes
glob.cloudflare = generalUtils.stringToBool(glob.conf.config["server"]["cloudflare"])