• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / storage / 20040498989

08 Dec 2025 07:37PM UTC coverage: 75.929% (+0.002%) from 75.927%
20040498989

Pull #811

github

web-flow
Merge 5c46e896c into 53e803c5b
Pull Request #811: feat: add version endpoint to admin api

2074 of 3010 branches covered (68.9%)

Branch coverage included in aggregate %.

7 of 8 new or added lines in 2 files covered. (87.5%)

25419 of 33199 relevant lines covered (76.57%)

94.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

65.67
/src/admin-app.ts
1
import fastify, { FastifyInstance, FastifyServerOptions } from 'fastify'
1✔
2
import { routes, plugins, setErrorHandler } from './http'
1✔
3
import { Registry } from 'prom-client'
1✔
4
import { getConfig } from './config'
1✔
5

1✔
6
declare module 'fastify-metrics' {
1✔
7
  interface IFastifyMetrics {
1✔
8
    getCustomDefaultMetricsRegistries(): Registry[]
1✔
9
    getCustomRouteMetricsRegistries(): Registry[]
1✔
10
  }
1✔
11
}
1✔
12

1✔
13
const { version } = getConfig()
1✔
14

1✔
15
const build = (opts: FastifyServerOptions = {}, appInstance?: FastifyInstance): FastifyInstance => {
1✔
16
  const app = fastify(opts)
1✔
17
  app.register(plugins.signals)
1✔
18
  app.register(plugins.adminTenantId)
1✔
19
  app.register(plugins.logRequest({ excludeUrls: ['/status', '/metrics', '/health', '/version'] }))
1✔
20
  app.register(routes.tenants, { prefix: 'tenants' })
1✔
21
  app.register(routes.objects, { prefix: 'tenants' })
1✔
22
  app.register(routes.jwks, { prefix: 'tenants' })
1✔
23
  app.register(routes.migrations, { prefix: 'migrations' })
1✔
24
  app.register(routes.s3Credentials, { prefix: 's3' })
1✔
25
  app.register(routes.queue, { prefix: 'queue' })
1✔
26

1✔
27
  let registriesToMerge: Registry[] = []
1✔
28

1✔
29
  if (appInstance) {
1!
30
    app.get('/metrics', async (req, reply) => {
×
31
      if (registriesToMerge.length === 0) {
×
32
        const globalRegistry = appInstance.metrics.client.register
×
33
        const defaultRegistries = appInstance.metrics.getCustomDefaultMetricsRegistries()
×
34
        const routeRegistries = appInstance.metrics.getCustomRouteMetricsRegistries()
×
35

×
36
        registriesToMerge = Array.from(
×
37
          new Set([globalRegistry, ...defaultRegistries, ...routeRegistries])
×
38
        )
×
39
      }
×
40

×
41
      if (registriesToMerge.length === 1) {
×
42
        const data = await registriesToMerge[0].metrics()
×
43
        return reply.type(registriesToMerge[0].contentType).send(data)
×
44
      }
×
45
      const merged = appInstance.metrics.client.Registry.merge(registriesToMerge)
×
46

×
47
      const data = await merged.metrics()
×
48

×
49
      return reply.type(merged.contentType).send(data)
×
50
    })
×
51
  } else {
1✔
52
    app.register(plugins.metrics({ enabledEndpoint: true }))
1✔
53
  }
1✔
54

1✔
55
  app.get('/version', (_, reply) => {
1✔
NEW
56
    reply.send(version)
×
57
  })
1✔
58
  app.get('/status', async (_, response) => response.status(200).send())
1✔
59

1✔
60
  setErrorHandler(app)
1✔
61

1✔
62
  return app
1✔
63
}
1✔
64

1✔
65
export default build
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc