aboutsummaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2021-12-30 22:02:36 -0600
committermat <github@matdoes.dev>2021-12-30 22:02:36 -0600
commit0493cb2600f16ae38ab0d0f496358dcd6030ebe0 (patch)
tree0d3c377a85366253526c2e97c2cec11441ef2755 /src/index.ts
parent1dc1752adf4b3191fe3debf8a0dc8b4f78b37950 (diff)
downloadskyblock-api-0493cb2600f16ae38ab0d0f496358dcd6030ebe0.tar.gz
skyblock-api-0493cb2600f16ae38ab0d0f496358dcd6030ebe0.tar.bz2
skyblock-api-0493cb2600f16ae38ab0d0f496358dcd6030ebe0.zip
database metrics
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/index.ts b/src/index.ts
index 613d7c8..7332805 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,4 +1,4 @@
-import { createSession, fetchAccountFromDiscord, fetchAllLeaderboardsCategorized, fetchLeaderboard, fetchMemberLeaderboardSpots, fetchSession, finishedCachingRawLeaderboards, leaderboardUpdateMemberQueue, leaderboardUpdateProfileQueue, updateAccount } from './database.js'
+import { createSession, fetchAccountFromDiscord, fetchAllLeaderboardsCategorized, fetchLeaderboard, fetchMemberLeaderboardSpots, fetchSession, finishedCachingRawLeaderboards, leaderboardUpdateMemberQueue, leaderboardUpdateProfileQueue, updateAccount, fetchServerStatus } from './database.js'
import { fetchMemberProfile, fetchUser } from './hypixel.js'
import rateLimit from 'express-rate-limit'
import * as constants from './constants.js'
@@ -6,7 +6,7 @@ import * as discord from './discord.js'
import express from 'express'
import { getKeyUsage } from './hypixelApi.js'
import { basicPlayerCache, basicProfilesCache, playerCache, profileCache, profileNameCache, profilesCache, usernameCache } from './hypixelCached.js'
-import { collectDefaultMetrics, Counter, Gauge, register } from 'prom-client'
+import { register } from './metrics.js'
const app = express()
@@ -189,19 +189,6 @@ app.post('/accounts/update', async (req, res) => {
})
-// grafana integration
-collectDefaultMetrics()
-
-const apiKeyCounter = new Gauge({
- name: 'hypixel_api_key_usage',
- help: 'API requests in the past minute.',
- registers: [ register ],
- collect() {
- let keyUsage = getKeyUsage()
- apiKeyCounter.set(keyUsage.usage)
- }
-})
-
app.get('/metrics', async (req, res) => {
if (!req.headers.host?.startsWith('0.0.0.0:'))
return res.status(403).send('Forbidden')