Additional metrics

This commit is contained in:
2023-10-16 20:23:16 -06:00
parent 295b217539
commit 84b6b9f385
4 changed files with 39 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ import { Response } from 'express';
import { identity, prop } from 'ramda';
import * as xml from 'xml';
import { InjectMetric } from '@willsoto/nestjs-prometheus';
import { Gauge } from 'prom-client';
import { Gauge, Histogram } from 'prom-client';
import { ApiTags } from '@nestjs/swagger';
const episodeFiles: [number, string][] = [
@@ -147,10 +147,12 @@ export class DinosaurwetController {
constructor(
@InjectMetric('weekly_count') public weeklyCount: Gauge<string>,
@InjectMetric('daily_count') public dailyCount: Gauge<string>,
@InjectMetric('rss_query_count') public queryCount: Gauge<string>,
) {}
@Get('')
getAllAtOnce(@Res() response: Response) {
this.queryCount.inc();
response.header('Content-Type', 'application/xml');
const feed = buildFeeds('Dinosaur Wet - All At Once', episodes);
return response.send(feed);
@@ -158,6 +160,7 @@ export class DinosaurwetController {
@Get('daily')
getDaily(@Res() response: Response) {
this.queryCount.inc();
response.header('Content-Type', 'application/xml');
const feed = buildFeeds(
'Dinosaur Wet - Daily',
@@ -171,6 +174,7 @@ export class DinosaurwetController {
@Get('weekly')
getWeekly(@Res() response: Response) {
this.queryCount.inc();
response.header('Content-Type', 'application/xml');
const feed = buildFeeds(
'Dinosaur Wet - Weekly',