@zuplo/cli 7.7.8 → 7.7.9

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 (143) hide show
  1. package/node_modules/@posthog/core/dist/error-tracking/parsers/base.d.ts.map +1 -1
  2. package/node_modules/@posthog/core/dist/error-tracking/parsers/base.js +19 -2
  3. package/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs +19 -2
  4. package/node_modules/@posthog/core/dist/index.d.ts +7 -0
  5. package/node_modules/@posthog/core/dist/index.d.ts.map +1 -1
  6. package/node_modules/@posthog/core/dist/index.js +82 -21
  7. package/node_modules/@posthog/core/dist/index.mjs +4 -0
  8. package/node_modules/@posthog/core/dist/logs/index.d.ts +3 -2
  9. package/node_modules/@posthog/core/dist/logs/index.d.ts.map +1 -1
  10. package/node_modules/@posthog/core/dist/logs/index.js +28 -22
  11. package/node_modules/@posthog/core/dist/logs/index.mjs +29 -23
  12. package/node_modules/@posthog/core/dist/logs/logs-utils.js +1 -1
  13. package/node_modules/@posthog/core/dist/logs/logs-utils.mjs +2 -2
  14. package/node_modules/@posthog/core/dist/logs/types.d.ts +2 -2
  15. package/node_modules/@posthog/core/dist/metrics/index.d.ts +5 -2
  16. package/node_modules/@posthog/core/dist/metrics/index.d.ts.map +1 -1
  17. package/node_modules/@posthog/core/dist/metrics/index.js +28 -14
  18. package/node_modules/@posthog/core/dist/metrics/index.mjs +29 -15
  19. package/node_modules/@posthog/core/dist/metrics/metrics-utils.d.ts.map +1 -1
  20. package/node_modules/@posthog/core/dist/metrics/metrics-utils.js +1 -2
  21. package/node_modules/@posthog/core/dist/metrics/metrics-utils.mjs +2 -3
  22. package/node_modules/@posthog/core/dist/metrics/types.d.ts +7 -0
  23. package/node_modules/@posthog/core/dist/metrics/types.d.ts.map +1 -1
  24. package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts +32 -4
  25. package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts.map +1 -1
  26. package/node_modules/@posthog/core/dist/posthog-core-stateless.js +68 -20
  27. package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +68 -20
  28. package/node_modules/@posthog/core/dist/traces/config.d.ts +13 -0
  29. package/node_modules/@posthog/core/dist/traces/config.d.ts.map +1 -0
  30. package/node_modules/@posthog/core/dist/traces/config.js +101 -0
  31. package/node_modules/@posthog/core/dist/traces/config.mjs +63 -0
  32. package/node_modules/@posthog/core/dist/traces/context.d.ts +18 -0
  33. package/node_modules/@posthog/core/dist/traces/context.d.ts.map +1 -0
  34. package/node_modules/@posthog/core/dist/traces/context.js +53 -0
  35. package/node_modules/@posthog/core/dist/traces/context.mjs +15 -0
  36. package/node_modules/@posthog/core/dist/traces/ids.d.ts +12 -0
  37. package/node_modules/@posthog/core/dist/traces/ids.d.ts.map +1 -0
  38. package/node_modules/@posthog/core/dist/traces/ids.js +92 -0
  39. package/node_modules/@posthog/core/dist/traces/ids.mjs +42 -0
  40. package/node_modules/@posthog/core/dist/traces/index.d.ts +150 -0
  41. package/node_modules/@posthog/core/dist/traces/index.d.ts.map +1 -0
  42. package/node_modules/@posthog/core/dist/traces/index.js +551 -0
  43. package/node_modules/@posthog/core/dist/traces/index.mjs +513 -0
  44. package/node_modules/@posthog/core/dist/traces/otlp.d.ts +24 -0
  45. package/node_modules/@posthog/core/dist/traces/otlp.d.ts.map +1 -0
  46. package/node_modules/@posthog/core/dist/traces/otlp.js +158 -0
  47. package/node_modules/@posthog/core/dist/traces/otlp.mjs +108 -0
  48. package/node_modules/@posthog/core/dist/traces/sanitize.d.ts +32 -0
  49. package/node_modules/@posthog/core/dist/traces/sanitize.d.ts.map +1 -0
  50. package/node_modules/@posthog/core/dist/traces/sanitize.js +93 -0
  51. package/node_modules/@posthog/core/dist/traces/sanitize.mjs +43 -0
  52. package/node_modules/@posthog/core/dist/traces/span.d.ts +189 -0
  53. package/node_modules/@posthog/core/dist/traces/span.d.ts.map +1 -0
  54. package/node_modules/@posthog/core/dist/traces/span.js +533 -0
  55. package/node_modules/@posthog/core/dist/traces/span.mjs +462 -0
  56. package/node_modules/@posthog/core/dist/traces/traceparent.d.ts +51 -0
  57. package/node_modules/@posthog/core/dist/traces/traceparent.d.ts.map +1 -0
  58. package/node_modules/@posthog/core/dist/traces/traceparent.js +116 -0
  59. package/node_modules/@posthog/core/dist/traces/traceparent.mjs +63 -0
  60. package/node_modules/@posthog/core/dist/traces/types.d.ts +114 -0
  61. package/node_modules/@posthog/core/dist/traces/types.d.ts.map +1 -0
  62. package/node_modules/@posthog/core/dist/traces/types.js +18 -0
  63. package/node_modules/@posthog/core/dist/traces/types.mjs +1 -0
  64. package/node_modules/@posthog/core/dist/utils/backoff.d.ts +23 -0
  65. package/node_modules/@posthog/core/dist/utils/backoff.d.ts.map +1 -0
  66. package/node_modules/@posthog/core/dist/utils/backoff.js +65 -0
  67. package/node_modules/@posthog/core/dist/utils/backoff.mjs +14 -0
  68. package/node_modules/@posthog/core/dist/utils/flush-timer.d.ts +26 -0
  69. package/node_modules/@posthog/core/dist/utils/flush-timer.d.ts.map +1 -0
  70. package/node_modules/@posthog/core/dist/utils/flush-timer.js +67 -0
  71. package/node_modules/@posthog/core/dist/utils/flush-timer.mjs +29 -0
  72. package/node_modules/@posthog/core/dist/utils/json-utils.d.ts +7 -0
  73. package/node_modules/@posthog/core/dist/utils/json-utils.d.ts.map +1 -1
  74. package/node_modules/@posthog/core/dist/utils/json-utils.js +27 -0
  75. package/node_modules/@posthog/core/dist/utils/json-utils.mjs +25 -1
  76. package/node_modules/@posthog/core/dist/utils/otlp-resource.d.ts +13 -2
  77. package/node_modules/@posthog/core/dist/utils/otlp-resource.d.ts.map +1 -1
  78. package/node_modules/@posthog/core/dist/utils/otlp-resource.js +34 -7
  79. package/node_modules/@posthog/core/dist/utils/otlp-resource.mjs +26 -2
  80. package/node_modules/@posthog/core/dist/utils/retry-after.d.ts +55 -0
  81. package/node_modules/@posthog/core/dist/utils/retry-after.d.ts.map +1 -0
  82. package/node_modules/@posthog/core/dist/utils/retry-after.js +95 -0
  83. package/node_modules/@posthog/core/dist/utils/retry-after.mjs +50 -0
  84. package/node_modules/@posthog/core/package.json +3 -3
  85. package/node_modules/@posthog/core/src/error-tracking/parsers/base.spec.ts +77 -7
  86. package/node_modules/@posthog/core/src/error-tracking/parsers/base.ts +42 -19
  87. package/node_modules/@posthog/core/src/index.ts +18 -0
  88. package/node_modules/@posthog/core/src/logs/index.spec.ts +490 -2
  89. package/node_modules/@posthog/core/src/logs/index.ts +63 -31
  90. package/node_modules/@posthog/core/src/logs/logs-utils.ts +2 -2
  91. package/node_modules/@posthog/core/src/logs/types.ts +2 -2
  92. package/node_modules/@posthog/core/src/metrics/index.spec.ts +304 -0
  93. package/node_modules/@posthog/core/src/metrics/index.ts +53 -16
  94. package/node_modules/@posthog/core/src/metrics/metrics-utils.ts +2 -3
  95. package/node_modules/@posthog/core/src/metrics/types.ts +10 -2
  96. package/node_modules/@posthog/core/src/posthog-core-stateless.ts +157 -38
  97. package/node_modules/@posthog/core/src/traces/config.spec.ts +271 -0
  98. package/node_modules/@posthog/core/src/traces/config.ts +142 -0
  99. package/node_modules/@posthog/core/src/traces/context.ts +30 -0
  100. package/node_modules/@posthog/core/src/traces/ids.spec.ts +115 -0
  101. package/node_modules/@posthog/core/src/traces/ids.ts +75 -0
  102. package/node_modules/@posthog/core/src/traces/index.spec.ts +3187 -0
  103. package/node_modules/@posthog/core/src/traces/index.ts +1060 -0
  104. package/node_modules/@posthog/core/src/traces/live-spans.spec.ts +69 -0
  105. package/node_modules/@posthog/core/src/traces/otlp.spec.ts +368 -0
  106. package/node_modules/@posthog/core/src/traces/otlp.ts +191 -0
  107. package/node_modules/@posthog/core/src/traces/sanitize.ts +116 -0
  108. package/node_modules/@posthog/core/src/traces/span.spec.ts +1122 -0
  109. package/node_modules/@posthog/core/src/traces/span.ts +822 -0
  110. package/node_modules/@posthog/core/src/traces/traceparent.spec.ts +184 -0
  111. package/node_modules/@posthog/core/src/traces/traceparent.ts +172 -0
  112. package/node_modules/@posthog/core/src/traces/types.ts +140 -0
  113. package/node_modules/@posthog/core/src/utils/backoff.ts +44 -0
  114. package/node_modules/@posthog/core/src/utils/flush-timer.ts +50 -0
  115. package/node_modules/@posthog/core/src/utils/json-utils.ts +33 -0
  116. package/node_modules/@posthog/core/src/utils/otlp-resource.spec.ts +55 -9
  117. package/node_modules/@posthog/core/src/utils/otlp-resource.ts +45 -4
  118. package/node_modules/@posthog/core/src/utils/retry-after.ts +135 -0
  119. package/node_modules/@posthog/types/dist/index.d.ts +1 -0
  120. package/node_modules/@posthog/types/dist/index.d.ts.map +1 -1
  121. package/node_modules/@posthog/types/dist/posthog-config.d.ts +10 -5
  122. package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
  123. package/node_modules/@posthog/types/dist/traces.d.ts +387 -0
  124. package/node_modules/@posthog/types/dist/traces.d.ts.map +1 -0
  125. package/node_modules/@posthog/types/dist/traces.js +18 -0
  126. package/node_modules/@posthog/types/dist/traces.mjs +1 -0
  127. package/node_modules/@posthog/types/package.json +1 -1
  128. package/node_modules/@posthog/types/src/index.ts +19 -0
  129. package/node_modules/@posthog/types/src/posthog-config.ts +10 -5
  130. package/node_modules/@posthog/types/src/traces.ts +429 -0
  131. package/node_modules/@zuplo/core/package.json +1 -1
  132. package/node_modules/@zuplo/graphql/package.json +1 -1
  133. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  134. package/node_modules/@zuplo/otel/package.json +1 -1
  135. package/node_modules/@zuplo/runtime/out/esm/{chunk-DRQ5CMVC.js → chunk-KNAYKBEE.js} +80 -80
  136. package/node_modules/@zuplo/runtime/out/esm/chunk-KNAYKBEE.js.map +1 -0
  137. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  138. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  139. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  140. package/node_modules/@zuplo/runtime/package.json +1 -1
  141. package/package.json +11 -11
  142. package/node_modules/@zuplo/runtime/out/esm/chunk-DRQ5CMVC.js.map +0 -1
  143. /package/node_modules/@zuplo/runtime/out/esm/{chunk-DRQ5CMVC.js.LEGAL.txt → chunk-KNAYKBEE.js.LEGAL.txt} +0 -0
