Files
talk/src/core/server/services/metrics/index.ts
T
VinhandWyatt Johnson 413f3e2f1e [CORL-166] Live Updates on Mod Queues (#2368)
* 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
2019-06-21 17:01:07 +00:00

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,
};
}