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

supabase / storage / 22971456993

11 Mar 2026 07:49PM UTC coverage: 76.296% (+0.09%) from 76.204%
22971456993

push

github

web-flow
fix: improve performance, upgraded otel fastify (#902)

* fix: improve performance, upgraded otel fastify

* fix: Update monitoring/grafana/dashboards/storage-otel.json

4029 of 5727 branches covered (70.35%)

Branch coverage included in aggregate %.

280 of 368 new or added lines in 7 files covered. (76.09%)

5 existing lines in 4 files now uncovered.

26790 of 34667 relevant lines covered (77.28%)

185.75 hits per line

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

44.23
/src/http/plugins/tracing.ts
1
import { getTenantConfig } from '@internal/database'
2✔
2
import { logSchema } from '@internal/monitoring'
2✔
3
import fastifyPlugin from 'fastify-plugin'
2✔
4
import { getConfig } from '../../config'
2✔
5

2✔
6
declare module 'fastify' {
2✔
7
  interface FastifyRequest {
2✔
8
    tracingMode?: string
2✔
9
    serverTimings?: { spanName: string; duration: number }[]
2✔
10
  }
2✔
11
}
2✔
12

2✔
13
const { isMultitenant, tracingEnabled, tracingMode: defaultTracingMode } = getConfig()
2✔
14

2✔
15
export const tracing = fastifyPlugin(
2✔
16
  async function tracingMode(fastify) {
2✔
17
    if (!tracingEnabled) {
264✔
18
      return
264✔
19
    }
264✔
20

×
21
    fastify.addHook('onRequest', async (request) => {
×
22
      try {
×
23
        if (isMultitenant && request.tenantId) {
×
24
          const tenantConfig = await getTenantConfig(request.tenantId)
×
25
          request.tracingMode = tenantConfig.tracingMode
×
26
        } else {
×
27
          request.tracingMode = defaultTracingMode
×
28
        }
×
NEW
29

×
NEW
30
        // Use request.opentelemetry().span to get the root request span,
×
NEW
31
        // not trace.getActiveSpan() which returns a child hook span.
×
NEW
32
        const span =
×
NEW
33
          typeof request.opentelemetry === 'function' ? request.opentelemetry()?.span : undefined
×
NEW
34
        if (span) {
×
NEW
35
          if (request.tenantId) {
×
NEW
36
            span.setAttribute('tenant.ref', request.tenantId)
×
NEW
37
          }
×
NEW
38
          if (request.tracingMode) {
×
NEW
39
            span.setAttribute('trace.mode', request.tracingMode)
×
NEW
40
          }
×
NEW
41
        }
×
42
      } catch (e) {
×
43
        logSchema.error(request.log, 'failed setting tracing mode', { error: e, type: 'tracing' })
×
44
      }
×
45
    })
×
46
  },
×
47
  { name: 'tracing-mode' }
2✔
48
)
2✔
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