|
26 | 26 | /* eslint-disable max-lines */
|
27 | 27 | import { logger, isPlainObject } from '../utils-hoist';
|
28 | 28 |
|
29 |
| -import type { Span, IntegrationFn } from '../types-hoist'; |
| 29 | +import type { IntegrationFn } from '../types-hoist'; |
30 | 30 | import { setHttpStatus, startInactiveSpan } from '../tracing';
|
31 | 31 | import { addBreadcrumb } from '../breadcrumbs';
|
32 | 32 | import { defineIntegration } from '../integration';
|
@@ -271,35 +271,28 @@ function instrumentPostgrestFilterBuilder(PostgrestFilterBuilder: PostgrestFilte
|
271 | 271 | }
|
272 | 272 | }
|
273 | 273 |
|
274 |
| - // TODO / Should? |
275 |
| - const shouldCreateSpan = true; |
276 |
| - |
277 |
| - let span: Span | undefined; |
278 |
| - |
279 |
| - if (shouldCreateSpan) { |
280 |
| - const attributes: Record<string, any> = { |
281 |
| - 'db.table': table, |
282 |
| - 'db.schema': typedThis.schema, |
283 |
| - 'db.url': typedThis.url.origin, |
284 |
| - 'db.sdk': typedThis.headers['X-Client-Info'], |
285 |
| - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.supabase', |
286 |
| - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `db.${operation}`, |
287 |
| - }; |
288 |
| - |
289 |
| - if (query.length) { |
290 |
| - attributes['db.query'] = query; |
291 |
| - } |
292 |
| - |
293 |
| - if (Object.keys(body).length) { |
294 |
| - attributes['db.body'] = body; |
295 |
| - } |
| 274 | + const attributes: Record<string, any> = { |
| 275 | + 'db.table': table, |
| 276 | + 'db.schema': typedThis.schema, |
| 277 | + 'db.url': typedThis.url.origin, |
| 278 | + 'db.sdk': typedThis.headers['X-Client-Info'], |
| 279 | + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.supabase', |
| 280 | + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `db.${operation}`, |
| 281 | + }; |
| 282 | + |
| 283 | + if (query.length) { |
| 284 | + attributes['db.query'] = query; |
| 285 | + } |
296 | 286 |
|
297 |
| - span = startInactiveSpan({ |
298 |
| - name: description, |
299 |
| - attributes, |
300 |
| - }); |
| 287 | + if (Object.keys(body).length) { |
| 288 | + attributes['db.body'] = body; |
301 | 289 | }
|
302 | 290 |
|
| 291 | + const span = startInactiveSpan({ |
| 292 | + name: description, |
| 293 | + attributes, |
| 294 | + }); |
| 295 | + |
303 | 296 | return (Reflect.apply(target, thisArg, []) as Promise<SupabaseResponse>)
|
304 | 297 | .then(
|
305 | 298 | (res: SupabaseResponse) => {
|
@@ -334,33 +327,28 @@ function instrumentPostgrestFilterBuilder(PostgrestFilterBuilder: PostgrestFilte
|
334 | 327 | });
|
335 | 328 | }
|
336 | 329 |
|
337 |
| - // Todo / Should? |
338 |
| - const shouldCreateBreadcrumb = true; |
339 |
| - |
340 |
| - if (shouldCreateBreadcrumb) { |
341 |
| - const breadcrumb: SupabaseBreadcrumb = { |
342 |
| - type: 'supabase', |
343 |
| - category: `db.${operation}`, |
344 |
| - message: description, |
345 |
| - }; |
| 330 | + const breadcrumb: SupabaseBreadcrumb = { |
| 331 | + type: 'supabase', |
| 332 | + category: `db.${operation}`, |
| 333 | + message: description, |
| 334 | + }; |
346 | 335 |
|
347 |
| - const data: Record<string, unknown> = {}; |
| 336 | + const data: Record<string, unknown> = {}; |
348 | 337 |
|
349 |
| - if (query.length) { |
350 |
| - data.query = query; |
351 |
| - } |
352 |
| - |
353 |
| - if (Object.keys(body).length) { |
354 |
| - data.body = body; |
355 |
| - } |
| 338 | + if (query.length) { |
| 339 | + data.query = query; |
| 340 | + } |
356 | 341 |
|
357 |
| - if (Object.keys(data).length) { |
358 |
| - breadcrumb.data = data; |
359 |
| - } |
| 342 | + if (Object.keys(body).length) { |
| 343 | + data.body = body; |
| 344 | + } |
360 | 345 |
|
361 |
| - addBreadcrumb(breadcrumb); |
| 346 | + if (Object.keys(data).length) { |
| 347 | + breadcrumb.data = data; |
362 | 348 | }
|
363 | 349 |
|
| 350 | + addBreadcrumb(breadcrumb); |
| 351 | + |
364 | 352 | return res;
|
365 | 353 | },
|
366 | 354 | (err: Error) => {
|
|
0 commit comments