@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.
- package/node_modules/@posthog/core/dist/error-tracking/index.d.ts +1 -1
- package/node_modules/@posthog/core/dist/error-tracking/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/error-tracking/parsers/base.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/error-tracking/parsers/base.js +19 -2
- package/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs +19 -2
- package/node_modules/@posthog/core/dist/index.d.ts +7 -0
- package/node_modules/@posthog/core/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/index.js +82 -21
- package/node_modules/@posthog/core/dist/index.mjs +4 -0
- package/node_modules/@posthog/core/dist/logs/index.d.ts +3 -2
- package/node_modules/@posthog/core/dist/logs/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/logs/index.js +28 -22
- package/node_modules/@posthog/core/dist/logs/index.mjs +29 -23
- package/node_modules/@posthog/core/dist/logs/logs-utils.js +1 -1
- package/node_modules/@posthog/core/dist/logs/logs-utils.mjs +2 -2
- package/node_modules/@posthog/core/dist/logs/types.d.ts +2 -2
- package/node_modules/@posthog/core/dist/metrics/index.d.ts +5 -2
- package/node_modules/@posthog/core/dist/metrics/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/metrics/index.js +28 -14
- package/node_modules/@posthog/core/dist/metrics/index.mjs +29 -15
- package/node_modules/@posthog/core/dist/metrics/metrics-utils.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/metrics/metrics-utils.js +1 -2
- package/node_modules/@posthog/core/dist/metrics/metrics-utils.mjs +2 -3
- package/node_modules/@posthog/core/dist/metrics/types.d.ts +7 -0
- package/node_modules/@posthog/core/dist/metrics/types.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts +32 -4
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.js +68 -20
- package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +68 -20
- package/node_modules/@posthog/core/dist/traces/config.d.ts +13 -0
- package/node_modules/@posthog/core/dist/traces/config.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/config.js +101 -0
- package/node_modules/@posthog/core/dist/traces/config.mjs +63 -0
- package/node_modules/@posthog/core/dist/traces/context.d.ts +18 -0
- package/node_modules/@posthog/core/dist/traces/context.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/context.js +53 -0
- package/node_modules/@posthog/core/dist/traces/context.mjs +15 -0
- package/node_modules/@posthog/core/dist/traces/ids.d.ts +12 -0
- package/node_modules/@posthog/core/dist/traces/ids.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/ids.js +92 -0
- package/node_modules/@posthog/core/dist/traces/ids.mjs +42 -0
- package/node_modules/@posthog/core/dist/traces/index.d.ts +150 -0
- package/node_modules/@posthog/core/dist/traces/index.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/index.js +551 -0
- package/node_modules/@posthog/core/dist/traces/index.mjs +513 -0
- package/node_modules/@posthog/core/dist/traces/otlp.d.ts +24 -0
- package/node_modules/@posthog/core/dist/traces/otlp.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/otlp.js +158 -0
- package/node_modules/@posthog/core/dist/traces/otlp.mjs +108 -0
- package/node_modules/@posthog/core/dist/traces/sanitize.d.ts +32 -0
- package/node_modules/@posthog/core/dist/traces/sanitize.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/sanitize.js +93 -0
- package/node_modules/@posthog/core/dist/traces/sanitize.mjs +43 -0
- package/node_modules/@posthog/core/dist/traces/span.d.ts +189 -0
- package/node_modules/@posthog/core/dist/traces/span.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/span.js +533 -0
- package/node_modules/@posthog/core/dist/traces/span.mjs +462 -0
- package/node_modules/@posthog/core/dist/traces/traceparent.d.ts +51 -0
- package/node_modules/@posthog/core/dist/traces/traceparent.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/traceparent.js +116 -0
- package/node_modules/@posthog/core/dist/traces/traceparent.mjs +63 -0
- package/node_modules/@posthog/core/dist/traces/types.d.ts +114 -0
- package/node_modules/@posthog/core/dist/traces/types.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/traces/types.js +18 -0
- package/node_modules/@posthog/core/dist/traces/types.mjs +1 -0
- package/node_modules/@posthog/core/dist/utils/backoff.d.ts +23 -0
- package/node_modules/@posthog/core/dist/utils/backoff.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/utils/backoff.js +65 -0
- package/node_modules/@posthog/core/dist/utils/backoff.mjs +14 -0
- package/node_modules/@posthog/core/dist/utils/flush-timer.d.ts +26 -0
- package/node_modules/@posthog/core/dist/utils/flush-timer.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/utils/flush-timer.js +67 -0
- package/node_modules/@posthog/core/dist/utils/flush-timer.mjs +29 -0
- package/node_modules/@posthog/core/dist/utils/json-utils.d.ts +7 -0
- package/node_modules/@posthog/core/dist/utils/json-utils.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/utils/json-utils.js +27 -0
- package/node_modules/@posthog/core/dist/utils/json-utils.mjs +25 -1
- package/node_modules/@posthog/core/dist/utils/otlp-resource.d.ts +13 -2
- package/node_modules/@posthog/core/dist/utils/otlp-resource.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/utils/otlp-resource.js +34 -7
- package/node_modules/@posthog/core/dist/utils/otlp-resource.mjs +26 -2
- package/node_modules/@posthog/core/dist/utils/retry-after.d.ts +55 -0
- package/node_modules/@posthog/core/dist/utils/retry-after.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/utils/retry-after.js +95 -0
- package/node_modules/@posthog/core/dist/utils/retry-after.mjs +50 -0
- package/node_modules/@posthog/core/package.json +3 -3
- package/node_modules/@posthog/core/src/error-tracking/index.ts +24 -1
- package/node_modules/@posthog/core/src/error-tracking/parsers/base.spec.ts +77 -7
- package/node_modules/@posthog/core/src/error-tracking/parsers/base.ts +42 -19
- package/node_modules/@posthog/core/src/index.ts +18 -0
- package/node_modules/@posthog/core/src/logs/index.spec.ts +490 -2
- package/node_modules/@posthog/core/src/logs/index.ts +63 -31
- package/node_modules/@posthog/core/src/logs/logs-utils.ts +2 -2
- package/node_modules/@posthog/core/src/logs/types.ts +2 -2
- package/node_modules/@posthog/core/src/metrics/index.spec.ts +304 -0
- package/node_modules/@posthog/core/src/metrics/index.ts +53 -16
- package/node_modules/@posthog/core/src/metrics/metrics-utils.ts +2 -3
- package/node_modules/@posthog/core/src/metrics/types.ts +10 -2
- package/node_modules/@posthog/core/src/posthog-core-stateless.ts +157 -38
- package/node_modules/@posthog/core/src/traces/config.spec.ts +271 -0
- package/node_modules/@posthog/core/src/traces/config.ts +142 -0
- package/node_modules/@posthog/core/src/traces/context.ts +30 -0
- package/node_modules/@posthog/core/src/traces/ids.spec.ts +115 -0
- package/node_modules/@posthog/core/src/traces/ids.ts +75 -0
- package/node_modules/@posthog/core/src/traces/index.spec.ts +3187 -0
- package/node_modules/@posthog/core/src/traces/index.ts +1060 -0
- package/node_modules/@posthog/core/src/traces/live-spans.spec.ts +69 -0
- package/node_modules/@posthog/core/src/traces/otlp.spec.ts +368 -0
- package/node_modules/@posthog/core/src/traces/otlp.ts +191 -0
- package/node_modules/@posthog/core/src/traces/sanitize.ts +116 -0
- package/node_modules/@posthog/core/src/traces/span.spec.ts +1122 -0
- package/node_modules/@posthog/core/src/traces/span.ts +822 -0
- package/node_modules/@posthog/core/src/traces/traceparent.spec.ts +184 -0
- package/node_modules/@posthog/core/src/traces/traceparent.ts +172 -0
- package/node_modules/@posthog/core/src/traces/types.ts +140 -0
- package/node_modules/@posthog/core/src/utils/backoff.ts +44 -0
- package/node_modules/@posthog/core/src/utils/flush-timer.ts +50 -0
- package/node_modules/@posthog/core/src/utils/json-utils.ts +33 -0
- package/node_modules/@posthog/core/src/utils/otlp-resource.spec.ts +55 -9
- package/node_modules/@posthog/core/src/utils/otlp-resource.ts +45 -4
- package/node_modules/@posthog/core/src/utils/retry-after.ts +135 -0
- package/node_modules/@posthog/types/dist/index.d.ts +1 -0
- package/node_modules/@posthog/types/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/posthog-config.d.ts +10 -5
- package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/traces.d.ts +387 -0
- package/node_modules/@posthog/types/dist/traces.d.ts.map +1 -0
- package/node_modules/@posthog/types/dist/traces.js +18 -0
- package/node_modules/@posthog/types/dist/traces.mjs +1 -0
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/index.ts +19 -0
- package/node_modules/@posthog/types/src/posthog-config.ts +10 -5
- package/node_modules/@posthog/types/src/traces.ts +429 -0
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-FEB2VFS7.js → chunk-KNAYKBEE.js} +96 -96
- package/node_modules/@zuplo/runtime/out/esm/chunk-KNAYKBEE.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/package.json +11 -11
- package/node_modules/@zuplo/runtime/out/esm/chunk-FEB2VFS7.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-FEB2VFS7.js.LEGAL.txt → chunk-KNAYKBEE.js.LEGAL.txt} +0 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export type { Span, SpanAttributes, SpanAttributeValue, SpanKind, SpanStatusCode, SpanTimeInput, StartSpanOptions, TracesConfig, BeforeSpanSendFn, OtlpSpan, OtlpSpanEvent, OtlpSpanKeyValue, OtlpSpanStatus, OtlpTracesPayload, } from '@posthog/types';
|
|
2
|
+
import type { BeforeSpanSendFn, OtlpTracesPayload, Span, SpanAttributes, SpanRecord as HookSpanRecord, TracesConfig } from '@posthog/types';
|
|
3
|
+
/** Same tagged outcome shape as `SendLogsBatchOutcome` — one policy for all three signals. */
|
|
4
|
+
export type SendTracesBatchOutcome = {
|
|
5
|
+
kind: 'ok';
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'retry-later';
|
|
8
|
+
error: unknown;
|
|
9
|
+
retryAfterMs?: number;
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'too-large';
|
|
12
|
+
/**
|
|
13
|
+
* True when the SDK measured the body itself rather than the endpoint
|
|
14
|
+
* refusing it, so the caller can split this drain without lowering the
|
|
15
|
+
* batch size it keeps between them.
|
|
16
|
+
*/
|
|
17
|
+
measuredLocally?: boolean;
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'fatal';
|
|
20
|
+
error: unknown;
|
|
21
|
+
};
|
|
22
|
+
/** The minimal host surface `PostHogTraces` depends on; `PostHogCoreStateless` satisfies it structurally. */
|
|
23
|
+
export interface TracesHost {
|
|
24
|
+
readonly isDisabled: boolean;
|
|
25
|
+
readonly optedOut: boolean;
|
|
26
|
+
_sendTracesBatch(payload: OtlpTracesPayload): Promise<SendTracesBatchOutcome>;
|
|
27
|
+
getLibraryId(): string;
|
|
28
|
+
getLibraryVersion(): string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* PostHog context snapshotted onto every span at start, so traces join back to
|
|
32
|
+
* persons and sessions. Each SDK fills the fields that apply to it; absent
|
|
33
|
+
* fields add no attribute. Internal to `@posthog/core`.
|
|
34
|
+
*
|
|
35
|
+
* @internal Exposed for cross-package use within this SDK; not part of the stable public API.
|
|
36
|
+
*/
|
|
37
|
+
export interface TraceSdkContext {
|
|
38
|
+
distinctId?: string;
|
|
39
|
+
sessionId?: string;
|
|
40
|
+
/** Web-only — current page URL. */
|
|
41
|
+
currentUrl?: string;
|
|
42
|
+
/** Mobile-only — current screen / view name. */
|
|
43
|
+
screenName?: string;
|
|
44
|
+
/** Mobile-only — app foreground/background state. */
|
|
45
|
+
appState?: 'foreground' | 'background';
|
|
46
|
+
}
|
|
47
|
+
export interface SpanEventRecord {
|
|
48
|
+
name: string;
|
|
49
|
+
/** ms epoch. */
|
|
50
|
+
timestamp: number;
|
|
51
|
+
attributes?: SpanAttributes;
|
|
52
|
+
/**
|
|
53
|
+
* How many of this event's attributes the cap discarded.
|
|
54
|
+
*
|
|
55
|
+
* Unlike the span-level counts, this one is carried on an object a
|
|
56
|
+
* `beforeSpanSend` hook holds: the public event type omits it, so a hook that
|
|
57
|
+
* rebuilds its events returns them without it. Events have no identity to
|
|
58
|
+
* match a rebuilt array back against, so what a hook drops here stays dropped.
|
|
59
|
+
*/
|
|
60
|
+
droppedAttributesCount?: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A finished span as the SDK carries it, which is the hook-visible record plus
|
|
64
|
+
* the fields no hook may rewrite. Declaring only the additions keeps the shared
|
|
65
|
+
* half from drifting; a field added here rather than to the public record is a
|
|
66
|
+
* field `beforeSpanSend` cannot see, and so cannot corrupt.
|
|
67
|
+
*/
|
|
68
|
+
export interface SpanRecord extends HookSpanRecord {
|
|
69
|
+
/** The hook-visible event plus the SDK's own per-event drop count. */
|
|
70
|
+
events: SpanEventRecord[];
|
|
71
|
+
traceState?: string;
|
|
72
|
+
/** The W3C trace-flags byte this span propagates, e.g. `01` sampled. */
|
|
73
|
+
traceFlags: string;
|
|
74
|
+
/** True when the parent came from a `traceparent` header rather than a local handle. */
|
|
75
|
+
parentIsRemote: boolean;
|
|
76
|
+
droppedAttributesCount?: number;
|
|
77
|
+
droppedEventsCount?: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Tracks which span is active, so spans nest without manual parent plumbing. The
|
|
81
|
+
* mechanism is platform-specific and stays out of core: node injects an
|
|
82
|
+
* `AsyncLocalStorage` implementation over the synchronous default.
|
|
83
|
+
*/
|
|
84
|
+
export interface SpanContextManager {
|
|
85
|
+
/** The active span, or `undefined` when none is active. */
|
|
86
|
+
active(): Span | undefined;
|
|
87
|
+
/** Run `fn` with `span` active for its (synchronous and async) duration. */
|
|
88
|
+
with<T>(span: Span, fn: () => T): T;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Fields `PostHogTraces` needs resolved at runtime. The host SDK applies its own
|
|
92
|
+
* defaults and hands the resolved config to the constructor.
|
|
93
|
+
*
|
|
94
|
+
* @internal Exposed for cross-package use within this SDK; not part of the stable public API.
|
|
95
|
+
*/
|
|
96
|
+
export interface ResolvedTracesConfig extends TracesConfig {
|
|
97
|
+
flushIntervalMs: number;
|
|
98
|
+
maxExportBatchSize: number;
|
|
99
|
+
/**
|
|
100
|
+
* Bound on the in-memory export queue. On overflow the *incoming* span is
|
|
101
|
+
* dropped rather than queued ones, whose children may already have shipped.
|
|
102
|
+
*/
|
|
103
|
+
maxQueueSize: number;
|
|
104
|
+
beforeSpanSend: BeforeSpanSendFn[];
|
|
105
|
+
maxAttributesPerSpan: number;
|
|
106
|
+
maxEventsPerSpan: number;
|
|
107
|
+
maxAttributesPerEvent: number;
|
|
108
|
+
maxAttributeValueLength: number;
|
|
109
|
+
/** Bound on spans started but not yet ended. At the bound `startSpan` returns a no-op handle. */
|
|
110
|
+
maxLiveSpans: number;
|
|
111
|
+
/** How long a span may stay live before it stops being accounted for and can never export. */
|
|
112
|
+
maxSpanAgeMs: number;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/traces/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -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 { };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Doublings the retry delay may grow by before it stops growing. */
|
|
2
|
+
export declare const MAX_FLUSH_BACKOFF_EXPONENT = 6;
|
|
3
|
+
/**
|
|
4
|
+
* Ceiling on the SDK's own retry delay, which the logs and traces contracts
|
|
5
|
+
* both state as "exponential backoff capped at ~30s". A host that configured a
|
|
6
|
+
* longer flush interval keeps it: the cap is there to stop the doubling running
|
|
7
|
+
* away, not to flush more often than asked.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MAX_FLUSH_BACKOFF_MS = 30000;
|
|
10
|
+
/** A multiplier in `[1 - JITTER, 1 + JITTER]`, drawn once per failure by the caller. */
|
|
11
|
+
export declare function drawJitter(): number;
|
|
12
|
+
/** No jitter, for the delay a queue uses when nothing has failed. */
|
|
13
|
+
export declare const NO_JITTER = 1;
|
|
14
|
+
/**
|
|
15
|
+
* The delay before retrying an export, `baseMs` doubled once per failure past
|
|
16
|
+
* the first and capped at `maxMs`.
|
|
17
|
+
*
|
|
18
|
+
* `jitter` is applied to the SDK's own delay only. A `Retry-After` the endpoint
|
|
19
|
+
* sent is a floor underneath it, applied by the caller: spreading a fleet must
|
|
20
|
+
* never move a retry earlier than the endpoint asked for.
|
|
21
|
+
*/
|
|
22
|
+
export declare function backoffDelayMs(baseMs: number, failures: number, jitter: number, maxMs?: number): number;
|
|
23
|
+
//# sourceMappingURL=backoff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backoff.d.ts","sourceRoot":"","sources":["../../src/utils/backoff.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,eAAO,MAAM,0BAA0B,IAAI,CAAA;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,QAAS,CAAA;AAa1C,wFAAwF;AACxF,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,qEAAqE;AACrE,eAAO,MAAM,SAAS,IAAI,CAAA;AAE1B;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAKvG"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
const MAX_FLUSH_BACKOFF_EXPONENT = 6;
|
|
31
|
+
const MAX_FLUSH_BACKOFF_MS = 30000;
|
|
32
|
+
const JITTER = 0.25;
|
|
33
|
+
function drawJitter() {
|
|
34
|
+
return 1 - JITTER + Math.random() * JITTER * 2;
|
|
35
|
+
}
|
|
36
|
+
const NO_JITTER = 1;
|
|
37
|
+
function backoffDelayMs(baseMs, failures, jitter, maxMs) {
|
|
38
|
+
const exponent = Math.min(Math.max(0, failures - 1), MAX_FLUSH_BACKOFF_EXPONENT);
|
|
39
|
+
const delay = baseMs * 2 ** exponent;
|
|
40
|
+
const capped = void 0 === maxMs ? delay : Math.min(delay, Math.max(maxMs, baseMs));
|
|
41
|
+
return Math.round(capped * jitter);
|
|
42
|
+
}
|
|
43
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
44
|
+
backoffDelayMs: ()=>backoffDelayMs,
|
|
45
|
+
drawJitter: ()=>drawJitter
|
|
46
|
+
}, {
|
|
47
|
+
MAX_FLUSH_BACKOFF_EXPONENT: MAX_FLUSH_BACKOFF_EXPONENT,
|
|
48
|
+
MAX_FLUSH_BACKOFF_MS: MAX_FLUSH_BACKOFF_MS,
|
|
49
|
+
NO_JITTER: NO_JITTER
|
|
50
|
+
});
|
|
51
|
+
exports.MAX_FLUSH_BACKOFF_EXPONENT = __webpack_exports__.MAX_FLUSH_BACKOFF_EXPONENT;
|
|
52
|
+
exports.MAX_FLUSH_BACKOFF_MS = __webpack_exports__.MAX_FLUSH_BACKOFF_MS;
|
|
53
|
+
exports.NO_JITTER = __webpack_exports__.NO_JITTER;
|
|
54
|
+
exports.backoffDelayMs = __webpack_exports__.backoffDelayMs;
|
|
55
|
+
exports.drawJitter = __webpack_exports__.drawJitter;
|
|
56
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
57
|
+
"MAX_FLUSH_BACKOFF_EXPONENT",
|
|
58
|
+
"MAX_FLUSH_BACKOFF_MS",
|
|
59
|
+
"NO_JITTER",
|
|
60
|
+
"backoffDelayMs",
|
|
61
|
+
"drawJitter"
|
|
62
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
63
|
+
Object.defineProperty(exports, '__esModule', {
|
|
64
|
+
value: true
|
|
65
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const MAX_FLUSH_BACKOFF_EXPONENT = 6;
|
|
2
|
+
const MAX_FLUSH_BACKOFF_MS = 30000;
|
|
3
|
+
const JITTER = 0.25;
|
|
4
|
+
function drawJitter() {
|
|
5
|
+
return 1 - JITTER + Math.random() * JITTER * 2;
|
|
6
|
+
}
|
|
7
|
+
const NO_JITTER = 1;
|
|
8
|
+
function backoffDelayMs(baseMs, failures, jitter, maxMs) {
|
|
9
|
+
const exponent = Math.min(Math.max(0, failures - 1), MAX_FLUSH_BACKOFF_EXPONENT);
|
|
10
|
+
const delay = baseMs * 2 ** exponent;
|
|
11
|
+
const capped = void 0 === maxMs ? delay : Math.min(delay, Math.max(maxMs, baseMs));
|
|
12
|
+
return Math.round(capped * jitter);
|
|
13
|
+
}
|
|
14
|
+
export { MAX_FLUSH_BACKOFF_EXPONENT, MAX_FLUSH_BACKOFF_MS, NO_JITTER, backoffDelayMs, drawJitter };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pending flush timer of an export queue, and when it is due.
|
|
3
|
+
*
|
|
4
|
+
* The queues arm this from two kinds of place: one that must not push a pending
|
|
5
|
+
* flush further out (every capture reaches it), and one that must not pull a
|
|
6
|
+
* flush back in front of a wait the endpoint asked for. Holding the deadline
|
|
7
|
+
* next to the handle is what lets the second kind compare against the first.
|
|
8
|
+
*/
|
|
9
|
+
export declare class FlushTimer {
|
|
10
|
+
private readonly _onFire;
|
|
11
|
+
private _timer?;
|
|
12
|
+
private _firesAt;
|
|
13
|
+
/** @param _onFire runs when the timer elapses, after the handle is released. */
|
|
14
|
+
constructor(_onFire: () => void);
|
|
15
|
+
/** Whether a flush is already scheduled. */
|
|
16
|
+
get pending(): boolean;
|
|
17
|
+
/** Schedules a flush in `delayMs`, replacing any timer already pending. */
|
|
18
|
+
arm(delayMs: number): void;
|
|
19
|
+
/**
|
|
20
|
+
* Arms only if it moves the flush later, so a timer armed for a longer wait
|
|
21
|
+
* survives a caller asking for a shorter one.
|
|
22
|
+
*/
|
|
23
|
+
armNoEarlierThan(delayMs: number): void;
|
|
24
|
+
clear(): void;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=flush-timer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flush-timer.d.ts","sourceRoot":"","sources":["../../src/utils/flush-timer.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,qBAAa,UAAU;IAKT,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJpC,OAAO,CAAC,MAAM,CAAC,CAAmC;IAClD,OAAO,CAAC,QAAQ,CAAI;IAEpB,gFAAgF;gBACnD,OAAO,EAAE,MAAM,IAAI;IAEhD,4CAA4C;IAC5C,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,2EAA2E;IAC3E,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAS1B;;;OAGG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAOvC,KAAK,IAAI,IAAI;CAMd"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
FlushTimer: ()=>FlushTimer
|
|
32
|
+
});
|
|
33
|
+
const external_index_js_namespaceObject = require("./index.js");
|
|
34
|
+
class FlushTimer {
|
|
35
|
+
constructor(_onFire){
|
|
36
|
+
this._onFire = _onFire;
|
|
37
|
+
this._firesAt = 0;
|
|
38
|
+
}
|
|
39
|
+
get pending() {
|
|
40
|
+
return !!this._timer;
|
|
41
|
+
}
|
|
42
|
+
arm(delayMs) {
|
|
43
|
+
this.clear();
|
|
44
|
+
this._firesAt = Date.now() + delayMs;
|
|
45
|
+
this._timer = (0, external_index_js_namespaceObject.safeSetTimeout)(()=>{
|
|
46
|
+
this._timer = void 0;
|
|
47
|
+
this._onFire();
|
|
48
|
+
}, delayMs);
|
|
49
|
+
}
|
|
50
|
+
armNoEarlierThan(delayMs) {
|
|
51
|
+
if (this._timer && Date.now() + delayMs <= this._firesAt) return;
|
|
52
|
+
this.arm(delayMs);
|
|
53
|
+
}
|
|
54
|
+
clear() {
|
|
55
|
+
if (this._timer) {
|
|
56
|
+
clearTimeout(this._timer);
|
|
57
|
+
this._timer = void 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.FlushTimer = __webpack_exports__.FlushTimer;
|
|
62
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
63
|
+
"FlushTimer"
|
|
64
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
65
|
+
Object.defineProperty(exports, '__esModule', {
|
|
66
|
+
value: true
|
|
67
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { safeSetTimeout } from "./index.mjs";
|
|
2
|
+
class FlushTimer {
|
|
3
|
+
constructor(_onFire){
|
|
4
|
+
this._onFire = _onFire;
|
|
5
|
+
this._firesAt = 0;
|
|
6
|
+
}
|
|
7
|
+
get pending() {
|
|
8
|
+
return !!this._timer;
|
|
9
|
+
}
|
|
10
|
+
arm(delayMs) {
|
|
11
|
+
this.clear();
|
|
12
|
+
this._firesAt = Date.now() + delayMs;
|
|
13
|
+
this._timer = safeSetTimeout(()=>{
|
|
14
|
+
this._timer = void 0;
|
|
15
|
+
this._onFire();
|
|
16
|
+
}, delayMs);
|
|
17
|
+
}
|
|
18
|
+
armNoEarlierThan(delayMs) {
|
|
19
|
+
if (this._timer && Date.now() + delayMs <= this._firesAt) return;
|
|
20
|
+
this.arm(delayMs);
|
|
21
|
+
}
|
|
22
|
+
clear() {
|
|
23
|
+
if (this._timer) {
|
|
24
|
+
clearTimeout(this._timer);
|
|
25
|
+
this._timer = void 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export { FlushTimer };
|
|
@@ -18,4 +18,11 @@ export declare function sanitizeString(value: string): string;
|
|
|
18
18
|
* The limits keep pathological values from causing unbounded recursion or traversal.
|
|
19
19
|
*/
|
|
20
20
|
export declare function toJsonSafeValue(value: unknown): unknown;
|
|
21
|
+
/**
|
|
22
|
+
* Copies caller-supplied attributes onto `target`, own enumerable keys only.
|
|
23
|
+
*
|
|
24
|
+
* Read key by key rather than spread: a getter over a disposed resource or a
|
|
25
|
+
* revoked proxy throws on the read itself, before the encoder's guards see it.
|
|
26
|
+
*/
|
|
27
|
+
export declare function assignUserAttributes<T extends Record<string, any>>(target: T, source: Record<string, unknown> | undefined): T;
|
|
21
28
|
//# sourceMappingURL=json-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-utils.d.ts","sourceRoot":"","sources":["../../src/utils/json-utils.ts"],"names":[],"mappings":"AAAA;sEACsE;AACtE,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAC3C,eAAO,MAAM,yBAAyB,OAAQ,CAAA;AAC9C,eAAO,MAAM,yBAAyB,QAAS,CAAA;AAC/C,eAAO,MAAM,cAAc,eAAe,CAAA;AAC1C,eAAO,MAAM,eAAe,gBAAgB,CAAA;AAC5C,eAAO,MAAM,oBAAoB,qBAAqB,CAAA;AACtD,eAAO,MAAM,cAAc,eAAe,CAAA;AAW1C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAiBpD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CA2GvD"}
|
|
1
|
+
{"version":3,"file":"json-utils.d.ts","sourceRoot":"","sources":["../../src/utils/json-utils.ts"],"names":[],"mappings":"AAAA;sEACsE;AACtE,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAC3C,eAAO,MAAM,yBAAyB,OAAQ,CAAA;AAC9C,eAAO,MAAM,yBAAyB,QAAS,CAAA;AAC/C,eAAO,MAAM,cAAc,eAAe,CAAA;AAC1C,eAAO,MAAM,eAAe,gBAAgB,CAAA;AAC5C,eAAO,MAAM,oBAAoB,qBAAqB,CAAA;AACtD,eAAO,MAAM,cAAc,eAAe,CAAA;AAW1C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAiBpD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CA2GvD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAChE,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC1C,CAAC,CAsBH"}
|
|
@@ -120,7 +120,32 @@ function toJsonSafeValue(value) {
|
|
|
120
120
|
};
|
|
121
121
|
return convert(value, 0);
|
|
122
122
|
}
|
|
123
|
+
function assignUserAttributes(target, source) {
|
|
124
|
+
if (!source) return target;
|
|
125
|
+
let keys = [];
|
|
126
|
+
try {
|
|
127
|
+
keys = Object.keys(source);
|
|
128
|
+
} catch {
|
|
129
|
+
keys = [];
|
|
130
|
+
}
|
|
131
|
+
for (const key of keys){
|
|
132
|
+
let value;
|
|
133
|
+
try {
|
|
134
|
+
value = source[key];
|
|
135
|
+
} catch {
|
|
136
|
+
value = UNSERIALIZABLE_VALUE;
|
|
137
|
+
}
|
|
138
|
+
Object.defineProperty(target, key, {
|
|
139
|
+
value,
|
|
140
|
+
enumerable: true,
|
|
141
|
+
writable: true,
|
|
142
|
+
configurable: true
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return target;
|
|
146
|
+
}
|
|
123
147
|
__webpack_require__.d(__webpack_exports__, {
|
|
148
|
+
assignUserAttributes: ()=>assignUserAttributes,
|
|
124
149
|
sanitizeString: ()=>sanitizeString,
|
|
125
150
|
toJsonSafeValue: ()=>toJsonSafeValue
|
|
126
151
|
}, {
|
|
@@ -139,6 +164,7 @@ exports.MAX_JSON_SAFE_VALUE_ITEMS = __webpack_exports__.MAX_JSON_SAFE_VALUE_ITEM
|
|
|
139
164
|
exports.MAX_JSON_SAFE_VALUE_NODES = __webpack_exports__.MAX_JSON_SAFE_VALUE_NODES;
|
|
140
165
|
exports.TRUNCATED_VALUE = __webpack_exports__.TRUNCATED_VALUE;
|
|
141
166
|
exports.UNSERIALIZABLE_VALUE = __webpack_exports__.UNSERIALIZABLE_VALUE;
|
|
167
|
+
exports.assignUserAttributes = __webpack_exports__.assignUserAttributes;
|
|
142
168
|
exports.sanitizeString = __webpack_exports__.sanitizeString;
|
|
143
169
|
exports.toJsonSafeValue = __webpack_exports__.toJsonSafeValue;
|
|
144
170
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -149,6 +175,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
149
175
|
"MAX_JSON_SAFE_VALUE_NODES",
|
|
150
176
|
"TRUNCATED_VALUE",
|
|
151
177
|
"UNSERIALIZABLE_VALUE",
|
|
178
|
+
"assignUserAttributes",
|
|
152
179
|
"sanitizeString",
|
|
153
180
|
"toJsonSafeValue"
|
|
154
181
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
@@ -91,4 +91,28 @@ function toJsonSafeValue(value) {
|
|
|
91
91
|
};
|
|
92
92
|
return convert(value, 0);
|
|
93
93
|
}
|
|
94
|
-
|
|
94
|
+
function assignUserAttributes(target, source) {
|
|
95
|
+
if (!source) return target;
|
|
96
|
+
let keys = [];
|
|
97
|
+
try {
|
|
98
|
+
keys = Object.keys(source);
|
|
99
|
+
} catch {
|
|
100
|
+
keys = [];
|
|
101
|
+
}
|
|
102
|
+
for (const key of keys){
|
|
103
|
+
let value;
|
|
104
|
+
try {
|
|
105
|
+
value = source[key];
|
|
106
|
+
} catch {
|
|
107
|
+
value = UNSERIALIZABLE_VALUE;
|
|
108
|
+
}
|
|
109
|
+
Object.defineProperty(target, key, {
|
|
110
|
+
value,
|
|
111
|
+
enumerable: true,
|
|
112
|
+
writable: true,
|
|
113
|
+
configurable: true
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return target;
|
|
117
|
+
}
|
|
118
|
+
export { CIRCULAR_VALUE, FUNCTION_VALUE, MAX_JSON_SAFE_VALUE_DEPTH, MAX_JSON_SAFE_VALUE_ITEMS, MAX_JSON_SAFE_VALUE_NODES, TRUNCATED_VALUE, UNSERIALIZABLE_VALUE, assignUserAttributes, sanitizeString, toJsonSafeValue };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { OtlpKeyValue } from '@posthog/types';
|
|
2
|
+
import type { Logger } from '../types';
|
|
1
3
|
/**
|
|
2
|
-
* Shape the logs and
|
|
4
|
+
* Shape the logs, metrics and traces resolved configs share for resource
|
|
3
5
|
* attribution. Generic over the attribute value type so each signal keeps its
|
|
4
6
|
* own value union.
|
|
5
7
|
*/
|
|
@@ -10,7 +12,7 @@ export interface OtlpResourceConfig<TAttributeValue> {
|
|
|
10
12
|
resourceAttributes?: Record<string, TAttributeValue>;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
|
-
* OTLP resource attributes shared by the logs and
|
|
15
|
+
* OTLP resource attributes shared by the logs, metrics and traces envelopes.
|
|
14
16
|
*
|
|
15
17
|
* User `resourceAttributes` are spread first, then SDK-controlled keys on top so
|
|
16
18
|
* a stray user key can't clobber the ingestion-attribution ones; the dedicated
|
|
@@ -20,6 +22,15 @@ export interface OtlpResourceConfig<TAttributeValue> {
|
|
|
20
22
|
* @internal Shared within this SDK; not part of the stable public API.
|
|
21
23
|
*/
|
|
22
24
|
export declare function buildOtlpResourceAttributes<TAttributeValue>(config: OtlpResourceConfig<TAttributeValue>, sdkName: string, sdkVersion: string): Record<string, TAttributeValue | string>;
|
|
25
|
+
/**
|
|
26
|
+
* Encodes resource attributes for an OTLP envelope. The SDK-set keys are
|
|
27
|
+
* encoded on a traversal budget of their own, after the user's: a user
|
|
28
|
+
* attribute large enough to exhaust the shared budget would otherwise cost the
|
|
29
|
+
* resource its `service.name`, which ingestion attributes every record by.
|
|
30
|
+
*
|
|
31
|
+
* @internal Shared within this SDK; not part of the stable public API.
|
|
32
|
+
*/
|
|
33
|
+
export declare function toOtlpResourceKeyValueList(attributes: Record<string, unknown>, logger?: Logger): OtlpKeyValue[];
|
|
23
34
|
/**
|
|
24
35
|
* Normalizes a natively-detected OS name against the table above.
|
|
25
36
|
* Unrecognized names pass through: a wrong-looking value beats dropping an OS
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otlp-resource.d.ts","sourceRoot":"","sources":["../../src/utils/otlp-resource.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,kBAAkB,CAAC,eAAe;IACjD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CACrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,eAAe,EACzD,MAAM,EAAE,kBAAkB,CAAC,eAAe,CAAC,EAC3C,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"otlp-resource.d.ts","sourceRoot":"","sources":["../../src/utils/otlp-resource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAItC;;;;GAIG;AACH,MAAM,WAAW,kBAAkB,CAAC,eAAe;IACjD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CACrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,eAAe,EACzD,MAAM,EAAE,kBAAkB,CAAC,eAAe,CAAC,EAC3C,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC,CAY1C;AAWD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,EAAE,CAU/G;AA+BD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAK5E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMlH"}
|
|
@@ -27,9 +27,17 @@ var __webpack_require__ = {};
|
|
|
27
27
|
})();
|
|
28
28
|
var __webpack_exports__ = {};
|
|
29
29
|
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
buildOtlpResourceAttributes: ()=>buildOtlpResourceAttributes,
|
|
32
|
+
normalizeOsName: ()=>normalizeOsName,
|
|
33
|
+
osResourceAttributes: ()=>osResourceAttributes,
|
|
34
|
+
toOtlpResourceKeyValueList: ()=>toOtlpResourceKeyValueList
|
|
35
|
+
});
|
|
36
|
+
const external_json_utils_js_namespaceObject = require("./json-utils.js");
|
|
37
|
+
const external_otlp_any_value_js_namespaceObject = require("./otlp-any-value.js");
|
|
30
38
|
function buildOtlpResourceAttributes(config, sdkName, sdkVersion) {
|
|
31
39
|
return {
|
|
32
|
-
...config.resourceAttributes,
|
|
40
|
+
...(0, external_json_utils_js_namespaceObject.assignUserAttributes)({}, config.resourceAttributes),
|
|
33
41
|
'service.name': config.serviceName || 'unknown_service',
|
|
34
42
|
...config.environment && {
|
|
35
43
|
'deployment.environment': config.environment
|
|
@@ -41,15 +49,37 @@ function buildOtlpResourceAttributes(config, sdkName, sdkVersion) {
|
|
|
41
49
|
'telemetry.sdk.version': sdkVersion
|
|
42
50
|
};
|
|
43
51
|
}
|
|
52
|
+
const SDK_RESOURCE_KEYS = [
|
|
53
|
+
'service.name',
|
|
54
|
+
'deployment.environment',
|
|
55
|
+
'service.version',
|
|
56
|
+
'telemetry.sdk.name',
|
|
57
|
+
'telemetry.sdk.version'
|
|
58
|
+
];
|
|
59
|
+
function toOtlpResourceKeyValueList(attributes, logger) {
|
|
60
|
+
const user = (0, external_json_utils_js_namespaceObject.assignUserAttributes)({}, attributes);
|
|
61
|
+
const sdk = {};
|
|
62
|
+
for (const key of SDK_RESOURCE_KEYS)if (Object.prototype.hasOwnProperty.call(user, key)) {
|
|
63
|
+
sdk[key] = user[key];
|
|
64
|
+
delete user[key];
|
|
65
|
+
}
|
|
66
|
+
return [
|
|
67
|
+
...(0, external_otlp_any_value_js_namespaceObject.toOtlpKeyValueList)(user, logger),
|
|
68
|
+
...(0, external_otlp_any_value_js_namespaceObject.toOtlpKeyValueList)(sdk, logger)
|
|
69
|
+
];
|
|
70
|
+
}
|
|
44
71
|
const OS_NAMES = {
|
|
45
72
|
darwin: 'macOS',
|
|
46
73
|
win32: 'Windows',
|
|
74
|
+
cygwin: 'Windows',
|
|
47
75
|
linux: 'Linux',
|
|
48
76
|
android: 'Android',
|
|
49
77
|
freebsd: 'FreeBSD',
|
|
50
78
|
openbsd: 'OpenBSD',
|
|
79
|
+
netbsd: 'NetBSD',
|
|
51
80
|
sunos: 'SunOS',
|
|
52
81
|
aix: 'AIX',
|
|
82
|
+
haiku: 'Haiku',
|
|
53
83
|
'Mac OS X': 'macOS'
|
|
54
84
|
};
|
|
55
85
|
function normalizeOsName(name) {
|
|
@@ -67,18 +97,15 @@ function osResourceAttributes(name, version) {
|
|
|
67
97
|
} : {}
|
|
68
98
|
};
|
|
69
99
|
}
|
|
70
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
71
|
-
buildOtlpResourceAttributes: ()=>buildOtlpResourceAttributes,
|
|
72
|
-
normalizeOsName: ()=>normalizeOsName,
|
|
73
|
-
osResourceAttributes: ()=>osResourceAttributes
|
|
74
|
-
});
|
|
75
100
|
exports.buildOtlpResourceAttributes = __webpack_exports__.buildOtlpResourceAttributes;
|
|
76
101
|
exports.normalizeOsName = __webpack_exports__.normalizeOsName;
|
|
77
102
|
exports.osResourceAttributes = __webpack_exports__.osResourceAttributes;
|
|
103
|
+
exports.toOtlpResourceKeyValueList = __webpack_exports__.toOtlpResourceKeyValueList;
|
|
78
104
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
79
105
|
"buildOtlpResourceAttributes",
|
|
80
106
|
"normalizeOsName",
|
|
81
|
-
"osResourceAttributes"
|
|
107
|
+
"osResourceAttributes",
|
|
108
|
+
"toOtlpResourceKeyValueList"
|
|
82
109
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
83
110
|
Object.defineProperty(exports, '__esModule', {
|
|
84
111
|
value: true
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { assignUserAttributes } from "./json-utils.mjs";
|
|
2
|
+
import { toOtlpKeyValueList } from "./otlp-any-value.mjs";
|
|
1
3
|
function buildOtlpResourceAttributes(config, sdkName, sdkVersion) {
|
|
2
4
|
return {
|
|
3
|
-
...config.resourceAttributes,
|
|
5
|
+
...assignUserAttributes({}, config.resourceAttributes),
|
|
4
6
|
'service.name': config.serviceName || 'unknown_service',
|
|
5
7
|
...config.environment && {
|
|
6
8
|
'deployment.environment': config.environment
|
|
@@ -12,15 +14,37 @@ function buildOtlpResourceAttributes(config, sdkName, sdkVersion) {
|
|
|
12
14
|
'telemetry.sdk.version': sdkVersion
|
|
13
15
|
};
|
|
14
16
|
}
|
|
17
|
+
const SDK_RESOURCE_KEYS = [
|
|
18
|
+
'service.name',
|
|
19
|
+
'deployment.environment',
|
|
20
|
+
'service.version',
|
|
21
|
+
'telemetry.sdk.name',
|
|
22
|
+
'telemetry.sdk.version'
|
|
23
|
+
];
|
|
24
|
+
function toOtlpResourceKeyValueList(attributes, logger) {
|
|
25
|
+
const user = assignUserAttributes({}, attributes);
|
|
26
|
+
const sdk = {};
|
|
27
|
+
for (const key of SDK_RESOURCE_KEYS)if (Object.prototype.hasOwnProperty.call(user, key)) {
|
|
28
|
+
sdk[key] = user[key];
|
|
29
|
+
delete user[key];
|
|
30
|
+
}
|
|
31
|
+
return [
|
|
32
|
+
...toOtlpKeyValueList(user, logger),
|
|
33
|
+
...toOtlpKeyValueList(sdk, logger)
|
|
34
|
+
];
|
|
35
|
+
}
|
|
15
36
|
const OS_NAMES = {
|
|
16
37
|
darwin: 'macOS',
|
|
17
38
|
win32: 'Windows',
|
|
39
|
+
cygwin: 'Windows',
|
|
18
40
|
linux: 'Linux',
|
|
19
41
|
android: 'Android',
|
|
20
42
|
freebsd: 'FreeBSD',
|
|
21
43
|
openbsd: 'OpenBSD',
|
|
44
|
+
netbsd: 'NetBSD',
|
|
22
45
|
sunos: 'SunOS',
|
|
23
46
|
aix: 'AIX',
|
|
47
|
+
haiku: 'Haiku',
|
|
24
48
|
'Mac OS X': 'macOS'
|
|
25
49
|
};
|
|
26
50
|
function normalizeOsName(name) {
|
|
@@ -38,4 +62,4 @@ function osResourceAttributes(name, version) {
|
|
|
38
62
|
} : {}
|
|
39
63
|
};
|
|
40
64
|
}
|
|
41
|
-
export { buildOtlpResourceAttributes, normalizeOsName, osResourceAttributes };
|
|
65
|
+
export { buildOtlpResourceAttributes, normalizeOsName, osResourceAttributes, toOtlpResourceKeyValueList };
|