@sentry/core 10.41.0-beta.0 → 10.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/build/cjs/client.js +10 -0
  2. package/build/cjs/client.js.map +1 -1
  3. package/build/cjs/index.js +2 -0
  4. package/build/cjs/index.js.map +1 -1
  5. package/build/cjs/integrations/consola.js +103 -12
  6. package/build/cjs/integrations/consola.js.map +1 -1
  7. package/build/cjs/integrations/postgresjs.js +434 -0
  8. package/build/cjs/integrations/postgresjs.js.map +1 -0
  9. package/build/cjs/server-runtime-client.js +28 -0
  10. package/build/cjs/server-runtime-client.js.map +1 -1
  11. package/build/cjs/tracing/langchain/index.js +11 -2
  12. package/build/cjs/tracing/langchain/index.js.map +1 -1
  13. package/build/cjs/tracing/langchain/utils.js +39 -6
  14. package/build/cjs/tracing/langchain/utils.js.map +1 -1
  15. package/build/cjs/utils/version.js +1 -1
  16. package/build/cjs/utils/version.js.map +1 -1
  17. package/build/esm/client.js +10 -0
  18. package/build/esm/client.js.map +1 -1
  19. package/build/esm/index.js +1 -0
  20. package/build/esm/index.js.map +1 -1
  21. package/build/esm/integrations/consola.js +104 -13
  22. package/build/esm/integrations/consola.js.map +1 -1
  23. package/build/esm/integrations/postgresjs.js +430 -0
  24. package/build/esm/integrations/postgresjs.js.map +1 -0
  25. package/build/esm/package.json +1 -1
  26. package/build/esm/server-runtime-client.js +28 -0
  27. package/build/esm/server-runtime-client.js.map +1 -1
  28. package/build/esm/tracing/langchain/index.js +11 -2
  29. package/build/esm/tracing/langchain/index.js.map +1 -1
  30. package/build/esm/tracing/langchain/utils.js +39 -6
  31. package/build/esm/tracing/langchain/utils.js.map +1 -1
  32. package/build/esm/utils/version.js +1 -1
  33. package/build/esm/utils/version.js.map +1 -1
  34. package/build/types/client.d.ts +13 -3
  35. package/build/types/client.d.ts.map +1 -1
  36. package/build/types/index.d.ts +1 -0
  37. package/build/types/index.d.ts.map +1 -1
  38. package/build/types/integrations/consola.d.ts +9 -4
  39. package/build/types/integrations/consola.d.ts.map +1 -1
  40. package/build/types/integrations/postgresjs.d.ts +62 -0
  41. package/build/types/integrations/postgresjs.d.ts.map +1 -0
  42. package/build/types/server-runtime-client.d.ts +12 -0
  43. package/build/types/server-runtime-client.d.ts.map +1 -1
  44. package/build/types/tracing/langchain/index.d.ts.map +1 -1
  45. package/build/types/tracing/langchain/utils.d.ts.map +1 -1
  46. package/build/types/types-hoist/replay.d.ts +0 -1
  47. package/build/types/types-hoist/replay.d.ts.map +1 -1
  48. package/build/types-ts3.8/client.d.ts +13 -3
  49. package/build/types-ts3.8/index.d.ts +1 -0
  50. package/build/types-ts3.8/integrations/consola.d.ts +9 -4
  51. package/build/types-ts3.8/integrations/postgresjs.d.ts +62 -0
  52. package/build/types-ts3.8/server-runtime-client.d.ts +12 -0
  53. package/build/types-ts3.8/types-hoist/replay.d.ts +0 -4
  54. package/package.json +1 -1
