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