1
- import type { FastifyInstance } from 'fastify'
2
1
import fp from 'fastify-plugin'
3
-
4
- import type { CommonLogger } from '@lokalise/node-core'
5
- import type { FastifyTypeProviderDefault } from 'fastify/types/type-provider'
6
- import type {
7
- RawReplyDefaultExpression ,
8
- RawRequestDefaultExpression ,
9
- RawServerDefault ,
10
- } from 'fastify/types/utils'
2
+ import type { AnyFastifyInstance , CommonFastifyInstance } from '../pluginsCommon'
11
3
import type { HealthChecker } from './healthcheckCommons'
12
4
13
5
const VALID_PROMETHEUS_NAME_REGEX = / [ a - z A - Z _ : ] [ a - z A - Z 0 - 9 _ : ] * /
@@ -23,15 +15,7 @@ export type HealthcheckResult = {
23
15
24
16
export type PrometheusHealthCheck = {
25
17
name : string
26
- checker : (
27
- app : FastifyInstance <
28
- RawServerDefault ,
29
- RawRequestDefaultExpression ,
30
- RawReplyDefaultExpression ,
31
- CommonLogger ,
32
- FastifyTypeProviderDefault
33
- > ,
34
- ) => Promise < HealthcheckResult >
18
+ checker : ( app : CommonFastifyInstance ) => Promise < HealthcheckResult >
35
19
}
36
20
37
21
/**
@@ -43,15 +27,7 @@ export const wrapHealthCheckForPrometheus = (
43
27
) : PrometheusHealthCheck => {
44
28
return {
45
29
name : healthcheckName ,
46
- checker : async (
47
- app : FastifyInstance <
48
- RawServerDefault ,
49
- RawRequestDefaultExpression ,
50
- RawReplyDefaultExpression ,
51
- CommonLogger ,
52
- FastifyTypeProviderDefault
53
- > ,
54
- ) : Promise < HealthcheckResult > => {
30
+ checker : async ( app : CommonFastifyInstance ) : Promise < HealthcheckResult > => {
55
31
const startTime = Date . now ( )
56
32
const response = await healthCheck ( app )
57
33
const checkTimeInMsecs = Date . now ( ) - startTime
@@ -65,13 +41,7 @@ export const wrapHealthCheckForPrometheus = (
65
41
}
66
42
67
43
function plugin (
68
- app : FastifyInstance <
69
- RawServerDefault ,
70
- RawRequestDefaultExpression ,
71
- RawReplyDefaultExpression ,
72
- CommonLogger ,
73
- FastifyTypeProviderDefault
74
- > ,
44
+ app : AnyFastifyInstance ,
75
45
opts : HealthcheckMetricsPluginOptions ,
76
46
done : ( err ?: Error ) => void ,
77
47
) {
0 commit comments