@@ -0,0 +1,387 @@
1
+ import type { OtlpKeyValue } from './capture-log';
2
+ /**
3
+ * Types for the distributed tracing API (`startSpan` / `withSpan` / `getActiveSpan`).
4
+ *
5
+ * Spans are exported as OpenTelemetry-shaped OTLP records to PostHog's tracing
6
+ * endpoint. PostHog does not depend on the OpenTelemetry SDK — these types are the
7
+ * SDK-facing surface, and the OTLP integer enums stay a wire-level concern.
8
+ */
9
+ /**
10
+ * What kind of work a span represents. Mirrors the OpenTelemetry span kinds.
11
+ *
12
+ * @default 'internal'
13
+ *
14
+ * @experimental Subject to change in a minor release.
15
+ */
16
+ export type SpanKind = 'internal' | 'server' | 'client' | 'producer' | 'consumer';
17
+ /**
18
+ * Outcome of the operation a span covers. A span that never has a status set is
19
+ * exported as `unset`, which is not the same as `ok`.
20
+ *
21
+ * @experimental Subject to change in a minor release.
22
+ */
23
+ export type SpanStatusCode = 'ok' | 'error';
24
+ /**
25
+ * A value that can be attached to a span, span event, or resource.
26
+ *
27
+ * The ingestion service flattens attribute values to strings for storage, so
28
+ * primitives are strongly preferred — nested arrays and objects survive only as
29
+ * serialized strings and cannot be filtered on. `null` and `undefined` drop the key.
30
+ *
31
+ * @experimental Subject to change in a minor release.
32
+ */
33
+ export type SpanAttributeValue = string | number | boolean | bigint | SpanAttributeValue[] | {
34
+ [key: string]: SpanAttributeValue;
35
+ } | null | undefined;
36
+ export type SpanAttributes = Record<string, SpanAttributeValue>;
37
+ /**
38
+ * A point in time, as a millisecond epoch number or a `Date`.
39
+ *
40
+ * @experimental Subject to change in a minor release.
41
+ */
42
+ export type SpanTimeInput = number | Date;
43
+ /**
44
+ * Options accepted by `startSpan` and `withSpan`.
45
+ *
46
+ * @experimental Subject to change in a minor release.
47
+ */
48
+ export interface StartSpanOptions {
49
+ /**
50
+ * What kind of work the span represents.
51
+ *
52
+ * @default 'internal'
53
+ */
54
+ kind?: SpanKind;
55
+ /**
56
+ * Attributes to set at span start. User-supplied keys win over the
57
+ * SDK's auto-attached context attributes.
58
+ */
59
+ attributes?: SpanAttributes;
60
+ /**
61
+ * Parent of this span: either a span handle, or a raw W3C `traceparent`
62
+ * string to continue a trace started by another service.
63
+ *
64
+ * When omitted the parent is the currently active span, or none. Only
65
+ * handles returned by this SDK are honoured; any other `Span` yields an
66
+ * inert span.
67
+ *
68
+ * @example Continue an inbound trace
69
+ * ```ts
70
+ * posthog.withSpan('POST /checkout', { parent: req.get('traceparent') }, handler)
71
+ * ```
72
+ */
73
+ parent?: Span | string;
74
+ /**
75
+ * The W3C `tracestate` value accompanying a `traceparent`-string `parent`.
76
+ * Ignored when `parent` is a span handle — those inherit the parent's
77
+ * tracestate. Preserved opaquely and passed on to children.
78
+ */
79
+ tracestate?: string;
80
+ /**
81
+ * Backdate the span's start. Values outside the representable range fall
82
+ * back to the current time; starts more than 24 hours old are warned about,
83
+ * because the server clamps them to receive time.
84
+ */
85
+ startTime?: SpanTimeInput;
86
+ }
87
+ /**
88
+ * A handle to a span in progress.
89
+ *
90
+ * Every method is safe to call at any time, including after `end()` and on
91
+ * no-op handles, so calling code never has to branch on whether tracing is on.
92
+ *
93
+ * @experimental Subject to change in a minor release.
94
+ */
95
+ export interface Span {
96
+ /** Set a single attribute. Ignored after `end()`. */
97
+ setAttribute(key: string, value: SpanAttributeValue): this;
98
+ /** Merge several attributes at once. Ignored after `end()`. */
99
+ setAttributes(attributes: SpanAttributes): this;
100
+ /**
101
+ * Record a timestamped event within the span, e.g. a cache miss or a retry.
102
+ * Defaults to the current time.
103
+ *
104
+ * One event carries at most 128 attributes; further keys are dropped and
105
+ * counted on the exported event. Use `maxEventsPerSpan` to bound how many
106
+ * events a span carries.
107
+ */
108
+ addEvent(name: string, attributes?: SpanAttributes, timestamp?: SpanTimeInput): this;
109
+ /**
110
+ * Set the span's outcome. Last write wins.
111
+ *
112
+ * When a `withSpan` callback throws, the SDK sets `error` automatically —
113
+ * unless the callback already set `ok`, which is treated as final.
114
+ */
115
+ setStatus(status: SpanStatusCode, message?: string): this;
116
+ /**
117
+ * Record an exception on the span: sets status `error` and attaches an
118
+ * `exception` event carrying `exception.type`, `exception.message` and,
119
+ * where the thrown value has one, `exception.stacktrace`. The stack is
120
+ * truncated to `maxAttributeValueLength` like any other attribute value,
121
+ * and `beforeSpanSend` sees it before it is exported. Does not end the span.
122
+ */
123
+ recordException(error: unknown): this;
124
+ /**
125
+ * Replace the span's name. Useful when the low-cardinality name is only
126
+ * known after work begins — a route template resolving mid-request, say.
127
+ *
128
+ * Span names should be low-cardinality operation names (`GET /users/:id`),
129
+ * never interpolated with ids: PostHog aggregates operations by service and
130
+ * name, so variable values belong in attributes.
131
+ */
132
+ updateName(name: string): this;
133
+ /**
134
+ * This span's W3C `traceparent` header value (`00-<traceId>-<spanId>-<flags>`),
135
+ * for propagating the trace to another service. A span continuing a remote
136
+ * trace propagates the flags byte it was handed, so a downstream sampler
137
+ * sees the decision the head sampler made; a trace started here is sampled.
138
+ *
139
+ * When tracing is off, a span started with a `parent` header echoes that
140
+ * header back — version and sampled flag included — so a service that
141
+ * records nothing still keeps a distributed trace whole. With no `parent`
142
+ * there is no context to carry and this returns `null`, so an id this SDK
143
+ * never recorded cannot propagate.
144
+ */
145
+ traceparent(): string | null;
146
+ /** This span's W3C `tracestate` value, or `null` when it has none. */
147
+ tracestate(): string | null;
148
+ /**
149
+ * End the span and queue it for export. Idempotent — later calls no-op.
150
+ *
151
+ * @param endTime - Override the recorded end. Invalid values fall back to
152
+ * the derived end time; an end before the start is corrected to the start.
153
+ */
154
+ end(endTime?: SpanTimeInput): void;
155
+ }
156
+ /**
157
+ * A completed span as `beforeSpanSend` sees it: plain values, not the OTLP wire
158
+ * encoding — `userId: 42` reads as `42`, not `{ intValue: "42" }`.
159
+ *
160
+ * @experimental Subject to change in a minor release.
161
+ */
162
+ export interface SpanRecord {
163
+ /**
164
+ * Assignment to any of the three identity fields is ignored with a debug
165
+ * warning: rewriting ids orphans children that already shipped.
166
+ */
167
+ readonly traceId: string;
168
+ readonly spanId: string;
169
+ /** Absent on a root span. */
170
+ readonly parentSpanId?: string;
171
+ name: string;
172
+ kind: SpanKind;
173
+ status?: {
174
+ code: SpanStatusCode;
175
+ message?: string;
176
+ };
177
+ /** Editable in place; this is where to redact. */
178
+ attributes: SpanAttributes;
179
+ events: {
180
+ name: string; /** Millisecond epoch. */
181
+ timestamp: number;
182
+ attributes?: SpanAttributes;
183
+ }[];
184
+ /** Millisecond epoch. */
185
+ startTime: number;
186
+ /** Millisecond epoch. */
187
+ endTime: number;
188
+ }
189
+ /**
190
+ * Inspects, edits or drops a finished span. Return `null` to drop it.
191
+ *
192
+ * The hook runs synchronously as part of `end()`; a returned promise is not
193
+ * awaited and the span is dropped.
194
+ *
195
+ * @experimental Subject to change in a minor release.
196
+ */
197
+ export type BeforeSpanSendFn = (span: SpanRecord) => SpanRecord | null;
198
+ /**
199
+ * Configuration for distributed tracing, passed as the `traces` client option.
200
+ * Tracing stays off until this object is supplied.
201
+ *
202
+ * @example
203
+ * ```ts
204
+ * const posthog = new PostHog('phc_...', { traces: { serviceName: 'checkout-api' } })
205
+ * ```
206
+ *
207
+ * @experimental Subject to change in a minor release.
208
+ */
209
+ export interface TracesConfig {
210
+ /**
211
+ * Name of the service producing these spans, attached as the OTLP
212
+ * `service.name` resource attribute. PostHog groups operations by service
213
+ * and span name, so this is what makes spans attributable.
214
+ *
215
+ * @default 'unknown_service'
216
+ */
217
+ serviceName?: string;
218
+ /** Service version, attached as OTLP `service.version`. */
219
+ serviceVersion?: string;
220
+ /**
221
+ * Deployment environment (e.g. `'production'`, `'staging'`), attached as
222
+ * OTLP `deployment.environment`.
223
+ */
224
+ environment?: string;
225
+ /**
226
+ * Extra OTLP resource attributes attached to every batch.
227
+ *
228
+ * A string `service.name`, `service.version` or `deployment.environment` here
229
+ * wins over the `serviceName` / `serviceVersion` / `environment` fields — set
230
+ * it either way. `telemetry.sdk.*` is SDK-controlled and always wins.
231
+ */
232
+ resourceAttributes?: SpanAttributes;
233
+ /**
234
+ * How often queued spans are flushed, in milliseconds. Spans also flush when
235
+ * the queue reaches `maxExportBatchSize` and on `shutdown()`.
236
+ *
237
+ * @default 5000
238
+ */
239
+ flushIntervalMs?: number;
240
+ /**
241
+ * Maximum spans per outbound request, and the queue depth that triggers an
242
+ * immediate flush. On a 413 the SDK halves this, retries the same spans, then
243
+ * ramps back up.
244
+ *
245
+ * @default 512
246
+ */
247
+ maxExportBatchSize?: number;
248
+ /**
249
+ * Bound on the in-memory export queue. When it is full the incoming span is
250
+ * dropped rather than evicting a queued one, whose children may already have
251
+ * been exported. Never lower than `maxExportBatchSize`.
252
+ *
253
+ * @default 2048
254
+ */
255
+ maxQueueSize?: number;
256
+ /**
257
+ * Runs on every finished span before it is queued. Edit the span in place,
258
+ * or return `null` to drop it. An array runs left to right, and the first
259
+ * hook to return `null` stops the chain.
260
+ *
261
+ * This is the place to scrub sensitive attributes, so a hook that throws
262
+ * drops the span rather than exporting an unscrubbed one.
263
+ *
264
+ * @example Drop health checks and redact a header
265
+ * ```ts
266
+ * traces: {
267
+ * beforeSpanSend: (span) => {
268
+ * if (span.attributes['http.route'] === '/health') return null
269
+ * delete span.attributes['http.request.header.authorization']
270
+ * return span
271
+ * },
272
+ * }
273
+ * ```
274
+ */
275
+ beforeSpanSend?: BeforeSpanSendFn | BeforeSpanSendFn[];
276
+ /**
277
+ * Maximum user-supplied attributes on a single span. Attributes the SDK
278
+ * attaches itself — `posthogDistinctId`, `sessionId` and friends — are
279
+ * exempt and are never evicted, because they are what links a span to a
280
+ * person and a session.
281
+ *
282
+ * On overflow the earliest-set attributes are kept and later ones are
283
+ * dropped, with the number dropped reported on the exported span.
284
+ *
285
+ * @default 128
286
+ */
287
+ maxAttributesPerSpan?: number;
288
+ /**
289
+ * Maximum events on a single span. On overflow the earliest events are kept
290
+ * and later ones are dropped, with the number dropped reported on the
291
+ * exported span.
292
+ *
293
+ * The cap is absolute: an `exception` event the SDK records on your behalf
294
+ * spends an ordinary slot like any other, so a span that fills its events
295
+ * and then throws keeps its `error` status but not the exception detail.
296
+ * Raise the cap on spans that record many events and can also fail.
297
+ *
298
+ * @default 128
299
+ */
300
+ maxEventsPerSpan?: number;
301
+ /**
302
+ * Maximum length of a string attribute value. Longer values are truncated,
303
+ * and the bound reaches every string the value contains, including the ones
304
+ * nested inside arrays and objects. It applies to span attributes, event
305
+ * attributes, span names, event names, status messages and resource
306
+ * attributes alike — including `exception.stacktrace`.
307
+ *
308
+ * The bound is what keeps one large value from making a span too large for
309
+ * the ingestion endpoint, which drops an oversized span whole.
310
+ *
311
+ * @default 8192
312
+ */
313
+ maxAttributeValueLength?: number;
314
+ /**
315
+ * Bound on how many spans may be live (started but not ended) at once. At
316
+ * the bound `startSpan` returns an inert handle, so code that leaks spans
317
+ * cannot grow the SDK's bookkeeping without limit. The SDK tracks only an
318
+ * id and a timestamp per live span, never the span itself, so a high bound
319
+ * is inexpensive.
320
+ *
321
+ * @default 10000
322
+ */
323
+ maxLiveSpans?: number;
324
+ /**
325
+ * How long a span may stay live before the SDK stops accounting for it, in
326
+ * milliseconds. An evicted span is never exported, and its slot is returned
327
+ * so one leak cannot disable tracing for the rest of the process. Measured
328
+ * as monotonic elapsed time since `startSpan`, so a caller-supplied
329
+ * `startTime` neither ages a span early nor exempts it.
330
+ *
331
+ * @default 3600000
332
+ */
333
+ maxSpanAgeMs?: number;
334
+ }
335
+ export type OtlpSpanKeyValue = OtlpKeyValue;
336
+ export interface OtlpSpanEvent {
337
+ name: string;
338
+ timeUnixNano: string;
339
+ attributes?: OtlpSpanKeyValue[];
340
+ /** Attributes dropped by the SDK's per-event attribute cap. Omitted when none were. */
341
+ droppedAttributesCount?: number;
342
+ }
343
+ export interface OtlpSpanStatus {
344
+ /** unset 0, ok 1, error 2. */
345
+ code: number;
346
+ message?: string;
347
+ }
348
+ export interface OtlpSpan {
349
+ /** 32-char lowercase hex. */
350
+ traceId: string;
351
+ /** 16-char lowercase hex. */
352
+ spanId: string;
353
+ parentSpanId?: string;
354
+ traceState?: string;
355
+ name: string;
356
+ /** unspecified 0, internal 1, server 2, client 3, producer 4, consumer 5. */
357
+ kind: number;
358
+ startTimeUnixNano: string;
359
+ endTimeUnixNano: string;
360
+ attributes?: OtlpSpanKeyValue[];
361
+ events?: OtlpSpanEvent[];
362
+ status?: OtlpSpanStatus;
363
+ /**
364
+ * W3C trace flags in the low byte — the sampled bit as this span propagates
365
+ * it — plus OTel's parent-remoteness bits (`0x100` known, `0x200` remote).
366
+ */
367
+ flags?: number;
368
+ /** User attributes dropped by `maxAttributesPerSpan`. Omitted when none were. */
369
+ droppedAttributesCount?: number;
370
+ /** Events dropped by `maxEventsPerSpan`. Omitted when none were. */
371
+ droppedEventsCount?: number;
372
+ }
373
+ export interface OtlpTracesPayload {
374
+ resourceSpans: Array<{
375
+ resource: {
376
+ attributes: OtlpSpanKeyValue[];
377
+ };
378
+ scopeSpans: Array<{
379
+ scope: {
380
+ name: string;
381
+ version?: string;
382
+ };
383
+ spans: OtlpSpan[];
384
+ }>;
385
+ }>;
386
+ }
387
+ //# sourceMappingURL=traces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traces.d.ts","sourceRoot":"","sources":["../src/traces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD;;;;;;GAMG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAA;AAEjF;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,OAAO,CAAA;AAE3C;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GACxB,MAAM,GACN,MAAM,GACN,OAA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,CAAC,EAAE,aAAa,EAAE,CAAA;IACxB,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iFAAiF;IACjF,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,oEAAoE;IACpE,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAC9B,aAAa,EAAE,KAAK,CAAC;QACjB,QAAQ,EAAE;YAAE,UAAU,EAAE,gBAAgB,EAAE,CAAA;SAAE,CAAA;QAC5C,UAAU,EAAE,KAAK,CAAC;YACd,KAAK,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,OAAO,CAAC,EAAE,MAAM,CAAA;aAAE,CAAA;YACzC,KAAK,EAAE,QAAQ,EAAE,CAAA;SACpB,CAAC,CAAA;KACL,CAAC,CAAA;CACL"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.r = (exports1)=>{
5
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
6
+ value: 'Module'
7
+ });
8
+ Object.defineProperty(exports1, '__esModule', {
9
+ value: true
10
+ });
11
+ };
12
+ })();
13
+ var __webpack_exports__ = {};
14
+ __webpack_require__.r(__webpack_exports__);
15
+ for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
16
+ Object.defineProperty(exports, '__esModule', {
17
+ value: true
18
+ });
@@ -0,0 +1 @@
1
+ export { };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/types",
3
- "version": "1.410.0",
3
+ "version": "1.411.0",
4
4
  "bugs": {
5
5
  "url": "https://github.com/PostHog/posthog-js/issues"
6
6
  },
