@@ -54,7 +54,6 @@ import {
54
54
SKINS_UNIQUE ,
55
55
Stats
56
56
} from "./Stats" ;
57
- import { IPoint } from "influx" ;
58
57
import { DelayInfo } from "../typings/DelayInfo" ;
59
58
import { Capes } from "../util/Capes" ;
60
59
import { requestShutdown } from "../index" ;
@@ -260,91 +259,91 @@ export class Generator {
260
259
let usableAccounts = usableAccountDocs . length ;
261
260
this . usableAccounts = usableAccounts ;
262
261
263
- let accountsPerProxy : { [ k : string ] : number } = { } ;
264
- for ( let acc of usableAccountDocs ) {
265
- let key = acc . requestServer ;
266
- if ( ! key || key === "null" ) {
267
- key = "default" ;
268
- }
269
- accountsPerProxy [ key ] = ( accountsPerProxy [ key ] || 0 ) + 1 ;
270
- }
271
-
272
- const accountTypes = await Account . aggregate ( [
273
- {
274
- "$match" : {
275
- requestServer : { $in : [ "default" , ...await this . getRequestServers ( ) ] }
276
- }
277
- } , {
278
- "$group" :
279
- {
280
- _id : "$accountType" ,
281
- count : { $sum : 1 }
282
- }
283
- }
284
- ] ) . exec ( ) . then ( ( res : any [ ] ) => {
285
- let counts : { [ type : string ] : number ; } = { } ;
286
- res . forEach ( e => {
287
- counts [ e [ "_id" ] ] = e [ "count" ] ;
288
- } )
289
- return counts ;
290
- } ) ;
291
-
292
- try {
293
- const metrics = container . get < IMetricsProvider > ( CoreTypes . MetricsProvider ) ;
294
- await metrics . getMetrics ( ) . influx . writePoints ( [
295
- {
296
- measurement : 'accounts' ,
297
- tags : {
298
- server : HOSTNAME
299
- } ,
300
- fields : {
301
- totalServer : serverAccounts ,
302
- useable : usableAccounts
303
- }
304
- }
305
- ] , {
306
- database : 'mineskin' ,
307
- precision : 's'
308
- } )
309
- for ( let p in accountsPerProxy ) {
310
- await metrics . getMetrics ( ) . influx . writePoints ( [
311
- {
312
- measurement : 'proxy_accounts' ,
313
- tags : {
314
- server : HOSTNAME ,
315
- proxy : p
316
- } ,
317
- fields : {
318
- useable : accountsPerProxy [ p ]
319
- }
320
- }
321
- ] , {
322
- database : 'mineskin' ,
323
- precision : 's'
324
- } )
325
- }
262
+ // let accountsPerProxy: { [k: string]: number } = {};
263
+ // for (let acc of usableAccountDocs) {
264
+ // let key = acc.requestServer;
265
+ // if (!key || key === "null") {
266
+ // key = "default";
267
+ // }
268
+ // accountsPerProxy[key] = (accountsPerProxy[key] || 0) + 1;
269
+ // }
326
270
327
- let accountsPerTypePoints : IPoint [ ] = [ ] ;
328
- for ( let accountType in accountTypes ) {
329
- accountsPerTypePoints . push ( {
330
- measurement : 'account_types' ,
331
- tags : {
332
- server : HOSTNAME ,
333
- type : accountType
334
- } ,
335
- fields : {
336
- count : accountTypes [ accountType ]
337
- }
338
- } )
339
- }
340
- await metrics . getMetrics ( ) . influx . writePoints ( accountsPerTypePoints , {
341
- database : 'mineskin' ,
342
- precision : 's'
343
- } )
344
- } catch ( e ) {
345
- console . warn ( e ) ;
346
- Sentry . captureException ( e ) ;
347
- }
271
+ // const accountTypes = await Account.aggregate([
272
+ // {
273
+ // "$match": {
274
+ // requestServer: {$in: ["default", ...await this.getRequestServers()]}
275
+ // }
276
+ // }, {
277
+ // "$group":
278
+ // {
279
+ // _id: "$accountType",
280
+ // count: {$sum: 1}
281
+ // }
282
+ // }
283
+ // ]).exec().then((res: any[]) => {
284
+ // let counts: { [type: string]: number; } = {};
285
+ // res.forEach(e => {
286
+ // counts[e["_id"]] = e["count"];
287
+ // })
288
+ // return counts;
289
+ // });
290
+
291
+ // try {
292
+ // const metrics = container.get<IMetricsProvider>(CoreTypes.MetricsProvider);
293
+ // await metrics.getMetrics().influx.writePoints([
294
+ // {
295
+ // measurement: 'accounts',
296
+ // tags: {
297
+ // server: HOSTNAME
298
+ // },
299
+ // fields: {
300
+ // totalServer: serverAccounts,
301
+ // useable: usableAccounts
302
+ // }
303
+ // }
304
+ // ], {
305
+ // database: 'mineskin',
306
+ // precision: 's'
307
+ // })
308
+ // for (let p in accountsPerProxy) {
309
+ // await metrics.getMetrics().influx.writePoints([
310
+ // {
311
+ // measurement: 'proxy_accounts',
312
+ // tags: {
313
+ // server: HOSTNAME,
314
+ // proxy: p
315
+ // },
316
+ // fields: {
317
+ // useable: accountsPerProxy[p]
318
+ // }
319
+ // }
320
+ // ], {
321
+ // database: 'mineskin',
322
+ // precision: 's'
323
+ // })
324
+ // }
325
+ //
326
+ // let accountsPerTypePoints: IPoint[] = [];
327
+ // for (let accountType in accountTypes) {
328
+ // accountsPerTypePoints.push({
329
+ // measurement: 'account_types',
330
+ // tags: {
331
+ // server: HOSTNAME,
332
+ // type: accountType
333
+ // },
334
+ // fields: {
335
+ // count: accountTypes[accountType]
336
+ // }
337
+ // })
338
+ // }
339
+ // await metrics.getMetrics().influx.writePoints(accountsPerTypePoints, {
340
+ // database: 'mineskin',
341
+ // precision: 's'
342
+ // })
343
+ // } catch (e) {
344
+ // console.warn(e);
345
+ // Sentry.captureException(e);
346
+ // }
348
347
349
348
console . log ( debug ( `Took ${ ( Date . now ( ) - start ) } ms for account stats` ) ) ;
350
349
}
0 commit comments