@@ -54,8 +54,9 @@ export interface ConsolaReporter {
54
54
  */
55
55
  export interface ConsolaLogObject {
56
56
  /**
57
- * Allows additional custom properties to be set on the log object.
58
- * These properties will be captured as log attributes with a 'consola.' prefix.
57
+ * Allows additional custom properties to be set on the log object. These properties will be captured as log attributes.
58
+ *
59
+ * Additional properties are set when passing a single object with a `message` (`consola.[type]({ message: '', ... })`) or if the reporter is called directly
59
60
  *
60
61
  * @example
61
62
  * ```ts
@@ -66,7 +67,7 @@ export interface ConsolaLogObject {
66
67
  * userId: 123,
67
68
  * sessionId: 'abc-123'
68
69
  * });
69
- * // Will create attributes: consola.userId and consola.sessionId
70
+ * // Will create attributes: `userId` and `sessionId`
70
71
  * ```
71
72
  */
72
73
  [key: string]: unknown;
@@ -112,7 +113,7 @@ export interface ConsolaLogObject {
112
113
  /**
113
114
  * The raw arguments passed to the log method.
114
115
  *
115
- * These args are typically formatted into the final `message`. In Consola reporters, `message` is not provided.
116
+ * These args are typically formatted into the final `message`. In Consola reporters, `message` is not provided. See: https://github.com/unjs/consola/issues/406#issuecomment-3684792551
116
117
  *
117
118
  * @example
118
119
  * ```ts
@@ -139,6 +140,10 @@ export interface ConsolaLogObject {
139
140
  *
140
141
  * When provided, this is the final formatted message. When not provided,
141
142
  * the message should be constructed from the `args` array.
143
+ *
144
+ * Note: In reporters, `message` is typically undefined. It is primarily for
145
+ * `consola.[type]({ message: 'xxx' })` usage and is normalized into `args` before
146
+ * reporters receive the log object. See: https://github.com/unjs/consola/issues/406#issuecomment-3684792551
142
147
  */
143
148
  message?: string;
144
149
  }
@@ -1 +1 @@
1
- {"version":3,"file":"consola.d.ts","sourceRoot":"","sources":["../../../src/integrations/consola.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAIxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;GAEG;AACH,UAAU,sBAAsB;IAC9B;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAEjC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACzC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;;;;;;;OAeG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAEvB;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;;;;;;;;;;;;;;OAiBG;IACH,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IAEjB;;;;OAIG;IACH,I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wBAAgB,qBAAqB,CAAC,OAAO,GAAE,sBAA2B,GAAG,eAAe,CAqE3F"}
@@ -0,0 +1,62 @@
1
+ import type { Span } from '../types-hoist/span';
2
+ type PostgresConnectionContext = {
3
+ ATTR_DB_NAMESPACE?: string;
4
+ ATTR_SERVER_ADDRESS?: string;
5
+ ATTR_SERVER_PORT?: string;
6
+ };
7
+ interface PostgresJsSqlInstrumentationOptions {
8
+ /**
9
+ * Whether to require a parent span for the instrumentation.
10
+ * If set to true, the instrumentation will only create spans if there is a parent span
11
+ * available in the current scope.
12
+ * @default true
13
+ */
14
+ requireParentSpan?: boolean;
15
+ /**
16
+ * Hook to modify the span before it is started.
17
+ * This can be used to set additional attributes or modify the span in any way.
18
+ */
19
+ requestHook?: (span: Span, sanitizedSqlQuery: string, postgresConnectionContext?: PostgresConnectionContext) => void;
20
+ }
21
+ /**
22
+ * Instruments a postgres.js `sql` instance with Sentry tracing.
23
+ *
24
+ * This is a portable instrumentation function that works in any environment
25
+ * (Node.js, Cloudflare Workers, etc.) without depending on OpenTelemetry.
26
+ *
27
+ * @example
28
+ * ```javascript
29
+ * import postgres from 'postgres';
30
+ * import * as Sentry from '@sentry/cloudflare'; // or '@sentry/deno'
31
+ *
32
+ * const sql = Sentry.instrumentPostgresJsSql(
33
+ * postgres({ host: 'localhost', database: 'mydb' })
34
+ * );
35
+ *
36
+ * // All queries now create Sentry spans
37
+ * await sql`SELECT * FROM users WHERE id = ${userId}`;
38
+ * ```
39
+ */
40
+ export declare function instrumentPostgresJsSql<T>(sql: T, options?: PostgresJsSqlInstrumentationOptions): T;
41
+ /**
42
+ * Reconstructs the full SQL query from template strings with PostgreSQL placeholders.
43
+ *
44
+ * For sql`SELECT * FROM users WHERE id = ${123} AND name = ${'foo'}`:
45
+ * strings = ["SELECT * FROM users WHERE id = ", " AND name = ", ""]
46
+ * returns: "SELECT * FROM users WHERE id = $1 AND name = $2"
47
+ *
48
+ * @internal Exported for testing only
49
+ */
50
+ export declare function _reconstructQuery(strings: string[] | undefined): string | undefined;
51
+ /**
52
+ * Sanitize SQL query as per the OTEL semantic conventions
53
+ * https://opentelemetry.io/docs/specs/semconv/database/database-spans/#sanitization-of-dbquerytext
54
+ *
55
+ * PostgreSQL $n placeholders are preserved per OTEL spec - they're parameterized queries,
56
+ * not sensitive literals. Only actual values (strings, numbers, booleans) are sanitized.
57
+ *
58
+ * @internal Exported for testing only
59
+ */
60
+ export declare function _sanitizeSqlQuery(sqlQuery: string | undefined): string;
61
+ export {};
62
+ //# sourceMappingURL=postgresjs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgresjs.d.ts","sourceRoot":"","sources":["../../../src/integrations/postgresjs.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAMhD,KAAK,yBAAyB,GAAG;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,UAAU,mCAAmC;IAC3C;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,yBAAyB,CAAC,EAAE,yBAAyB,KAAK,IAAI,CAAC;CACtH;AAYD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,mCAAmC,GAAG,CAAC,CAOnG;AA8PD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CASnF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAgCtE"}
@@ -47,6 +47,18 @@ export declare class ServerRuntimeClient<O extends ClientOptions & ServerRuntime
47
47
  * to create a monitor automatically when sending a check in.
48
48
  */
49
49
  captureCheckIn(checkIn: CheckIn, monitorConfig?: MonitorConfig, scope?: Scope): string;
50
+ /**
51
+ * Disposes of the client and releases all resources.
52
+ *
53
+ * This method clears all internal state to allow the client to be garbage collected.
54
+ * It clears hooks, event processors, integrations, transport, and other internal references.
55
+ *
56
+ * Call this method after flushing to allow the client to be garbage collected.
57
+ * After calling dispose(), the client should not be used anymore.
58
+ *
59
+ * Subclasses should override this method to clean up their own resources and call `super.dispose()`.
60
+ */
61
+ dispose(): void;
50
62
  /**
51
63
  * @inheritDoc
52
64
  */
@@ -1 +1 @@
1
- {"version":3,"file":"server-runtime-client.d.ts","sourceRoot":"","sources":["../../src/server-runtime-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGrC,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAqB,MAAM,uBAAuB,CAAC;AACvF,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAOpE,MAAM,WAAW,0BAA2B,SAAQ,aAAa,CAAC,oBAAoB,CAAC;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,UAA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AAS,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM;IAU1E;;;;;;OAMG;IACI,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM;IAyD7F;;;;;;;;;;OAUG;IACa,OAAO,IAAI,IAAI;IAe/B;;OAEG;IACH,SAAS,CAAC,aAAa,CACrB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,SAAS,EACf,YAAY,EAAE,KAAK,EACnB,cAAc,EAAE,KAAK,GACpB,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC;IAmB5B;;OAEG;IACH,OAAO,CAAC,uBAAuB;CAUhC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tracing/langchain/index.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,wBAAwB,EAGxB,gBAAgB,EAEjB,MAAM,SAAS,CAAC;AAQjB;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,gBAAqB,GAAG,wBAAwB,CAqSvG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tracing/langchain/index.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,wBAAwB,EAGxB,gBAAgB,EAEjB,MAAM,SAAS,CAAC;AAQjB;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,gBAAqB,GAAG,wBAAwB,CA8SvG"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/tracing/langchain/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AA6BjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AA2DzF;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC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 +8,6 @@ export interface ReplayEvent extends Event {
8
8
  replay_start_timestamp?: number;
9
9
  error_ids: string[];
10
10
  trace_ids: string[];
11
- traces_by_timestamp: [number, string][];
12
11
  replay_id: string;
13
12
  segment_id: number;
14
13
  replay_type: ReplayRecordingMode;
@@ -1 +1 @@
1
- {"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../../src/types-hoist/replay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,KAAK;IACxC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB,mBAAmB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,UAAU,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,QAAQ,CAAC"}
1
+ {"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../../src/types-hoist/replay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,KAAK;IACxC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,UAAU,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,QAAQ,CAAC"}
@@ -21,6 +21,7 @@ import { SeverityLevel } from './types-hoist/severity';
21
21
  import { Span, SpanAttributes, SpanContextData } from './types-hoist/span';
22
22
  import { StartSpanOptions } from './types-hoist/startSpanOptions';
23
23
  import { Transport, TransportMakeRequestResponse } from './types-hoist/transport';
24
+ import { PromiseBuffer } from './utils/promisebuffer';
24
25
  /**
25
26
  * Base implementation for all JavaScript SDK clients.
26
27
  *
@@ -64,9 +65,11 @@ export declare abstract class Client<O extends ClientOptions = ClientOptions> {
64
65
  protected _numProcessing: number;
65
66
  protected _eventProcessors: EventProcessor[];
66
67
  /** Holds flushable */
67
- private _outcomes;
68
- private _hooks;
69
- private _promiseBuffer;
68
+ protected _outcomes: {
69
+ [key: string]: number;
70
+ };
71
+ protected _hooks: Record<string, Set<Function>>;
72
+ protected _promiseBuffer: PromiseBuffer<unknown>;
70
73
  /**
71
74
  * Initializes this client instance.
72
75
  *
@@ -547,6 +550,13 @@ export declare abstract class Client<O extends ClientOptions = ClientOptions> {
547
550
  * Send an envelope to Sentry.
548
551
  */
549
552
  sendEnvelope(envelope: Envelope): PromiseLike<TransportMakeRequestResponse>;
553
+ /**
554
+ * Disposes of the client and releases all resources.
555
+ *
556
+ * Subclasses should override this method to clean up their own resources.
557
+ * After calling dispose(), the client should not be used anymore.
558
+ */
559
+ dispose(): void;
550
560
  /** Setup integrations for this client. */
551
561
  protected _setupIntegrations(): void;
552
562
  /** Updates existing session based on the provided event */
@@ -60,6 +60,7 @@ export { dedupeIntegration } from './integrations/dedupe';
60
60
  export { extraErrorDataIntegration } from './integrations/extraerrordata';
61
61
  export { rewriteFramesIntegration } from './integrations/rewriteframes';
62
62
  export { supabaseIntegration, instrumentSupabaseClient } from './integrations/supabase';
63
+ export { instrumentPostgresJsSql } from './integrations/postgresjs';
63
64
  export { zodErrorsIntegration } from './integrations/zoderrors';
64
65
  export { thirdPartyErrorFilterIntegration } from './integrations/third-party-errors-filter';
65
66
  export { consoleIntegration } from './integrations/console';
@@ -54,8 +54,9 @@ export interface ConsolaReporter {
54
54
  */
55
55
  export interface ConsolaLogObject {
56
56
  /**
57
- * Allows additional custom properties to be set on the log object.
58
- * These properties will be captured as log attributes with a 'consola.' prefix.
57
+ * Allows additional custom properties to be set on the log object. These properties will be captured as log attributes.
58
+ *
59
+ * Additional properties are set when passing a single object with a `message` (`consola.[type]({ message: '', ... })`) or if the reporter is called directly
59
60
  *
60
61
  * @example
61
62
  * ```ts
@@ -66,7 +67,7 @@ export interface ConsolaLogObject {
66
67
  * userId: 123,
67
68
  * sessionId: 'abc-123'
68
69
  * });
69
- * // Will create attributes: consola.userId and consola.sessionId
70
+ * // Will create attributes: `userId` and `sessionId`
70
71
  * ```
71
72
  */
72
73
  [key: string]: unknown;
@@ -112,7 +113,7 @@ export interface ConsolaLogObject {
112
113
  /**
113
114
  * The raw arguments passed to the log method.
114
115
  *
115
- * These args are typically formatted into the final `message`. In Consola reporters, `message` is not provided.
116
+ * These args are typically formatted into the final `message`. In Consola reporters, `message` is not provided. See: https://github.com/unjs/consola/issues/406#issuecomment-3684792551
116
117
  *
117
118
  * @example
118
119
  * ```ts
@@ -139,6 +140,10 @@ export interface ConsolaLogObject {
139
140
  *
140
141
  * When provided, this is the final formatted message. When not provided,
141
142
  * the message should be constructed from the `args` array.
143
+ *
144
+ * Note: In reporters, `message` is typically undefined. It is primarily for
145
+ * `consola.[type]({ message: 'xxx' })` usage and is normalized into `args` before
146
+ * reporters receive the log object. See: https://github.com/unjs/consola/issues/406#issuecomment-3684792551
142
147
  */
143
148
  message?: string;
144
149
  }
@@ -0,0 +1,62 @@
1
+ import { Span } from '../types-hoist/span';
2
+ type PostgresConnectionContext = {
3
+ ATTR_DB_NAMESPACE?: string;
4
+ ATTR_SERVER_ADDRESS?: string;
5
+ ATTR_SERVER_PORT?: string;
6
+ };
7
+ interface PostgresJsSqlInstrumentationOptions {
8
+ /**
9
+ * Whether to require a parent span for the instrumentation.
10
+ * If set to true, the instrumentation will only create spans if there is a parent span
11
+ * available in the current scope.
12
+ * @default true
13
+ */
14
+ requireParentSpan?: boolean;
15
+ /**
16
+ * Hook to modify the span before it is started.
17
+ * This can be used to set additional attributes or modify the span in any way.
18
+ */
19
+ requestHook?: (span: Span, sanitizedSqlQuery: string, postgresConnectionContext?: PostgresConnectionContext) => void;
20
+ }
21
+ /**
22
+ * Instruments a postgres.js `sql` instance with Sentry tracing.
23
+ *
24
+ * This is a portable instrumentation function that works in any environment
25
+ * (Node.js, Cloudflare Workers, etc.) without depending on OpenTelemetry.
26
+ *
27
+ * @example
28
+ * ```javascript
29
+ * import postgres from 'postgres';
30
+ * import * as Sentry from '@sentry/cloudflare'; // or '@sentry/deno'
31
+ *
32
+ * const sql = Sentry.instrumentPostgresJsSql(
33
+ * postgres({ host: 'localhost', database: 'mydb' })
34
+ * );
35
+ *
36
+ * // All queries now create Sentry spans
37
+ * await sql`SELECT * FROM users WHERE id = ${userId}`;
38
+ * ```
39
+ */
40
+ export declare function instrumentPostgresJsSql<T>(sql: T, options?: PostgresJsSqlInstrumentationOptions): T;
41
+ /**
42
+ * Reconstructs the full SQL query from template strings with PostgreSQL placeholders.
43
+ *
44
+ * For sql`SELECT * FROM users WHERE id = ${123} AND name = ${'foo'}`:
45
+ * strings = ["SELECT * FROM users WHERE id = ", " AND name = ", ""]
46
+ * returns: "SELECT * FROM users WHERE id = $1 AND name = $2"
47
+ *
48
+ * @internal Exported for testing only
49
+ */
50
+ export declare function _reconstructQuery(strings: string[] | undefined): string | undefined;
51
+ /**
52
+ * Sanitize SQL query as per the OTEL semantic conventions
53
+ * https://opentelemetry.io/docs/specs/semconv/database/database-spans/#sanitization-of-dbquerytext
54
+ *
55
+ * PostgreSQL $n placeholders are preserved per OTEL spec - they're parameterized queries,
56
+ * not sensitive literals. Only actual values (strings, numbers, booleans) are sanitized.
57
+ *
58
+ * @internal Exported for testing only
59
+ */
60
+ export declare function _sanitizeSqlQuery(sqlQuery: string | undefined): string;
61
+ export {};
62
+ //# sourceMappingURL=postgresjs.d.ts.map
@@ -47,6 +47,18 @@ export declare class ServerRuntimeClient<O extends ClientOptions & ServerRuntime
47
47
  * to create a monitor automatically when sending a check in.
48
48
  */
49
49
  captureCheckIn(checkIn: CheckIn, monitorConfig?: MonitorConfig, scope?: Scope): string;
50
+ /**
51
+ * Disposes of the client and releases all resources.
52
+ *
53
+ * This method clears all internal state to allow the client to be garbage collected.
54
+ * It clears hooks, event processors, integrations, transport, and other internal references.
55
+ *
56
+ * Call this method after flushing to allow the client to be garbage collected.
57
+ * After calling dispose(), the client should not be used anymore.
58
+ *
59
+ * Subclasses should override this method to clean up their own resources and call `super.dispose()`.
60
+ */
61
+ dispose(): void;
50
62
  /**
51
63
  * @inheritDoc
52
64
  */
@@ -8,10 +8,6 @@ export interface ReplayEvent extends Event {
8
8
  replay_start_timestamp?: number;
9
9
  error_ids: string[];
10
10
  trace_ids: string[];
11
- traces_by_timestamp: [
12
- number,
13
- string
14
- ][];
15
11
  replay_id: string;
16
12
  segment_id: number;
17
13
  replay_type: ReplayRecordingMode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/core",
3
- "version": "10.41.0-beta.0",
3
+ "version": "10.42.0",
4
4
  "description": "Base implementation for all Sentry JavaScript SDKs",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/core",