mirror of
https://github.com/SrIzan10/hctv.git
synced 2026-06-06 00:56:56 +00:00
chore(metrics): redesign with opus because of course
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
recordChatModerationBlock,
|
||||
recordDeliveredChatMessage,
|
||||
recordDeliveredChatMessageBytes,
|
||||
recordEmojiSearchResults,
|
||||
recordHistoryMessagesLoaded,
|
||||
recordIncomingChatMessage,
|
||||
recordUniqueChatter,
|
||||
@@ -772,6 +773,7 @@ app.get(
|
||||
const rawSearchTerm = (msg.searchTerm as string)?.trim() ?? '';
|
||||
if (!rawSearchTerm || rawSearchTerm.length > 50) {
|
||||
ws.send(JSON.stringify({ type: 'emojiSearchResponse', results: [] }));
|
||||
recordEmojiSearchResults('empty', 0);
|
||||
outcome = 'emoji_search_empty';
|
||||
return;
|
||||
}
|
||||
@@ -802,6 +804,7 @@ app.get(
|
||||
results: results,
|
||||
})
|
||||
);
|
||||
recordEmojiSearchResults('matched', results.length);
|
||||
outcome = 'emoji_search';
|
||||
} else {
|
||||
ws.send(
|
||||
@@ -810,6 +813,7 @@ app.get(
|
||||
results: [],
|
||||
})
|
||||
);
|
||||
recordEmojiSearchResults('no_match', 0);
|
||||
outcome = 'emoji_search_empty';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +114,14 @@ function createMetricsStore() {
|
||||
registers: [register],
|
||||
});
|
||||
|
||||
const emojiSearchResults = new Histogram({
|
||||
name: 'hctv_chat_emoji_search_results',
|
||||
help: 'Number of emoji search results returned per query.',
|
||||
labelNames: ['outcome'],
|
||||
buckets: [0, 1, 2, 5, 10, 25, 50, 100, 150],
|
||||
registers: [register],
|
||||
});
|
||||
|
||||
const errors = new Counter({
|
||||
name: 'hctv_chat_errors_total',
|
||||
help: 'Errors observed in the chat service grouped by phase.',
|
||||
@@ -126,6 +134,7 @@ function createMetricsStore() {
|
||||
deliveredMessageBytes,
|
||||
channelHistoryLoadedMessages,
|
||||
channelHistorySize,
|
||||
emojiSearchResults,
|
||||
errors,
|
||||
inboundPayloadBytes,
|
||||
incomingMessages,
|
||||
@@ -232,3 +241,7 @@ export function recordChatModerationBlock(reason: string): void {
|
||||
export function recordChatError(phase: string): void {
|
||||
metrics.errors.inc({ phase });
|
||||
}
|
||||
|
||||
export function recordEmojiSearchResults(outcome: string, count: number): void {
|
||||
metrics.emojiSearchResults.observe({ outcome }, count);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user