@lokalise/fastify-extras
Version:
Opinionated set of fastify plugins, commonly used in Lokalise
27 lines (26 loc) • 1.39 kB
TypeScript
import type { TransactionObservabilityManager } from '@lokalise/node-core';
import type { IFastifyMetrics } from 'fastify-metrics';
/**
* TransactionObservabilityManager implementation that uses Prometheus counter
* to track the number of started, failed and success transactions.
*/
export declare class PrometheusCounterTransactionManager<CustomLabels extends string = never> implements TransactionObservabilityManager {
private readonly metricName;
private readonly metricDescription;
private readonly supportedCustomLabels;
private readonly counter?;
private readonly transactionNameByKey;
private readonly customLabelsByKey;
constructor(metricName: string, metricDescription: string, appMetrics?: IFastifyMetrics, customLabels?: Array<CustomLabels>);
start(transactionName: string, uniqueTransactionKey: string): void;
startWithGroup(transactionName: string, uniqueTransactionKey: string, _transactionGroup: string): void;
stop(uniqueTransactionKey: string, wasSuccessful?: boolean): void;
/**
* Prometheus labels are the way Prometheus handles custom attributes
* Note that it will skip any attributes that were not included in the constructor param "customLabels"
*/
addCustomAttributes(uniqueTransactionKey: string, atts: {
[p: string]: string | number | boolean;
}): void;
private registerMetric;
}