@@ -136,3 +136,22 @@ export type {
136
136
  OtlpMetricsPayload,
137
137
  } from './capture-metric'
138
138
  export { OTLP_AGGREGATION_TEMPORALITY_DELTA } from './capture-metric'
139
+
140
+ // Distributed tracing types
141
+ export type {
142
+ SpanKind,
143
+ SpanStatusCode,
144
+ SpanAttributeValue,
145
+ SpanAttributes,
146
+ SpanTimeInput,
147
+ StartSpanOptions,
148
+ Span,
149
+ SpanRecord,
150
+ BeforeSpanSendFn,
151
+ TracesConfig,
152
+ OtlpSpanKeyValue,
153
+ OtlpSpanEvent,
154
+ OtlpSpanStatus,
155
+ OtlpSpan,
156
+ OtlpTracesPayload,
157
+ } from './traces'
@@ -164,22 +164,22 @@ export interface BootstrapConfig {
164
164
  /**
165
165
  * Distinct ID to use before the SDK has loaded persisted identity.
166
166
  */
167
- distinctID?: string
167
+ distinctID?: string | null
168
168
 
169
169
  /**
170
170
  * Whether `distinctID` already identifies a known person profile.
171
171
  */
172
- isIdentifiedID?: boolean
172
+ isIdentifiedID?: boolean | null
173
173
 
174
174
  /**
175
175
  * Feature flag values to use immediately until the SDK fetches fresh values.
176
176
  */
177
- featureFlags?: Record<string, boolean | string>
177
+ featureFlags?: Record<string, boolean | string> | null
178
178
 
179
179
  /**
180
180
  * Feature flag payloads to use together with bootstrapped `featureFlags`.
181
181
  */
182
- featureFlagPayloads?: Record<string, JsonType>
182
+ featureFlagPayloads?: Record<string, JsonType> | null
183
183
 
184
184
  /**
185
185
  * Optionally provide a sessionID, this is so that you can provide an existing sessionID here to continue a user's session across a domain or device. It MUST be:
@@ -188,7 +188,7 @@ export interface BootstrapConfig {
188
188
  * - the timestamp part must be <= the timestamp of the first event in the session
189
189
  * - the timestamp of the last event in the session must be < the timestamp part + 24 hours
190
190
  */
191
- sessionID?: string
191
+ sessionID?: string | null
192
192
  }
193
193
 
194
194
  export interface ResetOptions {
@@ -1942,6 +1942,11 @@ export interface PostHogConfig {
1942
1942
  * (e.g. /flags?v=2&config=true) without evaluating any feature flags. Most folks use this
1943
1943
  * to save money on feature flag evaluation (by bootstrapping feature flags on the server side).
1944
1944
  *
1945
+ * This also stops surveys from displaying. PostHog creates an internal targeting flag for
1946
+ * almost every survey, and every flag evaluates to false while flags are disabled. If you use
1947
+ * surveys, set `advanced_only_evaluate_survey_feature_flags` instead, which evaluates survey
1948
+ * flags only.
1949
+ *
1945
1950
  * @default false
1946
1951
  */
1947
1952
  advanced_disable_feature_flags: boolean