mirror of
https://github.com/graphql-hive/console
synced 2026-05-24 09:38:26 +00:00
Use Histogram for write and process duration
This commit is contained in:
parent
1efe248632
commit
7796375862
3 changed files with 12 additions and 4 deletions
|
|
@ -3,6 +3,7 @@ import { decompress } from '@hive/usage-common';
|
|||
import {
|
||||
errors,
|
||||
processTime,
|
||||
processDuration,
|
||||
reportMessageBytes,
|
||||
ingestedOperationsWrites,
|
||||
ingestedOperationsFailures,
|
||||
|
|
@ -150,6 +151,7 @@ export function createIngestor(config: {
|
|||
partitionsConsumedConcurrently: config.kafka.concurrency,
|
||||
eachMessage({ message }) {
|
||||
const stopTimer = processTime.startTimer();
|
||||
const processDurationStop = processDuration.startTimer();
|
||||
return processMessage({
|
||||
message,
|
||||
logger,
|
||||
|
|
@ -162,6 +164,7 @@ export function createIngestor(config: {
|
|||
})
|
||||
.finally(() => {
|
||||
stopTimer();
|
||||
processDurationStop();
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -20,8 +20,13 @@ export const processTime = new metrics.Summary({
|
|||
help: 'Time spent processing and writing reports',
|
||||
});
|
||||
|
||||
export const writeTime = new metrics.Summary({
|
||||
name: 'usage_ingestor_write_time',
|
||||
export const processDuration = new metrics.Histogram({
|
||||
name: 'usage_ingestor_process_duration_seconds',
|
||||
help: 'Time spent processing and writing reports',
|
||||
});
|
||||
|
||||
export const writeDuration = new metrics.Histogram({
|
||||
name: 'usage_ingestor_write_duration_seconds',
|
||||
help: 'Time spent writing reports',
|
||||
labelNames: ['query', 'destination', 'status'],
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
legacyRegistryOrder,
|
||||
joinIntoSingleMessage,
|
||||
} from './serializer';
|
||||
import { writeTime } from './metrics';
|
||||
import { writeDuration } from './metrics';
|
||||
|
||||
function hasResponse(error: unknown): error is {
|
||||
response: GotResponse;
|
||||
|
|
@ -138,7 +138,7 @@ async function writeCsv(
|
|||
logger: FastifyLoggerInstance,
|
||||
maxRetry: number
|
||||
) {
|
||||
const stopTimer = writeTime.startTimer({
|
||||
const stopTimer = writeDuration.startTimer({
|
||||
query,
|
||||
destination: config.host,
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue