mirror of
https://github.com/wassname/talk.git
synced 2026-08-07 11:29:44 +08:00
* feat: client implementation of subscriptions and modqueue live counts * fix: unit tests * feat: live status update in moderation * feat: live update of new comments in moderation * chore: View New instead of View More * feat: fade in transition for new comments * chore: turn websocket proxy back on * feat: initial server impl * fix: make it work :-) * fix: add box shadow * chore: make test subscriptions only support 1 top level field following the spec * fix: linting * feat: support clientID * fix: linting * feat: support commentStatusUpdated subscription * fix: disabled styles for approve and reject button * feat: show moderated by system and update flags * feat: support metrics recording on websocket connections * fix: handle when same comment enters but leaves again
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import { Counter, Histogram } from "prom-client";
|
|
|
|
export interface Metrics {
|
|
executedGraphQueriesTotalCounter: Counter;
|
|
graphQLExecutionTimingsHistogram: Histogram;
|
|
httpRequestsTotal: Counter;
|
|
httpRequestDurationMilliseconds: Histogram;
|
|
}
|
|
|
|
export function createMetrics(): Metrics {
|
|
// Configure the metrics handlers.
|
|
const executedGraphQueriesTotalCounter = new Counter({
|
|
name: "coral_executed_graph_queries_total",
|
|
help: "number of GraphQL queries executed",
|
|
labelNames: ["operation_type", "operation_name"],
|
|
});
|
|
|
|
const graphQLExecutionTimingsHistogram = new Histogram({
|
|
name: "coral_executed_graph_queries_timings",
|
|
help: "timings for execution times of GraphQL operations",
|
|
buckets: [0.1, 5, 15, 50, 100, 500],
|
|
labelNames: ["operation_type", "operation_name"],
|
|
});
|
|
|
|
const httpRequestsTotal = new Counter({
|
|
name: "http_requests_total",
|
|
help: "Total number of HTTP requests made.",
|
|
labelNames: ["code", "method"],
|
|
});
|
|
|
|
const httpRequestDurationMilliseconds = new Histogram({
|
|
name: "http_request_duration_milliseconds",
|
|
help: "Histogram of latencies for HTTP requests.",
|
|
buckets: [0.1, 5, 15, 50, 100, 500],
|
|
labelNames: ["method", "handler"],
|
|
});
|
|
|
|
return {
|
|
executedGraphQueriesTotalCounter,
|
|
graphQLExecutionTimingsHistogram,
|
|
httpRequestsTotal,
|
|
httpRequestDurationMilliseconds,
|
|
};
|
|
}
|