@axinom/mosaic-transactional-inbox-outbox
Version:
This library encapsulates the Mosaic based transactional inbox and outbox pattern
17 lines • 1.22 kB
TypeScript
import { Pool } from 'pg';
import { Metric } from 'prom-client';
import { StoreOutboxMessage } from '../outbox';
/**
* Creates a `Gauge` metric with the name `ax_messaging` which can be added to a metric registry.
* This metric will have an integer value of the duration in seconds if the service can acquire a
* service account token, send a message, and afterwards receive it. Or a value of `0` otherwise.
*
* @param healthCheckRoutingKey The RabbitMQ routing key for sending the outbox message
* @param storeOutboxMessage The outbox storage function for starting the message processing
* @param getAccessToken Get the access token with admin permissions to include in the message
* @param ownerPool The database owner pool as this is independent of an environment
* @param timeoutMs The optinal timeout in milliseconds after which the messaging should be considered as failure
* @returns A `Gauge` metric with a name `ax_messaging`.
*/
export declare const createMessagingMetric: (healthCheckRoutingKey: string, storeOutboxMessage: StoreOutboxMessage, getAccessToken: () => Promise<string>, ownerPool: Pool, timeoutMs?: number) => Metric<string>;
//# sourceMappingURL=messaging-health-metrics.d.ts.map