-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmetrics.py
112 lines (91 loc) · 2.8 KB
/
metrics.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
from prometheus_client import Counter, Gauge
METRIC_PREFIX = "discord_"
CONNECTION_GAUGE = Gauge(
METRIC_PREFIX + "connected",
"Determines if the bot is connected to Discord",
["shard"],
)
LATENCY_GAUGE = Gauge(
METRIC_PREFIX + "latency",
"latency to Discord",
["shard"],
)
ON_INTERACTION_COUNTER = Counter(
METRIC_PREFIX + "event_on_interaction",
"Amount of interactions called by users",
["is_user_installed"],
)
ON_COMMAND_COUNTER = Counter(
METRIC_PREFIX + "event_on_command",
"Amount of commands called by users",
)
GUILD_GAUGE = Gauge(
METRIC_PREFIX + "stat_total_guilds", "Amount of guild this bot is a member of"
)
CHANNEL_GAUGE = Gauge(
METRIC_PREFIX + "stat_total_channels",
"Amount of channels this bot is has access to",
)
REGISTERED_USER_GAUGE = Gauge(
METRIC_PREFIX + "stat_total_registered_users",
"Amount of users registered in the bot",
)
COMMANDS_GAUGE = Gauge(
METRIC_PREFIX + "stat_total_commands", "Amount of commands registered in the bot"
)
RAM_USAGE_GAUGE = Gauge(METRIC_PREFIX + "ram_usage", "Amount of RAM used by the bot")
CPU_USAGE_GAUGE = Gauge(METRIC_PREFIX + "cpu_usage", "Amount of CPU used by the bot")
MEMORY_USAGE_GAUGE = Gauge(
METRIC_PREFIX + "memory_usage", "Amount of memory used by the bot"
)
API_REQUESTS_COUNTER = Counter(
METRIC_PREFIX + "api_requests",
"Amount of requests made to the Killua API",
["endpoint", "type"],
)
API_RESPONSE_TIME = Gauge(
METRIC_PREFIX + "api_response_time", "Response time of the Killua API"
)
IPC_RESPONSE_TIME = Gauge(
METRIC_PREFIX + "ipc_response_time", "Response time of the IPC server"
)
API_SPAM_REQUESTS = Counter(
METRIC_PREFIX + "api_spam_requests",
"Amount of requests that are attempted malice to my API",
)
DAILY_ACTIVE_USERS = Gauge(
METRIC_PREFIX + "daily_active_users", "Amount of users that use the bot daily"
)
APPROXIMATE_USER_COUNT = Gauge(
METRIC_PREFIX + "approximate_user_count", "Combined amount of users in all guilds the bot is on"
)
USER_INSTALLS = Gauge(
METRIC_PREFIX + "user_installs", "Amount of users that have installed the bot to their account"
)
COMMAND_USAGE = Gauge(
METRIC_PREFIX + "command_usage",
"Amount of times a command was used",
["group", "command", "command_id"],
)
PREMIUM_USERS = Gauge(
METRIC_PREFIX + "premium_users", "Amount of users that have premium"
)
VOTES = Counter(
METRIC_PREFIX + "votes",
"Amount of votes the bot has received",
["platform"],
)
TODO_LISTS = Gauge(METRIC_PREFIX + "todo_lists", "Amount of todo lists created")
TODOS = Gauge(
METRIC_PREFIX + "todos",
"Amount of todos created",
)
TAGS = Gauge(
METRIC_PREFIX + "tags",
"Amount of tags created",
)
LOCALE = Gauge(
METRIC_PREFIX + "locale",
"Where users are from",
["country"],
)