@utk09/ui-observability 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -1
- package/README.md +170 -41
- package/dist/bus/bus.d.ts +75 -11
- package/dist/bus/links.d.ts +6 -3
- package/dist/bus-CtJWf9QN.cjs +2 -0
- package/dist/bus-CtJWf9QN.cjs.map +1 -0
- package/dist/{bus-DfAbg_pg.js → bus-D8kH58tb.js} +176 -73
- package/dist/bus-D8kH58tb.js.map +1 -0
- package/dist/capture/console.d.ts +37 -0
- package/dist/capture/errors.d.ts +2 -4
- package/dist/capture/interactions.d.ts +7 -6
- package/dist/capture/long-frames.d.ts +31 -0
- package/dist/capture/network.d.ts +23 -9
- package/dist/capture/storm.d.ts +17 -0
- package/dist/capture/types.d.ts +5 -3
- package/dist/console-BpHfWstv.cjs +2 -0
- package/dist/console-BpHfWstv.cjs.map +1 -0
- package/dist/console-DjLbryED.js +82 -0
- package/dist/console-DjLbryED.js.map +1 -0
- package/dist/constants-Br3b89Wg.cjs +2 -0
- package/dist/constants-Br3b89Wg.cjs.map +1 -0
- package/dist/constants-DM94FjVX.js +96 -0
- package/dist/constants-DM94FjVX.js.map +1 -0
- package/dist/constants.d.ts +51 -10
- package/dist/core/breadcrumbs.d.ts +1 -1
- package/dist/core/diagnostics.d.ts +2 -2
- package/dist/core/journey.d.ts +16 -4
- package/dist/core/logger.d.ts +6 -2
- package/dist/core/pipeline.d.ts +20 -11
- package/dist/core/record.d.ts +14 -6
- package/dist/core/remote-rules.d.ts +17 -0
- package/dist/core/remote-sampling.d.ts +65 -0
- package/dist/core/runtime.d.ts +52 -18
- package/dist/core/sampling.d.ts +5 -2
- package/dist/core/sender.d.ts +18 -10
- package/dist/deadline-B5DINjD5.js +111 -0
- package/dist/deadline-B5DINjD5.js.map +1 -0
- package/dist/deadline-Cbg2cbUw.cjs +2 -0
- package/dist/deadline-Cbg2cbUw.cjs.map +1 -0
- package/dist/error-like-Ywo5uRHo.js +19 -0
- package/dist/error-like-Ywo5uRHo.js.map +1 -0
- package/dist/error-like-gGRx2s36.cjs +2 -0
- package/dist/error-like-gGRx2s36.cjs.map +1 -0
- package/dist/errors-CpGRhhIf.cjs +3 -0
- package/dist/errors-CpGRhhIf.cjs.map +1 -0
- package/dist/{errors-4MQyjZVj.js → errors-DH4QJS0u.js} +38 -20
- package/dist/errors-DH4QJS0u.js.map +1 -0
- package/dist/global-scope-BN-Io_yv.cjs +2 -0
- package/dist/global-scope-BN-Io_yv.cjs.map +1 -0
- package/dist/global-scope-dp2jADRl.js +19 -0
- package/dist/global-scope-dp2jADRl.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +13 -5
- package/dist/index.js +633 -463
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-DNdf1fmL.cjs +2 -0
- package/dist/indexeddb-storage-DNdf1fmL.cjs.map +1 -0
- package/dist/{indexeddb-storage-0LtUALBg.js → indexeddb-storage-n1qkFBGA.js} +17 -17
- package/dist/indexeddb-storage-n1qkFBGA.js.map +1 -0
- package/dist/interactions-31eHGwEQ.cjs +2 -0
- package/dist/interactions-31eHGwEQ.cjs.map +1 -0
- package/dist/{interactions-BaCmoGLB.js → interactions-OU94MPXs.js} +22 -19
- package/dist/interactions-OU94MPXs.js.map +1 -0
- package/dist/journey-CE2EcwHW.cjs +2 -0
- package/dist/journey-CE2EcwHW.cjs.map +1 -0
- package/dist/journey-CeJ1QoT2.js +162 -0
- package/dist/journey-CeJ1QoT2.js.map +1 -0
- package/dist/library-request-C9uJFlbq.cjs +2 -0
- package/dist/library-request-C9uJFlbq.cjs.map +1 -0
- package/dist/library-request-DvhuplAB.js +14 -0
- package/dist/library-request-DvhuplAB.js.map +1 -0
- package/dist/long-frames-B8VdA_ny.cjs +2 -0
- package/dist/long-frames-B8VdA_ny.cjs.map +1 -0
- package/dist/long-frames-C_7OutLs.js +65 -0
- package/dist/long-frames-C_7OutLs.js.map +1 -0
- package/dist/models/batch.d.ts +1 -1
- package/dist/models/bus.d.ts +23 -4
- package/dist/models/config.d.ts +132 -11
- package/dist/models/log-record.d.ts +12 -6
- package/dist/network-BAV7ipyn.cjs +2 -0
- package/dist/network-BAV7ipyn.cjs.map +1 -0
- package/dist/network-D_lloS5t.js +174 -0
- package/dist/network-D_lloS5t.js.map +1 -0
- package/dist/patch-BX8KrPCT.cjs +2 -0
- package/dist/patch-BX8KrPCT.cjs.map +1 -0
- package/dist/patch-CCWfuEY7.js +9 -0
- package/dist/patch-CCWfuEY7.js.map +1 -0
- package/dist/{platform-ByQllE_W.cjs → platform-D4wu1eIF.cjs} +2 -2
- package/dist/platform-D4wu1eIF.cjs.map +1 -0
- package/dist/{platform-YuByH8A5.js → platform-IHBZGqUe.js} +9 -9
- package/dist/platform-IHBZGqUe.js.map +1 -0
- package/dist/remote-rules-Bt1XsdEQ.js +86 -0
- package/dist/remote-rules-Bt1XsdEQ.js.map +1 -0
- package/dist/remote-rules-kuDf5gbe.cjs +2 -0
- package/dist/remote-rules-kuDf5gbe.cjs.map +1 -0
- package/dist/sampling-BI15ds9D.cjs +2 -0
- package/dist/sampling-BI15ds9D.cjs.map +1 -0
- package/dist/sampling-o0VY1mqQ.js +63 -0
- package/dist/sampling-o0VY1mqQ.js.map +1 -0
- package/dist/sanitize-B9UheVKc.js +123 -0
- package/dist/sanitize-B9UheVKc.js.map +1 -0
- package/dist/sanitize-DSIP7amZ.cjs +2 -0
- package/dist/sanitize-DSIP7amZ.cjs.map +1 -0
- package/dist/{sender-BIob8eZz.js → sender-BnNj9bOX.js} +415 -272
- package/dist/sender-BnNj9bOX.js.map +1 -0
- package/dist/sender-D0OsyB1c.cjs +3 -0
- package/dist/sender-D0OsyB1c.cjs.map +1 -0
- package/dist/storage/emergency-queue.d.ts +1 -1
- package/dist/storage/factory.d.ts +1 -1
- package/dist/storage/idb-driver.d.ts +1 -1
- package/dist/storage/local-storage.d.ts +3 -3
- package/dist/storage/memory-storage.d.ts +3 -3
- package/dist/storm-BTw0J6eE.js +10 -0
- package/dist/storm-BTw0J6eE.js.map +1 -0
- package/dist/storm-Y-yuBhvv.cjs +2 -0
- package/dist/storm-Y-yuBhvv.cjs.map +1 -0
- package/dist/transport/compression.d.ts +1 -1
- package/dist/transport/custom-transport.d.ts +20 -0
- package/dist/transport/errors.d.ts +2 -1
- package/dist/transport/exit-flush.d.ts +32 -13
- package/dist/transport/http-transport.d.ts +57 -25
- package/dist/transport/memory-transport.d.ts +30 -0
- package/dist/transport/retry-engine.d.ts +7 -7
- package/dist/transport/serializers/select.d.ts +12 -1
- package/dist/transport/status-transport.d.ts +74 -0
- package/dist/utils/console.d.ts +1 -1
- package/dist/utils/deadline.d.ts +7 -0
- package/dist/utils/error-like.d.ts +25 -0
- package/dist/utils/global-scope.d.ts +20 -0
- package/dist/utils/identity.d.ts +1 -1
- package/dist/utils/library-console.d.ts +11 -0
- package/dist/utils/library-request.d.ts +12 -0
- package/dist/utils/patch.d.ts +9 -0
- package/dist/utils/platform.d.ts +3 -3
- package/dist/utils/sequence.d.ts +0 -5
- package/dist/utils/timer.d.ts +1 -1
- package/dist/utils/tracing.d.ts +3 -3
- package/dist/utils/unref.d.ts +2 -2
- package/dist/{web-vitals-DHZ0yA_H.js → web-vitals-Bflr5jSA.js} +4 -2
- package/dist/web-vitals-Bflr5jSA.js.map +1 -0
- package/dist/web-vitals-DFuoTQbZ.cjs +2 -0
- package/dist/web-vitals-DFuoTQbZ.cjs.map +1 -0
- package/package.json +2 -2
- package/dist/bus-DeZzr2bx.cjs +0 -2
- package/dist/bus-DeZzr2bx.cjs.map +0 -1
- package/dist/bus-DfAbg_pg.js.map +0 -1
- package/dist/constants-C8nZQBmQ.js +0 -86
- package/dist/constants-C8nZQBmQ.js.map +0 -1
- package/dist/constants-IBL_jd5R.cjs +0 -2
- package/dist/constants-IBL_jd5R.cjs.map +0 -1
- package/dist/errors-4MQyjZVj.js.map +0 -1
- package/dist/errors-CUdShXe7.cjs +0 -3
- package/dist/errors-CUdShXe7.cjs.map +0 -1
- package/dist/indexeddb-storage-0LtUALBg.js.map +0 -1
- package/dist/indexeddb-storage-CcEJlq2l.cjs +0 -2
- package/dist/indexeddb-storage-CcEJlq2l.cjs.map +0 -1
- package/dist/interactions-BMNPQ3WH.cjs +0 -2
- package/dist/interactions-BMNPQ3WH.cjs.map +0 -1
- package/dist/interactions-BaCmoGLB.js.map +0 -1
- package/dist/network-DBNvxCE3.cjs +0 -2
- package/dist/network-DBNvxCE3.cjs.map +0 -1
- package/dist/network-jQ2t8rU4.js +0 -111
- package/dist/network-jQ2t8rU4.js.map +0 -1
- package/dist/platform-ByQllE_W.cjs.map +0 -1
- package/dist/platform-YuByH8A5.js.map +0 -1
- package/dist/sampling-CbYySsZ1.js +0 -251
- package/dist/sampling-CbYySsZ1.js.map +0 -1
- package/dist/sampling-Cs50xsZl.cjs +0 -2
- package/dist/sampling-Cs50xsZl.cjs.map +0 -1
- package/dist/sender-BIob8eZz.js.map +0 -1
- package/dist/sender-iOjzcueM.cjs +0 -3
- package/dist/sender-iOjzcueM.cjs.map +0 -1
- package/dist/unref-16maCyKA.js +0 -8
- package/dist/unref-16maCyKA.js.map +0 -1
- package/dist/unref-CU9Nyz_9.cjs +0 -2
- package/dist/unref-CU9Nyz_9.cjs.map +0 -1
- package/dist/web-vitals-B2FYsEAU.cjs +0 -2
- package/dist/web-vitals-B2FYsEAU.cjs.map +0 -1
- package/dist/web-vitals-DHZ0yA_H.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-Br3b89Wg.cjs","names":["OPENFIN_UA_PATTERN","ANDROID_WEBVIEW_UA_PATTERN","IOS_DEVICE_UA_PATTERN","MACINTOSH_UA_PATTERN","MOBILE_UA_PATTERN","SEVERITY_NUMBER","LEVEL_ORDER","ATTR_LOG_TYPE","ATTR_LOG_SEQ","ATTR_APP_NAMESPACE","ATTR_PAGE_URL","ATTR_URL_FULL","ATTR_JOURNEY_ID","ATTR_JOURNEY_NAME","ATTR_JOURNEY_PARENT_ID","ATTR_SANITIZE_FAILED","ATTR_ERROR_DATA","ATTR_BREADCRUMBS","ATTR_ATTRIBUTES_DROPPED","ATTR_ATTRIBUTES_BYTES","RESOURCE_SERVICE_NAME","RESOURCE_SERVICE_VERSION","RESOURCE_DEPLOYMENT_ENVIRONMENT","RESOURCE_TELEMETRY_SDK_NAME","RESOURCE_TELEMETRY_SDK_VERSION","RESOURCE_TELEMETRY_SDK_LANGUAGE","RESOURCE_HOST_PLATFORM","RESOURCE_SESSION_ID","RESOURCE_TAB_ID","RESOURCE_CONTEXT_ID","RESOURCE_BROWSER_USER_AGENT","RESOURCE_OPENFIN_UUID","RESOURCE_OPENFIN_NAME","TELEMETRY_SDK_NAME","TELEMETRY_SDK_VERSION","TELEMETRY_SDK_LANGUAGE","SERIALIZER_NAME_OTLP","ECS_LEVEL_NAMES","CONTENT_TYPE_JSON","CONTENT_TYPE_NDJSON","NANOS_PER_MILLI","NANOS_PATTERN","HEADER_CONTENT_TYPE","HEADER_CONTENT_ENCODING","HEADER_RETRY_AFTER","HEADER_BATCH_ID","HEADER_ATTEMPT","HEADER_SAMPLING","ENCODING_GZIP","MILLIS_PER_SECOND","BEACON_LIMIT_BYTES","CONTENT_TYPE_TEXT_PLAIN","QUERY_PARAM_BATCH_ID","QUERY_PARAM_EXIT_REASON","BATCH_STORAGE_KEY_PREFIX","EMERGENCY_STORAGE_KEY_PREFIX","STORAGE_PROBE_KEY","QUOTA_EXCEEDED_ERROR","INDEXEDDB_STORE_NAME","INDEXEDDB_CREATED_AT_INDEX","STORAGE_NAME_INDEXEDDB","STORAGE_NAME_LOCAL","STORAGE_NAME_MEMORY","STORAGE_NAME_NONE","DRAIN_LOCK_NAME","EMERGENCY_LOCK_NAME","JOURNEY_STORAGE_KEY","OPENFIN_OPTIONS_TIMEOUT_MS","OPENFIN_JOURNEY_CUSTOM_DATA_KEY","BASE64_PLUS_PATTERN","BASE64_SLASH_PATTERN","BASE64_PADDING_PATTERN","BASE64URL_DASH_PATTERN","BASE64URL_UNDERSCORE_PATTERN","TRACE_MAX_AGE_MS","TRACEPARENT_HEADER","FNV_OFFSET_BASIS","FNV_PRIME","UINT32_MAX","LEVEL_BYPASS_TYPES","LOG_TYPE_METRIC","BUS_PROTOCOL","RUNTIME_GLOBAL_KEY","RUNTIME_STOPPED_KEY","LIBRARY_REQUEST_KEY","LIBRARY_CONSOLE_KEY","ERROR_STORM_WINDOW_MS","CONSOLE_DEFAULT_STYLES","DURATION_PRECISION","GAP_REPORT_THROTTLE_MS","CAPTURE_NAMESPACE","STORAGE_NAMESPACE","DEFAULT_METRIC_UNIT","UNKNOWN_SERVICE_NAME","REMOTE_SAMPLING_MAX_CHARS","REMOTE_SAMPLING_MAX_TTL_MS","REMOTE_SAMPLING_POLL_MS","UNDEFAULTED_CONFIG_KEYS","CONFIG_SECTIONS","UNDEFAULTED_SECTION_KEYS","DEFAULT_CONFIG","CONSOLE_DEFAULT_LEVEL","LOG_FLUSH_INTERVAL_MS","METRIC_FLUSH_INTERVAL_MS","REQUEST_TIMEOUT_MS","COMPRESSION_THRESHOLD_BYTES","STORAGE_DB_NAME","STORAGE_LIMITS","STORAGE_DEADLINE_MS","RETRY_BASE_DELAY_MS","RETRY_MAX_DELAY_MS","RETRY_IDLE_DELAY_MS","JOURNEY_MAX_AGE_MS","JOURNEY_URL_PARAM","BUS_CHANNEL_NAME","BUS_HANDSHAKE_TIMEOUT_MS","ERROR_DEDUPE_MS","RECORD_LIMITS"],"sources":["../src/constants.ts"],"sourcesContent":["// src/constants.ts\n//\n// Defines all limits, thresholds, timing windows, storage keys, patterns, and\n// defaults that the library uses.\n\nimport type { ConsoleStyles, ResolvedConfig } from \"./models/config\";\nimport type { LogLevel, LogType } from \"./models/log-record\";\nimport type { StorageLimits } from \"./models/storage\";\n\n// ----------------------------------\n// Library-wide\n// ----------------------------------\n\n/** Prefix on console messages this library writes. */\nexport const LIBRARY_LOG_PREFIX = \"[ui-observability]\";\n\n// ----------------------------------\n// Diagnostics\n// ----------------------------------\n\n/**\n * Throttle window for each diagnostic code, in milliseconds. It limits how often an error\n * loop calls the handler.\n */\nexport const DIAGNOSTIC_THROTTLE_MS = 1000;\n\n// ----------------------------------\n// Identity\n// ----------------------------------\n\n/** `localStorage` key for the session id and its last-seen time. */\nexport const SESSION_ID_KEY = \"ui-observability.session\";\n\n/** `sessionStorage` key for the tab id. */\nexport const TAB_ID_KEY = \"ui-observability.tab\";\n\n/** Session idle timeout, in milliseconds. */\nexport const SESSION_IDLE_MS = 30 * 60 * 1000;\n\n/** Min gap between session last-seen writes, in milliseconds. */\nexport const SESSION_TOUCH_MS = 60_000;\n\n/** Random id length, in bytes, used when `crypto.randomUUID` is unavailable. */\nexport const ID_BYTE_LENGTH = 16;\n\n/** Distinct values in one byte (256). */\nexport const BYTE_VALUE_COUNT = 256;\n\n// ----------------------------------\n// Platform detection\n// ----------------------------------\n\n/** Matches OpenFin's user agent. */\nexport const OPENFIN_UA_PATTERN = /OpenFin/i;\n\n/** Matches Android's webview token (`wv`). */\nexport const ANDROID_WEBVIEW_UA_PATTERN = /\\bwv\\b/;\n\n/** Matches iOS hardware: iPhone, iPad, iPod. */\nexport const IOS_DEVICE_UA_PATTERN = /\\b(iPhone|iPad|iPod)\\b/;\n\n/** Matches desktop macOS in a user agent. */\nexport const MACINTOSH_UA_PATTERN = /\\bMacintosh\\b/;\n\n/** Matches the mobile token. */\nexport const MOBILE_UA_PATTERN = /\\bMobile\\b/;\n\n/** WebKit engine token, present in every WebKit browser including webviews. */\nexport const WEBKIT_UA_TOKEN = \"AppleWebKit\";\n\n/** Safari token sent by real iOS browsers, not in-app webviews. */\nexport const SAFARI_UA_TOKEN = \"Safari/\";\n\n// ----------------------------------\n// Sanitizing and size estimation\n// ----------------------------------\n\n/** First UTF-16 high surrogate code unit. */\nexport const HIGH_SURROGATE_MIN = 0xd800;\n\n/** Last UTF-16 high surrogate code unit. */\nexport const HIGH_SURROGATE_MAX = 0xdbff;\n\n/** Code units below this encode as one UTF-8 byte. */\nexport const UTF8_ONE_BYTE_CEILING = 0x80;\n\n/** Code units below this, and at or above the one-byte ceiling, encode as two UTF-8 bytes. */\nexport const UTF8_TWO_BYTE_CEILING = 0x800;\n\n/** Class names kept in a `describeNode` selector. */\nexport const MAX_NODE_CLASS_NAMES = 3;\n\n/** Byte cost of a null or undefined value. */\nexport const BYTES_PER_NULL = 4;\n\n/** Byte cost of a number (flat estimate). */\nexport const BYTES_PER_NUMBER = 8;\n\n/** Byte cost of a boolean. */\nexport const BYTES_PER_BOOLEAN = 5;\n\n/** Byte cost of an object or array's wrapping braces or brackets. */\nexport const BYTES_PER_CONTAINER = 2;\n\n/** Byte cost of a string's wrapping quotes. */\nexport const BYTES_PER_QUOTED_STRING = 2;\n\n/** Byte cost of one key's punctuation: quotes, colon, comma. */\nexport const BYTES_PER_KEY_OVERHEAD = 4;\n\n// ----------------------------------\n// Record model\n// ----------------------------------\n\n/**\n * Maps each log level to its OpenTelemetry severity number.\n * @see {@link LEVEL_ORDER}\n */\nexport const SEVERITY_NUMBER: Record<LogLevel, number> = {\n TRACE: 1,\n DEBUG: 5,\n INFO: 9,\n WARN: 13,\n ERROR: 17,\n FATAL: 21,\n};\n\n/**\n * Alias for `SEVERITY_NUMBER`, used by the level filter.\n * @see {@link SEVERITY_NUMBER}\n */\nexport const LEVEL_ORDER: Record<LogLevel, number> = SEVERITY_NUMBER;\n\n// ----------------------------------\n// Attribute and resource keys\n// ----------------------------------\n//\n// Attribute and resource key names that records carry in the payload. The names\n// follow OpenTelemetry conventions. The `uiobs.` prefix marks the fields of this library.\n\n/** Record kind attribute key. */\nexport const ATTR_LOG_TYPE = \"log.type\";\n\n/** Record sequence number in its context. It starts at 1. */\nexport const ATTR_LOG_SEQ = \"log.seq\";\n\n/** Logger namespace attribute key. */\nexport const ATTR_APP_NAMESPACE = \"app.namespace\";\n\n/** Document URL when the library built the record. */\nexport const ATTR_PAGE_URL = \"page.url\";\n\n/**\n * HTTP request URL attribute key. Network capture sets it. Do not reuse `ATTR_PAGE_URL`.\n * The page URL overwrites the request target under that key.\n * @see {@link ATTR_PAGE_URL}\n */\nexport const ATTR_URL_FULL = \"url.full\";\n\n/** Journey id attribute key. */\nexport const ATTR_JOURNEY_ID = \"journey.id\";\n\n/** Journey name attribute key. */\nexport const ATTR_JOURNEY_NAME = \"journey.name\";\n\n/** Parent journey id, present only on a child journey. */\nexport const ATTR_JOURNEY_PARENT_ID = \"journey.parent_id\";\n\n/** Marks a record whose attributes failed to sanitize. */\nexport const ATTR_SANITIZE_FAILED = \"uiobs.sanitize_failed\";\n\n/** Own fields of an Error reason, or the whole reason when it is not an Error. */\nexport const ATTR_ERROR_DATA = \"error.data\";\n\n/** Breadcrumb history of an error record. */\nexport const ATTR_BREADCRUMBS = \"breadcrumbs\";\n\n/**\n * Marks a record when the library drops its attributes because they exceed the byte budget.\n * @see {@link ATTR_ATTRIBUTES_BYTES}\n */\nexport const ATTR_ATTRIBUTES_DROPPED = \"uiobs.attributes_dropped\";\n\n/**\n * Byte size of the dropped attributes.\n * @see {@link ATTR_ATTRIBUTES_DROPPED}\n */\nexport const ATTR_ATTRIBUTES_BYTES = \"uiobs.attributes_bytes\";\n\n/** Application name resource key. */\nexport const RESOURCE_SERVICE_NAME = \"service.name\";\n\n/** Application build version resource key. */\nexport const RESOURCE_SERVICE_VERSION = \"service.version\";\n\n/** Deployment environment resource key. */\nexport const RESOURCE_DEPLOYMENT_ENVIRONMENT = \"deployment.environment\";\n\n/**\n * Producer library name resource key.\n * @see {@link TELEMETRY_SDK_NAME}\n */\nexport const RESOURCE_TELEMETRY_SDK_NAME = \"telemetry.sdk.name\";\n\n/**\n * Producer library version resource key.\n * @see {@link TELEMETRY_SDK_VERSION}\n */\nexport const RESOURCE_TELEMETRY_SDK_VERSION = \"telemetry.sdk.version\";\n\n/**\n * Producer SDK language resource key.\n * @see {@link TELEMETRY_SDK_LANGUAGE}\n */\nexport const RESOURCE_TELEMETRY_SDK_LANGUAGE = \"telemetry.sdk.language\";\n\n/** Host platform resource key: browser, webview, or OpenFin. */\nexport const RESOURCE_HOST_PLATFORM = \"host.platform\";\n\n/** Session id resource key. */\nexport const RESOURCE_SESSION_ID = \"session.id\";\n\n/** Tab id resource key. */\nexport const RESOURCE_TAB_ID = \"tab.id\";\n\n/** Context (realm) id resource key. */\nexport const RESOURCE_CONTEXT_ID = \"context.id\";\n\n/** Raw user agent resource key. */\nexport const RESOURCE_BROWSER_USER_AGENT = \"browser.user_agent\";\n\n/** OpenFin application uuid resource key. */\nexport const RESOURCE_OPENFIN_UUID = \"openfin.uuid\";\n\n/** OpenFin window or view name resource key. */\nexport const RESOURCE_OPENFIN_NAME = \"openfin.name\";\n\n/**\n * Value of `telemetry.sdk.name`.\n * @see {@link RESOURCE_TELEMETRY_SDK_NAME}\n */\nexport const TELEMETRY_SDK_NAME = \"@utk09/ui-observability\";\n\n/**\n * Value of `telemetry.sdk.version`. The code does not read it from package.json.\n * Change it by hand when you change the version in package.json.\n * @see {@link RESOURCE_TELEMETRY_SDK_VERSION}\n */\nexport const TELEMETRY_SDK_VERSION = \"0.9.0\";\n\n/**\n * Value of `telemetry.sdk.language`.\n * @see {@link RESOURCE_TELEMETRY_SDK_LANGUAGE}\n */\nexport const TELEMETRY_SDK_LANGUAGE = \"webjs\";\n\n// ----------------------------------\n// Serializers\n// ----------------------------------\n\n/** OTLP/JSON serializer name. */\nexport const SERIALIZER_NAME_OTLP = \"otlp\";\n\n/** ECS serializer name. */\nexport const SERIALIZER_NAME_ECS = \"ecs\";\n\n/**\n * ECS `log.level` names that differ from the lowercase severity text. ECS spells\n * the warning level in full. All other levels match in lowercase.\n * @see {@link SERIALIZER_NAME_ECS}\n */\nexport const ECS_LEVEL_NAMES: Partial<Record<LogLevel, string>> = { WARN: \"warning\" };\n\n/** Content type for an OTLP/JSON body. */\nexport const CONTENT_TYPE_JSON = \"application/json\";\n\n/** Content type for newline-delimited JSON. */\nexport const CONTENT_TYPE_NDJSON = \"application/x-ndjson\";\n\n/** Nanoseconds per millisecond. */\nexport const NANOS_PER_MILLI = 1000000n;\n\n/**\n * Matches a nanosecond epoch in decimal digits, for example \"1755543600123000000\".\n * @see {@link NANOS_PER_MILLI}\n */\nexport const NANOS_PATTERN = /^\\d+$/;\n\n// ----------------------------------\n// HTTP transport\n// ----------------------------------\n\n/** Content-Type header name. */\nexport const HEADER_CONTENT_TYPE = \"Content-Type\";\n\n/** Content-Encoding header name. */\nexport const HEADER_CONTENT_ENCODING = \"Content-Encoding\";\n\n/** Retry-After header name. */\nexport const HEADER_RETRY_AFTER = \"Retry-After\";\n\n/**\n * Batch deduplication key header name.\n * @see {@link QUERY_PARAM_BATCH_ID}\n */\nexport const HEADER_BATCH_ID = \"X-UiObs-Batch-Id\";\n\n/** Delivery attempt number header name. */\nexport const HEADER_ATTEMPT = \"X-UiObs-Attempt\";\n\n/** Response header that carries sampling rules from the ingest server. */\nexport const HEADER_SAMPLING = \"X-UiObs-Sampling\";\n\n/** Gzip encoding name. */\nexport const ENCODING_GZIP = \"gzip\";\n\n/** Lowest valid HTTP status code. */\nexport const HTTP_STATUS_MIN = 100;\n\n/** Highest valid HTTP status code. */\nexport const HTTP_STATUS_MAX = 599;\n\n/** Lowest HTTP status code that accepts a batch. */\nexport const HTTP_SUCCESS_MIN = 200;\n\n/** Lowest HTTP status code above the success range. */\nexport const HTTP_SUCCESS_END = 300;\n\n/** 401, credentials missing or rejected. */\nexport const HTTP_UNAUTHORIZED = 401;\n\n/** 403, valid credentials but access denied. */\nexport const HTTP_FORBIDDEN = 403;\n\n/** 408, the server closed the connection after a timeout. The transport can retry. */\nexport const HTTP_REQUEST_TIMEOUT = 408;\n\n/** 413, payload too large. The transport must split the batch. */\nexport const HTTP_PAYLOAD_TOO_LARGE = 413;\n\n/** 429, backpressure. */\nexport const HTTP_TOO_MANY_REQUESTS = 429;\n\n/** 500, floor for server-side errors. */\nexport const HTTP_SERVER_ERROR_MIN = 500;\n\n/** 503, temporary unavailability. */\nexport const HTTP_SERVICE_UNAVAILABLE = 503;\n\n/** Milliseconds per second. */\nexport const MILLIS_PER_SECOND = 1000;\n\n// ----------------------------------\n// Exit flush\n// ----------------------------------\n\n/** Max exit payload size, in bytes (`sendBeacon`/`fetch(keepalive)` shared budget). */\nexport const BEACON_LIMIT_BYTES = 60_000;\n\n/** Content type for an exit payload. It is CORS-safelisted and does not cause a preflight. */\nexport const CONTENT_TYPE_TEXT_PLAIN = \"text/plain;charset=UTF-8\";\n\n/**\n * Batch id query param name, for the exit path.\n * @see {@link HEADER_BATCH_ID}\n */\nexport const QUERY_PARAM_BATCH_ID = \"uiobs_batch_id\";\n\n/** Exit reason query param name, for logs only. */\nexport const QUERY_PARAM_EXIT_REASON = \"uiobs_exit\";\n\n// ----------------------------------\n// Storage\n// ----------------------------------\n\n/** localStorage key prefix for a stored batch. */\nexport const BATCH_STORAGE_KEY_PREFIX = \"ui-observability.batch.\";\n\n/** Zero-padded digit width for the creation time in a batch key. */\nexport const BATCH_KEY_TIME_WIDTH = 14;\n\n/** localStorage key prefix for a batch that exit flush stores. */\nexport const EMERGENCY_STORAGE_KEY_PREFIX = \"ui-observability.emergency.\";\n\n/** Maximum number of exit batches in the emergency queue. */\nexport const EMERGENCY_MAX_ENTRIES = 20;\n\n/** Key that the library writes to test if localStorage accepts writes. */\nexport const STORAGE_PROBE_KEY = \"ui-observability.probe\";\n\n/** Fraction of the store to evict on a quota error (1 in N). */\nexport const QUOTA_EVICTION_DIVISOR = 4;\n\n/** DOMException name for a full store. */\nexport const QUOTA_EXCEEDED_ERROR = \"QuotaExceededError\";\n\n/**\n * Native IndexedDB version. It starts at 11. Dexie, the previous adapter, opened the\n * same database at ten times its declared version. A version below 11 makes open()\n * fail with VersionError for an existing installation. Then no code can read the\n * batches in that database.\n */\nexport const INDEXEDDB_SCHEMA_VERSION = 11;\n\n/** IndexedDB object store that holds batches. Dexie set this name before the library removed it. */\nexport const INDEXEDDB_STORE_NAME = \"batches\";\n\n/** Index on the batch store that orders reads by creation time. */\nexport const INDEXEDDB_CREATED_AT_INDEX = \"createdAt\";\n\n/** IndexedDB adapter/strategy name. */\nexport const STORAGE_NAME_INDEXEDDB = \"indexeddb\";\n\n/** localStorage adapter/strategy name. */\nexport const STORAGE_NAME_LOCAL = \"localstorage\";\n\n/** In-memory adapter/strategy name. */\nexport const STORAGE_NAME_MEMORY = \"memory\";\n\n/** Name of the storage adapter that keeps nothing. */\nexport const STORAGE_NAME_NONE = \"none\";\n\n// ----------------------------------\n// Retry\n// ----------------------------------\n\n/**\n * Origin-wide lock name a drain runs under.\n * @see {@link EMERGENCY_LOCK_NAME}\n */\nexport const DRAIN_LOCK_NAME = \"ui-observability.drain\";\n\n/**\n * Lock name startup recovery runs under.\n * @see {@link DRAIN_LOCK_NAME}\n */\nexport const EMERGENCY_LOCK_NAME = \"ui-observability.emergency\";\n\n/** Batches sent per drain tick. */\nexport const BATCHES_PER_DRAIN = 20;\n\n// ----------------------------------\n// Journey\n// ----------------------------------\n\n/** `sessionStorage` key for the current journey. */\nexport const JOURNEY_STORAGE_KEY = \"ui-observability.journey\";\n\n/**\n * Max journey name length in a token, in characters.\n * @see {@link JOURNEY_TOKEN_MAX_CHARS}\n */\nexport const JOURNEY_TOKEN_NAME_MAX_CHARS = 64;\n\n/**\n * Max whole-token length, in characters. It rejects an oversized token. It does not\n * validate the token content.\n * @see {@link JOURNEY_TOKEN_NAME_MAX_CHARS}\n */\nexport const JOURNEY_TOKEN_MAX_CHARS = 256;\n\n/**\n * Time to wait for `fin.me.getOptions()`, in milliseconds. After this time, the\n * runtime continues without a seeded journey.\n * @see {@link OPENFIN_JOURNEY_CUSTOM_DATA_KEY}\n */\nexport const OPENFIN_OPTIONS_TIMEOUT_MS = 2000;\n\n/** Key under an OpenFin window's `customData` carrying a seeded journey token. */\nexport const OPENFIN_JOURNEY_CUSTOM_DATA_KEY = \"uiObsJourney\";\n\n/** Matches `+` in standard base64 (`-` in URL-safe). */\nexport const BASE64_PLUS_PATTERN = /\\+/g;\n\n/** Matches `/` in standard base64 (`_` in URL-safe). */\nexport const BASE64_SLASH_PATTERN = /\\//g;\n\n/** Matches trailing `=` padding. */\nexport const BASE64_PADDING_PATTERN = /=+$/;\n\n/** Matches `-` in URL-safe base64 (`+` in standard). */\nexport const BASE64URL_DASH_PATTERN = /-/g;\n\n/** Matches `_` in URL-safe base64 (`/` in standard). */\nexport const BASE64URL_UNDERSCORE_PATTERN = /_/g;\n\n/** Base64 characters per 3-byte group. */\nexport const BASE64_GROUP_CHARS = 4;\n\n// ----------------------------------\n// Tracing\n// ----------------------------------\n\n/** W3C trace id width, in bytes. */\nexport const TRACE_ID_BYTES = 16;\n\n/** W3C span id width, in bytes. */\nexport const SPAN_ID_BYTES = 8;\n\n/** Max ambient trace lifetime with no activity, in milliseconds. */\nexport const TRACE_MAX_AGE_MS = 5 * 60 * 1000;\n\n/** trace-flags value with the sampled bit set. */\nexport const TRACE_FLAGS_SAMPLED = 1;\n\n/** Mask for the one-byte trace-flags field. */\nexport const TRACE_FLAGS_MASK = 0xff;\n\n/**\n * W3C trace context header name\n * @see {@link TRACEPARENT_VERSION}\n */\nexport const TRACEPARENT_HEADER = \"traceparent\";\n\n/** traceparent header version prefix. */\nexport const TRACEPARENT_VERSION = \"00\";\n\n// ----------------------------------\n// Breadcrumbs\n// ----------------------------------\n\n/** Smallest valid breadcrumb buffer capacity. */\nexport const BREADCRUMB_MIN_CAPACITY = 1;\n\n// ----------------------------------\n// Sampling\n// ----------------------------------\n//\n// FNV-1a hash constants. The sampler uses them to change a sampling key into a\n// stable 0-1 fraction.\n\n/** FNV-1a 32-bit offset basis. */\nexport const FNV_OFFSET_BASIS = 0x811c9dc5;\n\n/** FNV-1a 32-bit prime. */\nexport const FNV_PRIME = 0x01000193;\n\n/** Largest 32-bit unsigned value. */\nexport const UINT32_MAX = 0xffffffff;\n\n/**\n * Types that minLevel does not drop. An action is an audit fact and a metric is a measurement.\n * The remote rate cap for records below minLevel does not apply to them.\n */\nexport const LEVEL_BYPASS_TYPES: readonly LogType[] = [\"action\", \"metric\"];\n\n// ----------------------------------\n// Pipeline\n// ----------------------------------\n\n/** Record kind routed to the metric stream. */\nexport const LOG_TYPE_METRIC: LogType = \"metric\";\n\n// ----------------------------------\n// Bus\n// ----------------------------------\n\n/** Protocol identifier for bus envelopes. The bus drops an envelope with a different version. */\nexport const BUS_PROTOCOL = \"ui-observability/1\";\n\n/** Global window property key used to locate a same-origin runtime instance. */\nexport const RUNTIME_GLOBAL_KEY = \"ui-observability.runtime\";\n\n/** Global key of the runtime that shutdown() stopped. Calls go to it until the next configure(). */\nexport const RUNTIME_STOPPED_KEY = \"ui-observability.stopped\";\n\n/** Global symbol key of the library request scope count. All library copies on a page share it. */\nexport const LIBRARY_REQUEST_KEY = \"ui-observability.request-scope\";\n\n/** Global symbol key of the library console scope count. All library copies on a page share it. */\nexport const LIBRARY_CONSOLE_KEY = \"ui-observability.console-scope\";\n\n// ----------------------------------\n// Capture\n// ----------------------------------\n\n/** Maximum error records captured per throttling window before suppression. */\nexport const ERROR_STORM_MAX_PER_WINDOW = 20;\n\n/** Error rate-limiting window duration in milliseconds. */\nexport const ERROR_STORM_WINDOW_MS = 10_000;\n\n/**\n * Max ERROR and FATAL records that the pipeline admits in each storm window.\n * It is a safety limit for a render loop. It does not shape normal traffic.\n * ERROR and FATAL records skip sampling. A direct logger.error call has no other limit.\n */\nexport const ERROR_CEILING_MAX_PER_WINDOW = 500;\n\n/** Default minimum duration of a long frame that the library records, in milliseconds. */\nexport const LONG_FRAME_THRESHOLD_MS = 100;\n\n/** Maximum long frames recorded in each storm window. A frozen tab cannot flood the pipeline. */\nexport const LONG_FRAME_MAX_PER_WINDOW = 20;\n\n/** Maximum character length of a console breadcrumb message. */\nexport const CONSOLE_BREADCRUMB_MAX_CHARS = 200;\n\n/** Maximum distinct error signatures tracked for deduplication before LRU eviction. */\nexport const MAX_TRACKED_ERROR_SIGNATURES = 200;\n\n/** Maximum character length retained from clicked element text in breadcrumbs. */\nexport const CLICK_TEXT_MAX_CHARS = 50;\n\n/** Maximum character length retained from an aria-label attribute in generated selectors. */\nexport const ARIA_LABEL_MAX_CHARS = 40;\n\n/** Maximum class names included per element in generated CSS selectors. */\nexport const SELECTOR_MAX_CLASSES = 2;\n\n/** Default CSS of the console prefix. The colors are readable on light and dark devtools. */\nexport const CONSOLE_DEFAULT_STYLES: Readonly<Required<ConsoleStyles>> = {\n namespace: \"color:#888\",\n TRACE: \"color:#888;font-weight:bold\",\n DEBUG: \"color:#888;font-weight:bold\",\n INFO: \"color:#1e6fd9;font-weight:bold\",\n WARN: \"color:#c77700;font-weight:bold\",\n ERROR: \"color:#d32f2f;font-weight:bold\",\n FATAL: \"color:#d32f2f;font-weight:bold\",\n};\n\n/** Scaling factor for rounding duration measurements to three decimal places. */\nexport const DURATION_PRECISION = 1000;\n\n// ----------------------------------\n// Runtime\n// ----------------------------------\n\n/** Minimum duration in milliseconds between storage gap warning reports. */\nexport const GAP_REPORT_THROTTLE_MS = 60_000;\n\n/** Default namespace for telemetry records emitted by auto-capture modules. */\nexport const CAPTURE_NAMESPACE = \"uiobs.capture\";\n\n/** Default namespace for telemetry records emitted by storage subsystems. */\nexport const STORAGE_NAMESPACE = \"uiobs.storage\";\n\n/** Measurement unit that the library uses when the call gives no unit. */\nexport const DEFAULT_METRIC_UNIT = \"count\";\n\n// ----------------------------------\n// Configuration\n// ----------------------------------\n\n/** Default `service.name` when a consumer sets none. */\nexport const UNKNOWN_SERVICE_NAME = \"unknown-service\";\n\n/** Lowest sampling rate (drop everything). */\nexport const SAMPLING_RATE_MIN = 0;\n\n/** Highest sampling rate (keep everything). */\nexport const SAMPLING_RATE_MAX = 1;\n\n/**\n * Fallback for an invalid sampling rate (keep everything).\n * @see {@link SAMPLING_RATE_MAX}\n */\nexport const SAMPLING_RATE_FALLBACK = 1;\n\n/** Version of the remote sampling rules that the library accepts. */\nexport const REMOTE_SAMPLING_VERSION = 1;\n\n/** Maximum length of the sampling header, in characters. */\nexport const REMOTE_SAMPLING_MAX_CHARS = 4096;\n\n/** Maximum time that remote sampling rules stay in force, in milliseconds. */\nexport const REMOTE_SAMPLING_MAX_TTL_MS = 60 * 60 * 1000;\n\n/** Maximum namespace rates in one set of remote sampling rules. */\nexport const REMOTE_SAMPLING_MAX_RATES = 100;\n\n/** Time between two requests of a forwarder for the remote sampling rules, in milliseconds. */\nexport const REMOTE_SAMPLING_POLL_MS = 30_000;\n\n/**\n * Config keys with no default, excluded from `DEFAULT_CONFIG`.\n * @see {@link DEFAULT_CONFIG}\n */\nexport const UNDEFAULTED_CONFIG_KEYS = [\n \"redact\",\n \"onDiagnostic\",\n \"headers\",\n \"serializer\",\n \"otelLoader\",\n \"transport\",\n \"transportOnExit\",\n] as const;\n\n/**\n * Nested config section keys.\n * @see {@link ResolvedConfig}\n */\nexport const CONFIG_SECTIONS = [\"sampling\", \"bus\", \"journey\", \"capture\"] as const;\n\n/**\n * Section keys with no default, excluded from their section of `DEFAULT_CONFIG`.\n * @see {@link UNDEFAULTED_CONFIG_KEYS}\n */\nexport const UNDEFAULTED_SECTION_KEYS: Record<(typeof CONFIG_SECTIONS)[number], string[]> = {\n sampling: [],\n bus: [],\n journey: [],\n capture: [\"webVitalsLoader\"],\n};\n\n/**\n * Default runtime config before the consumer calls `configure()`. It excludes `serializer`.\n * `resolveConfig` supplies that default to prevent a circular import.\n * @see {@link ResolvedConfig}\n * @see {@link UNDEFAULTED_CONFIG_KEYS}\n */\nexport const DEFAULT_CONFIG: Omit<ResolvedConfig, \"serializer\"> = {\n endpoint: \"\",\n serviceName: \"\",\n serviceVersion: \"\",\n environment: \"\",\n enabled: true,\n minLevel: \"INFO\",\n compression: \"gzip\",\n credentials: \"omit\",\n storage: \"auto\",\n identity: \"storage\",\n sampling: {\n defaultRate: 1,\n rates: {},\n alwaysSampleTypes: [\"action\"],\n remote: false,\n remoteMaxRate: 1,\n },\n bus: { mode: \"auto\", trustedOrigins: [], openFinRole: \"auto\" },\n journey: { scope: \"auto\" },\n capture: {\n errors: true,\n rejections: true,\n resourceErrors: false,\n fetch: false,\n xhr: false,\n interactions: false,\n navigation: false,\n webVitals: false,\n longFrames: false,\n longFrameThresholdMs: LONG_FRAME_THRESHOLD_MS,\n console: false,\n fullUrls: false,\n ignoreUrls: [],\n propagateTraceHeaderTo: [],\n },\n console: { level: null, styles: CONSOLE_DEFAULT_STYLES },\n};\n\n/** Console mirroring level used when a consumer passes `console: true`. */\nexport const CONSOLE_DEFAULT_LEVEL: LogLevel = \"DEBUG\";\n\n// ----------------------------------\n// Batching\n// ----------------------------------\n\n/** Max time a partial log batch waits before the pipeline sends it, in milliseconds. */\nexport const LOG_FLUSH_INTERVAL_MS = 2000;\n\n/** Max records per log batch. At this count, the pipeline sends the batch early. */\nexport const LOG_BATCH_SIZE = 100;\n\n/**\n * Max time a partial metric batch waits before the pipeline sends it, in milliseconds.\n * Metric batches wait longer than log batches. Metrics have a higher volume, and no\n * caller waits for them.\n */\nexport const METRIC_FLUSH_INTERVAL_MS = 10_000;\n\n/** Max records per metric batch. At this count, the pipeline sends the batch early. */\nexport const METRIC_BATCH_SIZE = 500;\n\n/** Max concurrent ingest requests, across both streams. */\nexport const MAX_CONCURRENT_REQUESTS = 2;\n\n// ----------------------------------\n// HTTP transport\n// ----------------------------------\n\n/** Max time for one ingest request, in milliseconds. Then the transport aborts and retries it. */\nexport const REQUEST_TIMEOUT_MS = 15_000;\n\n/** Min payload size to compress, in bytes. */\nexport const COMPRESSION_THRESHOLD_BYTES = 1024;\n\n// ----------------------------------\n// Storage retention\n// ----------------------------------\n\n/** IndexedDB database name. */\nexport const STORAGE_DB_NAME = \"UiObservability\";\n\n/** Capacity and retention thresholds every storage adapter enforces. */\nexport const STORAGE_LIMITS: StorageLimits = {\n maxBatches: 500,\n maxAgeMs: 24 * 60 * 60 * 1000,\n maxAttempts: 5,\n};\n\n/**\n * Max time for one storage call, in milliseconds. Then the library treats the call as failed.\n * A call that does not settle keeps a dispatch slot or the drain flag.\n */\nexport const STORAGE_DEADLINE_MS = 10_000;\n\n// ----------------------------------\n// Retry backoff\n// ----------------------------------\n\n/** First backoff step, in milliseconds. Each attempt doubles it. */\nexport const RETRY_BASE_DELAY_MS = 2000;\n\n/** Backoff ceiling, in milliseconds. */\nexport const RETRY_MAX_DELAY_MS = 60_000;\n\n/** How often to check for stored work when nothing has failed recently, in milliseconds. */\nexport const RETRY_IDLE_DELAY_MS = 30_000;\n\n// ----------------------------------\n// Journey lifetime\n// ----------------------------------\n\n/** Max time a journey stays open, in milliseconds. Then the library treats it as abandoned. */\nexport const JOURNEY_MAX_AGE_MS = 30 * 60 * 1000;\n\n/** True if the journey ends for all contexts when the owning context closes. */\nexport const JOURNEY_END_ON_OWNER_CLOSE = false;\n\n/** Query parameter checked at boot for a seeded journey token. */\nexport const JOURNEY_URL_PARAM = \"__uiobs_journey\";\n\n// ----------------------------------\n// Bus handshake\n// ----------------------------------\n\n/** BroadcastChannel name for the control plane. */\nexport const BUS_CHANNEL_NAME = \"ui_observability_control\";\n\n/** Max time a forwarder waits for an owner to answer before it promotes itself, in milliseconds. */\nexport const BUS_HANDSHAKE_TIMEOUT_MS = 1500;\n\n/** Handshake attempts allowed before a cross-origin forwarder promotes itself to sender. */\nexport const BUS_MAX_HANDSHAKE_ATTEMPTS = 3;\n\n/** Max records a context buffers before it knows its bus role. */\nexport const BUS_MAX_BOOT_BUFFER_RECORDS = 500;\n\n/** Max characters of an untrusted message type in a diagnostic detail. The sender sets the text. */\nexport const BUS_TYPE_DETAIL_MAX_CHARS = 32;\n\n// ----------------------------------\n// Capture\n// ----------------------------------\n\n/** Breadcrumbs kept as context for the next error. */\nexport const MAX_BREADCRUMBS = 50;\n\n/**\n * Time window in which the library counts identical errors but does not send them again,\n * in milliseconds.\n */\nexport const ERROR_DEDUPE_MS = 5000;\n\n// ----------------------------------\n// Per-record size caps\n// ----------------------------------\n\n/** Size caps for every record. The library applies them after sanitize and after redact. */\nexport const RECORD_LIMITS = {\n maxBodyChars: 4096,\n maxAttributeChars: 8192,\n maxAttributeCount: 128,\n maxStackChars: 8192,\n maxDepth: 6,\n maxArrayLength: 100,\n maxNodes: 10_000,\n maxRecordBytes: 32_768,\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
//#region src/constants.ts
|
|
2
|
+
var ee = "[ui-observability]", te = 1e3, e = "ui-observability.session", ne = "ui-observability.tab", t = 18e5, n = 6e4, r = /OpenFin/i, i = /\bwv\b/, a = /\b(iPhone|iPad|iPod)\b/, o = /\bMacintosh\b/, s = /\bMobile\b/, c = "AppleWebKit", l = "Safari/", u = 55296, d = 56319, f = 2048, p = {
|
|
3
|
+
TRACE: 1,
|
|
4
|
+
DEBUG: 5,
|
|
5
|
+
INFO: 9,
|
|
6
|
+
WARN: 13,
|
|
7
|
+
ERROR: 17,
|
|
8
|
+
FATAL: 21
|
|
9
|
+
}, m = p, h = "log.type", g = "log.seq", _ = "app.namespace", v = "page.url", y = "url.full", b = "journey.id", x = "journey.name", S = "journey.parent_id", C = "uiobs.sanitize_failed", w = "error.data", T = "breadcrumbs", E = "uiobs.attributes_dropped", D = "uiobs.attributes_bytes", O = "service.name", k = "service.version", A = "deployment.environment", j = "telemetry.sdk.name", M = "telemetry.sdk.version", N = "telemetry.sdk.language", P = "host.platform", F = "session.id", I = "tab.id", L = "context.id", R = "browser.user_agent", z = "openfin.uuid", B = "openfin.name", V = "@utk09/ui-observability", H = "0.9.0", U = "webjs", W = "otlp", G = { WARN: "warning" }, K = "application/json", q = "application/x-ndjson", J = 1000000n, Y = /^\d+$/, X = "Content-Type", Z = "Content-Encoding", re = "Retry-After", ie = "X-UiObs-Batch-Id", ae = "X-UiObs-Attempt", oe = "X-UiObs-Sampling", se = "gzip", ce = 1e3, le = 6e4, ue = "text/plain;charset=UTF-8", de = "uiobs_batch_id", fe = "uiobs_exit", pe = "ui-observability.batch.", me = "ui-observability.emergency.", he = "ui-observability.probe", ge = "QuotaExceededError", _e = "batches", ve = "createdAt", ye = "indexeddb", Q = "localstorage", be = "memory", xe = "none", Se = "ui-observability.drain", Ce = "ui-observability.emergency", we = "ui-observability.journey", Te = 2e3, Ee = "uiObsJourney", De = /\+/g, Oe = /\//g, ke = /=+$/, Ae = /-/g, je = /_/g, Me = 3e5, Ne = "traceparent", Pe = 2166136261, Fe = 16777619, Ie = 4294967295, Le = ["action", "metric"], Re = "metric", ze = "ui-observability/1", Be = "ui-observability.runtime", Ve = "ui-observability.stopped", He = "ui-observability.request-scope", Ue = "ui-observability.console-scope", We = 1e4, $ = {
|
|
10
|
+
namespace: "color:#888",
|
|
11
|
+
TRACE: "color:#888;font-weight:bold",
|
|
12
|
+
DEBUG: "color:#888;font-weight:bold",
|
|
13
|
+
INFO: "color:#1e6fd9;font-weight:bold",
|
|
14
|
+
WARN: "color:#c77700;font-weight:bold",
|
|
15
|
+
ERROR: "color:#d32f2f;font-weight:bold",
|
|
16
|
+
FATAL: "color:#d32f2f;font-weight:bold"
|
|
17
|
+
}, Ge = 1e3, Ke = 6e4, qe = "uiobs.capture", Je = "uiobs.storage", Ye = "count", Xe = "unknown-service", Ze = 4096, Qe = 36e5, $e = 3e4, et = [
|
|
18
|
+
"redact",
|
|
19
|
+
"onDiagnostic",
|
|
20
|
+
"headers",
|
|
21
|
+
"serializer",
|
|
22
|
+
"otelLoader",
|
|
23
|
+
"transport",
|
|
24
|
+
"transportOnExit"
|
|
25
|
+
], tt = [
|
|
26
|
+
"sampling",
|
|
27
|
+
"bus",
|
|
28
|
+
"journey",
|
|
29
|
+
"capture"
|
|
30
|
+
], nt = {
|
|
31
|
+
sampling: [],
|
|
32
|
+
bus: [],
|
|
33
|
+
journey: [],
|
|
34
|
+
capture: ["webVitalsLoader"]
|
|
35
|
+
}, rt = {
|
|
36
|
+
endpoint: "",
|
|
37
|
+
serviceName: "",
|
|
38
|
+
serviceVersion: "",
|
|
39
|
+
environment: "",
|
|
40
|
+
enabled: !0,
|
|
41
|
+
minLevel: "INFO",
|
|
42
|
+
compression: "gzip",
|
|
43
|
+
credentials: "omit",
|
|
44
|
+
storage: "auto",
|
|
45
|
+
identity: "storage",
|
|
46
|
+
sampling: {
|
|
47
|
+
defaultRate: 1,
|
|
48
|
+
rates: {},
|
|
49
|
+
alwaysSampleTypes: ["action"],
|
|
50
|
+
remote: !1,
|
|
51
|
+
remoteMaxRate: 1
|
|
52
|
+
},
|
|
53
|
+
bus: {
|
|
54
|
+
mode: "auto",
|
|
55
|
+
trustedOrigins: [],
|
|
56
|
+
openFinRole: "auto"
|
|
57
|
+
},
|
|
58
|
+
journey: { scope: "auto" },
|
|
59
|
+
capture: {
|
|
60
|
+
errors: !0,
|
|
61
|
+
rejections: !0,
|
|
62
|
+
resourceErrors: !1,
|
|
63
|
+
fetch: !1,
|
|
64
|
+
xhr: !1,
|
|
65
|
+
interactions: !1,
|
|
66
|
+
navigation: !1,
|
|
67
|
+
webVitals: !1,
|
|
68
|
+
longFrames: !1,
|
|
69
|
+
longFrameThresholdMs: 100,
|
|
70
|
+
console: !1,
|
|
71
|
+
fullUrls: !1,
|
|
72
|
+
ignoreUrls: [],
|
|
73
|
+
propagateTraceHeaderTo: []
|
|
74
|
+
},
|
|
75
|
+
console: {
|
|
76
|
+
level: null,
|
|
77
|
+
styles: $
|
|
78
|
+
}
|
|
79
|
+
}, it = "DEBUG", at = 2e3, ot = 1e4, st = 15e3, ct = 1024, lt = "UiObservability", ut = {
|
|
80
|
+
maxBatches: 500,
|
|
81
|
+
maxAgeMs: 864e5,
|
|
82
|
+
maxAttempts: 5
|
|
83
|
+
}, dt = 1e4, ft = 2e3, pt = 6e4, mt = 3e4, ht = 18e5, gt = "__uiobs_journey", _t = "ui_observability_control", vt = 1500, yt = 5e3, bt = {
|
|
84
|
+
maxBodyChars: 4096,
|
|
85
|
+
maxAttributeChars: 8192,
|
|
86
|
+
maxAttributeCount: 128,
|
|
87
|
+
maxStackChars: 8192,
|
|
88
|
+
maxDepth: 6,
|
|
89
|
+
maxArrayLength: 100,
|
|
90
|
+
maxNodes: 1e4,
|
|
91
|
+
maxRecordBytes: 32768
|
|
92
|
+
};
|
|
93
|
+
//#endregion
|
|
94
|
+
export { d as $, n as $t, K as A, st as At, me as B, I as Bt, vt as C, de as Ct, tt as D, Ze as Dt, ct as E, bt as Et, te as F, B as Ft, Fe as G, mt as Gt, yt as H, j as Ht, Se as I, z as It, ie as J, Ve as Jt, Ke as K, pt as Kt, Ge as L, O as Lt, ue as M, L as Mt, rt as N, A as Nt, it as O, Qe as Ot, Ye as P, P as Pt, oe as Q, e as Qt, G as R, k as Rt, _t as S, r as St, qe as T, ge as Tt, We as U, M as Ut, se as V, N as Vt, Pe as W, ft as Wt, X, W as Xt, Z as Y, l as Yt, re as Z, t as Zt, ke as _, et as _n, s as _t, T as a, ye as an, we as at, pe as b, f as bn, Ee as bt, x as c, xe as cn, m as ct, h as d, U as dn, He as dt, p as en, u as et, v as f, V as fn, at as ft, je as g, Ie as gn, ce as gt, Ae as h, Me as hn, ot as ht, E as i, Je as in, ht as it, q as j, R as jt, $ as k, $e as kt, S as l, he as ln, Ue as lt, y as m, Ne as mn, o as mt, _ as n, dt as nn, _e as nt, w as o, Q as on, gt as ot, C as p, H as pn, Re as pt, ae as q, Be as qt, D as r, ut as rn, a as rt, b as s, be as sn, Le as st, i as t, lt as tn, ve as tt, g as u, ne as un, ee as ut, De as v, nt as vn, Y as vt, ze as w, fe as wt, le as x, c as xn, Te as xt, Oe as y, Xe as yn, J as yt, Ce as z, F as zt };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=constants-DM94FjVX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-DM94FjVX.js","names":["LIBRARY_LOG_PREFIX","DIAGNOSTIC_THROTTLE_MS","SESSION_ID_KEY","TAB_ID_KEY","SESSION_IDLE_MS","SESSION_TOUCH_MS","OPENFIN_UA_PATTERN","ANDROID_WEBVIEW_UA_PATTERN","IOS_DEVICE_UA_PATTERN","MACINTOSH_UA_PATTERN","MOBILE_UA_PATTERN","WEBKIT_UA_TOKEN","SAFARI_UA_TOKEN","HIGH_SURROGATE_MIN","HIGH_SURROGATE_MAX","UTF8_TWO_BYTE_CEILING","SEVERITY_NUMBER","LEVEL_ORDER","ATTR_LOG_TYPE","ATTR_LOG_SEQ","ATTR_APP_NAMESPACE","ATTR_PAGE_URL","ATTR_URL_FULL","ATTR_JOURNEY_ID","ATTR_JOURNEY_NAME","ATTR_JOURNEY_PARENT_ID","ATTR_SANITIZE_FAILED","ATTR_ERROR_DATA","ATTR_BREADCRUMBS","ATTR_ATTRIBUTES_DROPPED","ATTR_ATTRIBUTES_BYTES","RESOURCE_SERVICE_NAME","RESOURCE_SERVICE_VERSION","RESOURCE_DEPLOYMENT_ENVIRONMENT","RESOURCE_TELEMETRY_SDK_NAME","RESOURCE_TELEMETRY_SDK_VERSION","RESOURCE_TELEMETRY_SDK_LANGUAGE","RESOURCE_HOST_PLATFORM","RESOURCE_SESSION_ID","RESOURCE_TAB_ID","RESOURCE_CONTEXT_ID","RESOURCE_BROWSER_USER_AGENT","RESOURCE_OPENFIN_UUID","RESOURCE_OPENFIN_NAME","TELEMETRY_SDK_NAME","TELEMETRY_SDK_VERSION","TELEMETRY_SDK_LANGUAGE","SERIALIZER_NAME_OTLP","ECS_LEVEL_NAMES","CONTENT_TYPE_JSON","CONTENT_TYPE_NDJSON","NANOS_PER_MILLI","NANOS_PATTERN","HEADER_CONTENT_TYPE","HEADER_CONTENT_ENCODING","HEADER_RETRY_AFTER","HEADER_BATCH_ID","HEADER_ATTEMPT","HEADER_SAMPLING","ENCODING_GZIP","MILLIS_PER_SECOND","BEACON_LIMIT_BYTES","CONTENT_TYPE_TEXT_PLAIN","QUERY_PARAM_BATCH_ID","QUERY_PARAM_EXIT_REASON","BATCH_STORAGE_KEY_PREFIX","EMERGENCY_STORAGE_KEY_PREFIX","STORAGE_PROBE_KEY","QUOTA_EXCEEDED_ERROR","INDEXEDDB_STORE_NAME","INDEXEDDB_CREATED_AT_INDEX","STORAGE_NAME_INDEXEDDB","STORAGE_NAME_LOCAL","STORAGE_NAME_MEMORY","STORAGE_NAME_NONE","DRAIN_LOCK_NAME","EMERGENCY_LOCK_NAME","JOURNEY_STORAGE_KEY","OPENFIN_OPTIONS_TIMEOUT_MS","OPENFIN_JOURNEY_CUSTOM_DATA_KEY","BASE64_PLUS_PATTERN","BASE64_SLASH_PATTERN","BASE64_PADDING_PATTERN","BASE64URL_DASH_PATTERN","BASE64URL_UNDERSCORE_PATTERN","TRACE_MAX_AGE_MS","TRACEPARENT_HEADER","FNV_OFFSET_BASIS","FNV_PRIME","UINT32_MAX","LEVEL_BYPASS_TYPES","LOG_TYPE_METRIC","BUS_PROTOCOL","RUNTIME_GLOBAL_KEY","RUNTIME_STOPPED_KEY","LIBRARY_REQUEST_KEY","LIBRARY_CONSOLE_KEY","ERROR_STORM_WINDOW_MS","CONSOLE_DEFAULT_STYLES","DURATION_PRECISION","GAP_REPORT_THROTTLE_MS","CAPTURE_NAMESPACE","STORAGE_NAMESPACE","DEFAULT_METRIC_UNIT","UNKNOWN_SERVICE_NAME","REMOTE_SAMPLING_MAX_CHARS","REMOTE_SAMPLING_MAX_TTL_MS","REMOTE_SAMPLING_POLL_MS","UNDEFAULTED_CONFIG_KEYS","CONFIG_SECTIONS","UNDEFAULTED_SECTION_KEYS","DEFAULT_CONFIG","CONSOLE_DEFAULT_LEVEL","LOG_FLUSH_INTERVAL_MS","METRIC_FLUSH_INTERVAL_MS","REQUEST_TIMEOUT_MS","COMPRESSION_THRESHOLD_BYTES","STORAGE_DB_NAME","STORAGE_LIMITS","STORAGE_DEADLINE_MS","RETRY_BASE_DELAY_MS","RETRY_MAX_DELAY_MS","RETRY_IDLE_DELAY_MS","JOURNEY_MAX_AGE_MS","JOURNEY_URL_PARAM","BUS_CHANNEL_NAME","BUS_HANDSHAKE_TIMEOUT_MS","ERROR_DEDUPE_MS","RECORD_LIMITS"],"sources":["../src/constants.ts"],"sourcesContent":["// src/constants.ts\n//\n// Defines all limits, thresholds, timing windows, storage keys, patterns, and\n// defaults that the library uses.\n\nimport type { ConsoleStyles, ResolvedConfig } from \"./models/config\";\nimport type { LogLevel, LogType } from \"./models/log-record\";\nimport type { StorageLimits } from \"./models/storage\";\n\n// ----------------------------------\n// Library-wide\n// ----------------------------------\n\n/** Prefix on console messages this library writes. */\nexport const LIBRARY_LOG_PREFIX = \"[ui-observability]\";\n\n// ----------------------------------\n// Diagnostics\n// ----------------------------------\n\n/**\n * Throttle window for each diagnostic code, in milliseconds. It limits how often an error\n * loop calls the handler.\n */\nexport const DIAGNOSTIC_THROTTLE_MS = 1000;\n\n// ----------------------------------\n// Identity\n// ----------------------------------\n\n/** `localStorage` key for the session id and its last-seen time. */\nexport const SESSION_ID_KEY = \"ui-observability.session\";\n\n/** `sessionStorage` key for the tab id. */\nexport const TAB_ID_KEY = \"ui-observability.tab\";\n\n/** Session idle timeout, in milliseconds. */\nexport const SESSION_IDLE_MS = 30 * 60 * 1000;\n\n/** Min gap between session last-seen writes, in milliseconds. */\nexport const SESSION_TOUCH_MS = 60_000;\n\n/** Random id length, in bytes, used when `crypto.randomUUID` is unavailable. */\nexport const ID_BYTE_LENGTH = 16;\n\n/** Distinct values in one byte (256). */\nexport const BYTE_VALUE_COUNT = 256;\n\n// ----------------------------------\n// Platform detection\n// ----------------------------------\n\n/** Matches OpenFin's user agent. */\nexport const OPENFIN_UA_PATTERN = /OpenFin/i;\n\n/** Matches Android's webview token (`wv`). */\nexport const ANDROID_WEBVIEW_UA_PATTERN = /\\bwv\\b/;\n\n/** Matches iOS hardware: iPhone, iPad, iPod. */\nexport const IOS_DEVICE_UA_PATTERN = /\\b(iPhone|iPad|iPod)\\b/;\n\n/** Matches desktop macOS in a user agent. */\nexport const MACINTOSH_UA_PATTERN = /\\bMacintosh\\b/;\n\n/** Matches the mobile token. */\nexport const MOBILE_UA_PATTERN = /\\bMobile\\b/;\n\n/** WebKit engine token, present in every WebKit browser including webviews. */\nexport const WEBKIT_UA_TOKEN = \"AppleWebKit\";\n\n/** Safari token sent by real iOS browsers, not in-app webviews. */\nexport const SAFARI_UA_TOKEN = \"Safari/\";\n\n// ----------------------------------\n// Sanitizing and size estimation\n// ----------------------------------\n\n/** First UTF-16 high surrogate code unit. */\nexport const HIGH_SURROGATE_MIN = 0xd800;\n\n/** Last UTF-16 high surrogate code unit. */\nexport const HIGH_SURROGATE_MAX = 0xdbff;\n\n/** Code units below this encode as one UTF-8 byte. */\nexport const UTF8_ONE_BYTE_CEILING = 0x80;\n\n/** Code units below this, and at or above the one-byte ceiling, encode as two UTF-8 bytes. */\nexport const UTF8_TWO_BYTE_CEILING = 0x800;\n\n/** Class names kept in a `describeNode` selector. */\nexport const MAX_NODE_CLASS_NAMES = 3;\n\n/** Byte cost of a null or undefined value. */\nexport const BYTES_PER_NULL = 4;\n\n/** Byte cost of a number (flat estimate). */\nexport const BYTES_PER_NUMBER = 8;\n\n/** Byte cost of a boolean. */\nexport const BYTES_PER_BOOLEAN = 5;\n\n/** Byte cost of an object or array's wrapping braces or brackets. */\nexport const BYTES_PER_CONTAINER = 2;\n\n/** Byte cost of a string's wrapping quotes. */\nexport const BYTES_PER_QUOTED_STRING = 2;\n\n/** Byte cost of one key's punctuation: quotes, colon, comma. */\nexport const BYTES_PER_KEY_OVERHEAD = 4;\n\n// ----------------------------------\n// Record model\n// ----------------------------------\n\n/**\n * Maps each log level to its OpenTelemetry severity number.\n * @see {@link LEVEL_ORDER}\n */\nexport const SEVERITY_NUMBER: Record<LogLevel, number> = {\n TRACE: 1,\n DEBUG: 5,\n INFO: 9,\n WARN: 13,\n ERROR: 17,\n FATAL: 21,\n};\n\n/**\n * Alias for `SEVERITY_NUMBER`, used by the level filter.\n * @see {@link SEVERITY_NUMBER}\n */\nexport const LEVEL_ORDER: Record<LogLevel, number> = SEVERITY_NUMBER;\n\n// ----------------------------------\n// Attribute and resource keys\n// ----------------------------------\n//\n// Attribute and resource key names that records carry in the payload. The names\n// follow OpenTelemetry conventions. The `uiobs.` prefix marks the fields of this library.\n\n/** Record kind attribute key. */\nexport const ATTR_LOG_TYPE = \"log.type\";\n\n/** Record sequence number in its context. It starts at 1. */\nexport const ATTR_LOG_SEQ = \"log.seq\";\n\n/** Logger namespace attribute key. */\nexport const ATTR_APP_NAMESPACE = \"app.namespace\";\n\n/** Document URL when the library built the record. */\nexport const ATTR_PAGE_URL = \"page.url\";\n\n/**\n * HTTP request URL attribute key. Network capture sets it. Do not reuse `ATTR_PAGE_URL`.\n * The page URL overwrites the request target under that key.\n * @see {@link ATTR_PAGE_URL}\n */\nexport const ATTR_URL_FULL = \"url.full\";\n\n/** Journey id attribute key. */\nexport const ATTR_JOURNEY_ID = \"journey.id\";\n\n/** Journey name attribute key. */\nexport const ATTR_JOURNEY_NAME = \"journey.name\";\n\n/** Parent journey id, present only on a child journey. */\nexport const ATTR_JOURNEY_PARENT_ID = \"journey.parent_id\";\n\n/** Marks a record whose attributes failed to sanitize. */\nexport const ATTR_SANITIZE_FAILED = \"uiobs.sanitize_failed\";\n\n/** Own fields of an Error reason, or the whole reason when it is not an Error. */\nexport const ATTR_ERROR_DATA = \"error.data\";\n\n/** Breadcrumb history of an error record. */\nexport const ATTR_BREADCRUMBS = \"breadcrumbs\";\n\n/**\n * Marks a record when the library drops its attributes because they exceed the byte budget.\n * @see {@link ATTR_ATTRIBUTES_BYTES}\n */\nexport const ATTR_ATTRIBUTES_DROPPED = \"uiobs.attributes_dropped\";\n\n/**\n * Byte size of the dropped attributes.\n * @see {@link ATTR_ATTRIBUTES_DROPPED}\n */\nexport const ATTR_ATTRIBUTES_BYTES = \"uiobs.attributes_bytes\";\n\n/** Application name resource key. */\nexport const RESOURCE_SERVICE_NAME = \"service.name\";\n\n/** Application build version resource key. */\nexport const RESOURCE_SERVICE_VERSION = \"service.version\";\n\n/** Deployment environment resource key. */\nexport const RESOURCE_DEPLOYMENT_ENVIRONMENT = \"deployment.environment\";\n\n/**\n * Producer library name resource key.\n * @see {@link TELEMETRY_SDK_NAME}\n */\nexport const RESOURCE_TELEMETRY_SDK_NAME = \"telemetry.sdk.name\";\n\n/**\n * Producer library version resource key.\n * @see {@link TELEMETRY_SDK_VERSION}\n */\nexport const RESOURCE_TELEMETRY_SDK_VERSION = \"telemetry.sdk.version\";\n\n/**\n * Producer SDK language resource key.\n * @see {@link TELEMETRY_SDK_LANGUAGE}\n */\nexport const RESOURCE_TELEMETRY_SDK_LANGUAGE = \"telemetry.sdk.language\";\n\n/** Host platform resource key: browser, webview, or OpenFin. */\nexport const RESOURCE_HOST_PLATFORM = \"host.platform\";\n\n/** Session id resource key. */\nexport const RESOURCE_SESSION_ID = \"session.id\";\n\n/** Tab id resource key. */\nexport const RESOURCE_TAB_ID = \"tab.id\";\n\n/** Context (realm) id resource key. */\nexport const RESOURCE_CONTEXT_ID = \"context.id\";\n\n/** Raw user agent resource key. */\nexport const RESOURCE_BROWSER_USER_AGENT = \"browser.user_agent\";\n\n/** OpenFin application uuid resource key. */\nexport const RESOURCE_OPENFIN_UUID = \"openfin.uuid\";\n\n/** OpenFin window or view name resource key. */\nexport const RESOURCE_OPENFIN_NAME = \"openfin.name\";\n\n/**\n * Value of `telemetry.sdk.name`.\n * @see {@link RESOURCE_TELEMETRY_SDK_NAME}\n */\nexport const TELEMETRY_SDK_NAME = \"@utk09/ui-observability\";\n\n/**\n * Value of `telemetry.sdk.version`. The code does not read it from package.json.\n * Change it by hand when you change the version in package.json.\n * @see {@link RESOURCE_TELEMETRY_SDK_VERSION}\n */\nexport const TELEMETRY_SDK_VERSION = \"0.9.0\";\n\n/**\n * Value of `telemetry.sdk.language`.\n * @see {@link RESOURCE_TELEMETRY_SDK_LANGUAGE}\n */\nexport const TELEMETRY_SDK_LANGUAGE = \"webjs\";\n\n// ----------------------------------\n// Serializers\n// ----------------------------------\n\n/** OTLP/JSON serializer name. */\nexport const SERIALIZER_NAME_OTLP = \"otlp\";\n\n/** ECS serializer name. */\nexport const SERIALIZER_NAME_ECS = \"ecs\";\n\n/**\n * ECS `log.level` names that differ from the lowercase severity text. ECS spells\n * the warning level in full. All other levels match in lowercase.\n * @see {@link SERIALIZER_NAME_ECS}\n */\nexport const ECS_LEVEL_NAMES: Partial<Record<LogLevel, string>> = { WARN: \"warning\" };\n\n/** Content type for an OTLP/JSON body. */\nexport const CONTENT_TYPE_JSON = \"application/json\";\n\n/** Content type for newline-delimited JSON. */\nexport const CONTENT_TYPE_NDJSON = \"application/x-ndjson\";\n\n/** Nanoseconds per millisecond. */\nexport const NANOS_PER_MILLI = 1000000n;\n\n/**\n * Matches a nanosecond epoch in decimal digits, for example \"1755543600123000000\".\n * @see {@link NANOS_PER_MILLI}\n */\nexport const NANOS_PATTERN = /^\\d+$/;\n\n// ----------------------------------\n// HTTP transport\n// ----------------------------------\n\n/** Content-Type header name. */\nexport const HEADER_CONTENT_TYPE = \"Content-Type\";\n\n/** Content-Encoding header name. */\nexport const HEADER_CONTENT_ENCODING = \"Content-Encoding\";\n\n/** Retry-After header name. */\nexport const HEADER_RETRY_AFTER = \"Retry-After\";\n\n/**\n * Batch deduplication key header name.\n * @see {@link QUERY_PARAM_BATCH_ID}\n */\nexport const HEADER_BATCH_ID = \"X-UiObs-Batch-Id\";\n\n/** Delivery attempt number header name. */\nexport const HEADER_ATTEMPT = \"X-UiObs-Attempt\";\n\n/** Response header that carries sampling rules from the ingest server. */\nexport const HEADER_SAMPLING = \"X-UiObs-Sampling\";\n\n/** Gzip encoding name. */\nexport const ENCODING_GZIP = \"gzip\";\n\n/** Lowest valid HTTP status code. */\nexport const HTTP_STATUS_MIN = 100;\n\n/** Highest valid HTTP status code. */\nexport const HTTP_STATUS_MAX = 599;\n\n/** Lowest HTTP status code that accepts a batch. */\nexport const HTTP_SUCCESS_MIN = 200;\n\n/** Lowest HTTP status code above the success range. */\nexport const HTTP_SUCCESS_END = 300;\n\n/** 401, credentials missing or rejected. */\nexport const HTTP_UNAUTHORIZED = 401;\n\n/** 403, valid credentials but access denied. */\nexport const HTTP_FORBIDDEN = 403;\n\n/** 408, the server closed the connection after a timeout. The transport can retry. */\nexport const HTTP_REQUEST_TIMEOUT = 408;\n\n/** 413, payload too large. The transport must split the batch. */\nexport const HTTP_PAYLOAD_TOO_LARGE = 413;\n\n/** 429, backpressure. */\nexport const HTTP_TOO_MANY_REQUESTS = 429;\n\n/** 500, floor for server-side errors. */\nexport const HTTP_SERVER_ERROR_MIN = 500;\n\n/** 503, temporary unavailability. */\nexport const HTTP_SERVICE_UNAVAILABLE = 503;\n\n/** Milliseconds per second. */\nexport const MILLIS_PER_SECOND = 1000;\n\n// ----------------------------------\n// Exit flush\n// ----------------------------------\n\n/** Max exit payload size, in bytes (`sendBeacon`/`fetch(keepalive)` shared budget). */\nexport const BEACON_LIMIT_BYTES = 60_000;\n\n/** Content type for an exit payload. It is CORS-safelisted and does not cause a preflight. */\nexport const CONTENT_TYPE_TEXT_PLAIN = \"text/plain;charset=UTF-8\";\n\n/**\n * Batch id query param name, for the exit path.\n * @see {@link HEADER_BATCH_ID}\n */\nexport const QUERY_PARAM_BATCH_ID = \"uiobs_batch_id\";\n\n/** Exit reason query param name, for logs only. */\nexport const QUERY_PARAM_EXIT_REASON = \"uiobs_exit\";\n\n// ----------------------------------\n// Storage\n// ----------------------------------\n\n/** localStorage key prefix for a stored batch. */\nexport const BATCH_STORAGE_KEY_PREFIX = \"ui-observability.batch.\";\n\n/** Zero-padded digit width for the creation time in a batch key. */\nexport const BATCH_KEY_TIME_WIDTH = 14;\n\n/** localStorage key prefix for a batch that exit flush stores. */\nexport const EMERGENCY_STORAGE_KEY_PREFIX = \"ui-observability.emergency.\";\n\n/** Maximum number of exit batches in the emergency queue. */\nexport const EMERGENCY_MAX_ENTRIES = 20;\n\n/** Key that the library writes to test if localStorage accepts writes. */\nexport const STORAGE_PROBE_KEY = \"ui-observability.probe\";\n\n/** Fraction of the store to evict on a quota error (1 in N). */\nexport const QUOTA_EVICTION_DIVISOR = 4;\n\n/** DOMException name for a full store. */\nexport const QUOTA_EXCEEDED_ERROR = \"QuotaExceededError\";\n\n/**\n * Native IndexedDB version. It starts at 11. Dexie, the previous adapter, opened the\n * same database at ten times its declared version. A version below 11 makes open()\n * fail with VersionError for an existing installation. Then no code can read the\n * batches in that database.\n */\nexport const INDEXEDDB_SCHEMA_VERSION = 11;\n\n/** IndexedDB object store that holds batches. Dexie set this name before the library removed it. */\nexport const INDEXEDDB_STORE_NAME = \"batches\";\n\n/** Index on the batch store that orders reads by creation time. */\nexport const INDEXEDDB_CREATED_AT_INDEX = \"createdAt\";\n\n/** IndexedDB adapter/strategy name. */\nexport const STORAGE_NAME_INDEXEDDB = \"indexeddb\";\n\n/** localStorage adapter/strategy name. */\nexport const STORAGE_NAME_LOCAL = \"localstorage\";\n\n/** In-memory adapter/strategy name. */\nexport const STORAGE_NAME_MEMORY = \"memory\";\n\n/** Name of the storage adapter that keeps nothing. */\nexport const STORAGE_NAME_NONE = \"none\";\n\n// ----------------------------------\n// Retry\n// ----------------------------------\n\n/**\n * Origin-wide lock name a drain runs under.\n * @see {@link EMERGENCY_LOCK_NAME}\n */\nexport const DRAIN_LOCK_NAME = \"ui-observability.drain\";\n\n/**\n * Lock name startup recovery runs under.\n * @see {@link DRAIN_LOCK_NAME}\n */\nexport const EMERGENCY_LOCK_NAME = \"ui-observability.emergency\";\n\n/** Batches sent per drain tick. */\nexport const BATCHES_PER_DRAIN = 20;\n\n// ----------------------------------\n// Journey\n// ----------------------------------\n\n/** `sessionStorage` key for the current journey. */\nexport const JOURNEY_STORAGE_KEY = \"ui-observability.journey\";\n\n/**\n * Max journey name length in a token, in characters.\n * @see {@link JOURNEY_TOKEN_MAX_CHARS}\n */\nexport const JOURNEY_TOKEN_NAME_MAX_CHARS = 64;\n\n/**\n * Max whole-token length, in characters. It rejects an oversized token. It does not\n * validate the token content.\n * @see {@link JOURNEY_TOKEN_NAME_MAX_CHARS}\n */\nexport const JOURNEY_TOKEN_MAX_CHARS = 256;\n\n/**\n * Time to wait for `fin.me.getOptions()`, in milliseconds. After this time, the\n * runtime continues without a seeded journey.\n * @see {@link OPENFIN_JOURNEY_CUSTOM_DATA_KEY}\n */\nexport const OPENFIN_OPTIONS_TIMEOUT_MS = 2000;\n\n/** Key under an OpenFin window's `customData` carrying a seeded journey token. */\nexport const OPENFIN_JOURNEY_CUSTOM_DATA_KEY = \"uiObsJourney\";\n\n/** Matches `+` in standard base64 (`-` in URL-safe). */\nexport const BASE64_PLUS_PATTERN = /\\+/g;\n\n/** Matches `/` in standard base64 (`_` in URL-safe). */\nexport const BASE64_SLASH_PATTERN = /\\//g;\n\n/** Matches trailing `=` padding. */\nexport const BASE64_PADDING_PATTERN = /=+$/;\n\n/** Matches `-` in URL-safe base64 (`+` in standard). */\nexport const BASE64URL_DASH_PATTERN = /-/g;\n\n/** Matches `_` in URL-safe base64 (`/` in standard). */\nexport const BASE64URL_UNDERSCORE_PATTERN = /_/g;\n\n/** Base64 characters per 3-byte group. */\nexport const BASE64_GROUP_CHARS = 4;\n\n// ----------------------------------\n// Tracing\n// ----------------------------------\n\n/** W3C trace id width, in bytes. */\nexport const TRACE_ID_BYTES = 16;\n\n/** W3C span id width, in bytes. */\nexport const SPAN_ID_BYTES = 8;\n\n/** Max ambient trace lifetime with no activity, in milliseconds. */\nexport const TRACE_MAX_AGE_MS = 5 * 60 * 1000;\n\n/** trace-flags value with the sampled bit set. */\nexport const TRACE_FLAGS_SAMPLED = 1;\n\n/** Mask for the one-byte trace-flags field. */\nexport const TRACE_FLAGS_MASK = 0xff;\n\n/**\n * W3C trace context header name\n * @see {@link TRACEPARENT_VERSION}\n */\nexport const TRACEPARENT_HEADER = \"traceparent\";\n\n/** traceparent header version prefix. */\nexport const TRACEPARENT_VERSION = \"00\";\n\n// ----------------------------------\n// Breadcrumbs\n// ----------------------------------\n\n/** Smallest valid breadcrumb buffer capacity. */\nexport const BREADCRUMB_MIN_CAPACITY = 1;\n\n// ----------------------------------\n// Sampling\n// ----------------------------------\n//\n// FNV-1a hash constants. The sampler uses them to change a sampling key into a\n// stable 0-1 fraction.\n\n/** FNV-1a 32-bit offset basis. */\nexport const FNV_OFFSET_BASIS = 0x811c9dc5;\n\n/** FNV-1a 32-bit prime. */\nexport const FNV_PRIME = 0x01000193;\n\n/** Largest 32-bit unsigned value. */\nexport const UINT32_MAX = 0xffffffff;\n\n/**\n * Types that minLevel does not drop. An action is an audit fact and a metric is a measurement.\n * The remote rate cap for records below minLevel does not apply to them.\n */\nexport const LEVEL_BYPASS_TYPES: readonly LogType[] = [\"action\", \"metric\"];\n\n// ----------------------------------\n// Pipeline\n// ----------------------------------\n\n/** Record kind routed to the metric stream. */\nexport const LOG_TYPE_METRIC: LogType = \"metric\";\n\n// ----------------------------------\n// Bus\n// ----------------------------------\n\n/** Protocol identifier for bus envelopes. The bus drops an envelope with a different version. */\nexport const BUS_PROTOCOL = \"ui-observability/1\";\n\n/** Global window property key used to locate a same-origin runtime instance. */\nexport const RUNTIME_GLOBAL_KEY = \"ui-observability.runtime\";\n\n/** Global key of the runtime that shutdown() stopped. Calls go to it until the next configure(). */\nexport const RUNTIME_STOPPED_KEY = \"ui-observability.stopped\";\n\n/** Global symbol key of the library request scope count. All library copies on a page share it. */\nexport const LIBRARY_REQUEST_KEY = \"ui-observability.request-scope\";\n\n/** Global symbol key of the library console scope count. All library copies on a page share it. */\nexport const LIBRARY_CONSOLE_KEY = \"ui-observability.console-scope\";\n\n// ----------------------------------\n// Capture\n// ----------------------------------\n\n/** Maximum error records captured per throttling window before suppression. */\nexport const ERROR_STORM_MAX_PER_WINDOW = 20;\n\n/** Error rate-limiting window duration in milliseconds. */\nexport const ERROR_STORM_WINDOW_MS = 10_000;\n\n/**\n * Max ERROR and FATAL records that the pipeline admits in each storm window.\n * It is a safety limit for a render loop. It does not shape normal traffic.\n * ERROR and FATAL records skip sampling. A direct logger.error call has no other limit.\n */\nexport const ERROR_CEILING_MAX_PER_WINDOW = 500;\n\n/** Default minimum duration of a long frame that the library records, in milliseconds. */\nexport const LONG_FRAME_THRESHOLD_MS = 100;\n\n/** Maximum long frames recorded in each storm window. A frozen tab cannot flood the pipeline. */\nexport const LONG_FRAME_MAX_PER_WINDOW = 20;\n\n/** Maximum character length of a console breadcrumb message. */\nexport const CONSOLE_BREADCRUMB_MAX_CHARS = 200;\n\n/** Maximum distinct error signatures tracked for deduplication before LRU eviction. */\nexport const MAX_TRACKED_ERROR_SIGNATURES = 200;\n\n/** Maximum character length retained from clicked element text in breadcrumbs. */\nexport const CLICK_TEXT_MAX_CHARS = 50;\n\n/** Maximum character length retained from an aria-label attribute in generated selectors. */\nexport const ARIA_LABEL_MAX_CHARS = 40;\n\n/** Maximum class names included per element in generated CSS selectors. */\nexport const SELECTOR_MAX_CLASSES = 2;\n\n/** Default CSS of the console prefix. The colors are readable on light and dark devtools. */\nexport const CONSOLE_DEFAULT_STYLES: Readonly<Required<ConsoleStyles>> = {\n namespace: \"color:#888\",\n TRACE: \"color:#888;font-weight:bold\",\n DEBUG: \"color:#888;font-weight:bold\",\n INFO: \"color:#1e6fd9;font-weight:bold\",\n WARN: \"color:#c77700;font-weight:bold\",\n ERROR: \"color:#d32f2f;font-weight:bold\",\n FATAL: \"color:#d32f2f;font-weight:bold\",\n};\n\n/** Scaling factor for rounding duration measurements to three decimal places. */\nexport const DURATION_PRECISION = 1000;\n\n// ----------------------------------\n// Runtime\n// ----------------------------------\n\n/** Minimum duration in milliseconds between storage gap warning reports. */\nexport const GAP_REPORT_THROTTLE_MS = 60_000;\n\n/** Default namespace for telemetry records emitted by auto-capture modules. */\nexport const CAPTURE_NAMESPACE = \"uiobs.capture\";\n\n/** Default namespace for telemetry records emitted by storage subsystems. */\nexport const STORAGE_NAMESPACE = \"uiobs.storage\";\n\n/** Measurement unit that the library uses when the call gives no unit. */\nexport const DEFAULT_METRIC_UNIT = \"count\";\n\n// ----------------------------------\n// Configuration\n// ----------------------------------\n\n/** Default `service.name` when a consumer sets none. */\nexport const UNKNOWN_SERVICE_NAME = \"unknown-service\";\n\n/** Lowest sampling rate (drop everything). */\nexport const SAMPLING_RATE_MIN = 0;\n\n/** Highest sampling rate (keep everything). */\nexport const SAMPLING_RATE_MAX = 1;\n\n/**\n * Fallback for an invalid sampling rate (keep everything).\n * @see {@link SAMPLING_RATE_MAX}\n */\nexport const SAMPLING_RATE_FALLBACK = 1;\n\n/** Version of the remote sampling rules that the library accepts. */\nexport const REMOTE_SAMPLING_VERSION = 1;\n\n/** Maximum length of the sampling header, in characters. */\nexport const REMOTE_SAMPLING_MAX_CHARS = 4096;\n\n/** Maximum time that remote sampling rules stay in force, in milliseconds. */\nexport const REMOTE_SAMPLING_MAX_TTL_MS = 60 * 60 * 1000;\n\n/** Maximum namespace rates in one set of remote sampling rules. */\nexport const REMOTE_SAMPLING_MAX_RATES = 100;\n\n/** Time between two requests of a forwarder for the remote sampling rules, in milliseconds. */\nexport const REMOTE_SAMPLING_POLL_MS = 30_000;\n\n/**\n * Config keys with no default, excluded from `DEFAULT_CONFIG`.\n * @see {@link DEFAULT_CONFIG}\n */\nexport const UNDEFAULTED_CONFIG_KEYS = [\n \"redact\",\n \"onDiagnostic\",\n \"headers\",\n \"serializer\",\n \"otelLoader\",\n \"transport\",\n \"transportOnExit\",\n] as const;\n\n/**\n * Nested config section keys.\n * @see {@link ResolvedConfig}\n */\nexport const CONFIG_SECTIONS = [\"sampling\", \"bus\", \"journey\", \"capture\"] as const;\n\n/**\n * Section keys with no default, excluded from their section of `DEFAULT_CONFIG`.\n * @see {@link UNDEFAULTED_CONFIG_KEYS}\n */\nexport const UNDEFAULTED_SECTION_KEYS: Record<(typeof CONFIG_SECTIONS)[number], string[]> = {\n sampling: [],\n bus: [],\n journey: [],\n capture: [\"webVitalsLoader\"],\n};\n\n/**\n * Default runtime config before the consumer calls `configure()`. It excludes `serializer`.\n * `resolveConfig` supplies that default to prevent a circular import.\n * @see {@link ResolvedConfig}\n * @see {@link UNDEFAULTED_CONFIG_KEYS}\n */\nexport const DEFAULT_CONFIG: Omit<ResolvedConfig, \"serializer\"> = {\n endpoint: \"\",\n serviceName: \"\",\n serviceVersion: \"\",\n environment: \"\",\n enabled: true,\n minLevel: \"INFO\",\n compression: \"gzip\",\n credentials: \"omit\",\n storage: \"auto\",\n identity: \"storage\",\n sampling: {\n defaultRate: 1,\n rates: {},\n alwaysSampleTypes: [\"action\"],\n remote: false,\n remoteMaxRate: 1,\n },\n bus: { mode: \"auto\", trustedOrigins: [], openFinRole: \"auto\" },\n journey: { scope: \"auto\" },\n capture: {\n errors: true,\n rejections: true,\n resourceErrors: false,\n fetch: false,\n xhr: false,\n interactions: false,\n navigation: false,\n webVitals: false,\n longFrames: false,\n longFrameThresholdMs: LONG_FRAME_THRESHOLD_MS,\n console: false,\n fullUrls: false,\n ignoreUrls: [],\n propagateTraceHeaderTo: [],\n },\n console: { level: null, styles: CONSOLE_DEFAULT_STYLES },\n};\n\n/** Console mirroring level used when a consumer passes `console: true`. */\nexport const CONSOLE_DEFAULT_LEVEL: LogLevel = \"DEBUG\";\n\n// ----------------------------------\n// Batching\n// ----------------------------------\n\n/** Max time a partial log batch waits before the pipeline sends it, in milliseconds. */\nexport const LOG_FLUSH_INTERVAL_MS = 2000;\n\n/** Max records per log batch. At this count, the pipeline sends the batch early. */\nexport const LOG_BATCH_SIZE = 100;\n\n/**\n * Max time a partial metric batch waits before the pipeline sends it, in milliseconds.\n * Metric batches wait longer than log batches. Metrics have a higher volume, and no\n * caller waits for them.\n */\nexport const METRIC_FLUSH_INTERVAL_MS = 10_000;\n\n/** Max records per metric batch. At this count, the pipeline sends the batch early. */\nexport const METRIC_BATCH_SIZE = 500;\n\n/** Max concurrent ingest requests, across both streams. */\nexport const MAX_CONCURRENT_REQUESTS = 2;\n\n// ----------------------------------\n// HTTP transport\n// ----------------------------------\n\n/** Max time for one ingest request, in milliseconds. Then the transport aborts and retries it. */\nexport const REQUEST_TIMEOUT_MS = 15_000;\n\n/** Min payload size to compress, in bytes. */\nexport const COMPRESSION_THRESHOLD_BYTES = 1024;\n\n// ----------------------------------\n// Storage retention\n// ----------------------------------\n\n/** IndexedDB database name. */\nexport const STORAGE_DB_NAME = \"UiObservability\";\n\n/** Capacity and retention thresholds every storage adapter enforces. */\nexport const STORAGE_LIMITS: StorageLimits = {\n maxBatches: 500,\n maxAgeMs: 24 * 60 * 60 * 1000,\n maxAttempts: 5,\n};\n\n/**\n * Max time for one storage call, in milliseconds. Then the library treats the call as failed.\n * A call that does not settle keeps a dispatch slot or the drain flag.\n */\nexport const STORAGE_DEADLINE_MS = 10_000;\n\n// ----------------------------------\n// Retry backoff\n// ----------------------------------\n\n/** First backoff step, in milliseconds. Each attempt doubles it. */\nexport const RETRY_BASE_DELAY_MS = 2000;\n\n/** Backoff ceiling, in milliseconds. */\nexport const RETRY_MAX_DELAY_MS = 60_000;\n\n/** How often to check for stored work when nothing has failed recently, in milliseconds. */\nexport const RETRY_IDLE_DELAY_MS = 30_000;\n\n// ----------------------------------\n// Journey lifetime\n// ----------------------------------\n\n/** Max time a journey stays open, in milliseconds. Then the library treats it as abandoned. */\nexport const JOURNEY_MAX_AGE_MS = 30 * 60 * 1000;\n\n/** True if the journey ends for all contexts when the owning context closes. */\nexport const JOURNEY_END_ON_OWNER_CLOSE = false;\n\n/** Query parameter checked at boot for a seeded journey token. */\nexport const JOURNEY_URL_PARAM = \"__uiobs_journey\";\n\n// ----------------------------------\n// Bus handshake\n// ----------------------------------\n\n/** BroadcastChannel name for the control plane. */\nexport const BUS_CHANNEL_NAME = \"ui_observability_control\";\n\n/** Max time a forwarder waits for an owner to answer before it promotes itself, in milliseconds. */\nexport const BUS_HANDSHAKE_TIMEOUT_MS = 1500;\n\n/** Handshake attempts allowed before a cross-origin forwarder promotes itself to sender. */\nexport const BUS_MAX_HANDSHAKE_ATTEMPTS = 3;\n\n/** Max records a context buffers before it knows its bus role. */\nexport const BUS_MAX_BOOT_BUFFER_RECORDS = 500;\n\n/** Max characters of an untrusted message type in a diagnostic detail. The sender sets the text. */\nexport const BUS_TYPE_DETAIL_MAX_CHARS = 32;\n\n// ----------------------------------\n// Capture\n// ----------------------------------\n\n/** Breadcrumbs kept as context for the next error. */\nexport const MAX_BREADCRUMBS = 50;\n\n/**\n * Time window in which the library counts identical errors but does not send them again,\n * in milliseconds.\n */\nexport const ERROR_DEDUPE_MS = 5000;\n\n// ----------------------------------\n// Per-record size caps\n// ----------------------------------\n\n/** Size caps for every record. The library applies them after sanitize and after redact. */\nexport const RECORD_LIMITS = {\n maxBodyChars: 4096,\n maxAttributeChars: 8192,\n maxAttributeCount: 128,\n maxStackChars: 8192,\n maxDepth: 6,\n maxArrayLength: 100,\n maxNodes: 10_000,\n maxRecordBytes: 32_768,\n};\n"],"mappings":"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"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -72,7 +72,7 @@ export declare const ATTR_LOG_TYPE = "log.type";
|
|
|
72
72
|
export declare const ATTR_LOG_SEQ = "log.seq";
|
|
73
73
|
/** Logger namespace attribute key. */
|
|
74
74
|
export declare const ATTR_APP_NAMESPACE = "app.namespace";
|
|
75
|
-
/** Document URL when the
|
|
75
|
+
/** Document URL when the library built the record. */
|
|
76
76
|
export declare const ATTR_PAGE_URL = "page.url";
|
|
77
77
|
/**
|
|
78
78
|
* HTTP request URL attribute key. Network capture sets it. Do not reuse `ATTR_PAGE_URL`.
|
|
@@ -88,6 +88,10 @@ export declare const ATTR_JOURNEY_NAME = "journey.name";
|
|
|
88
88
|
export declare const ATTR_JOURNEY_PARENT_ID = "journey.parent_id";
|
|
89
89
|
/** Marks a record whose attributes failed to sanitize. */
|
|
90
90
|
export declare const ATTR_SANITIZE_FAILED = "uiobs.sanitize_failed";
|
|
91
|
+
/** Own fields of an Error reason, or the whole reason when it is not an Error. */
|
|
92
|
+
export declare const ATTR_ERROR_DATA = "error.data";
|
|
93
|
+
/** Breadcrumb history of an error record. */
|
|
94
|
+
export declare const ATTR_BREADCRUMBS = "breadcrumbs";
|
|
91
95
|
/**
|
|
92
96
|
* Marks a record when the library drops its attributes because they exceed the byte budget.
|
|
93
97
|
* @see {@link ATTR_ATTRIBUTES_BYTES}
|
|
@@ -143,7 +147,7 @@ export declare const TELEMETRY_SDK_NAME = "@utk09/ui-observability";
|
|
|
143
147
|
* Change it by hand when you change the version in package.json.
|
|
144
148
|
* @see {@link RESOURCE_TELEMETRY_SDK_VERSION}
|
|
145
149
|
*/
|
|
146
|
-
export declare const TELEMETRY_SDK_VERSION = "0.
|
|
150
|
+
export declare const TELEMETRY_SDK_VERSION = "0.9.0";
|
|
147
151
|
/**
|
|
148
152
|
* Value of `telemetry.sdk.language`.
|
|
149
153
|
* @see {@link RESOURCE_TELEMETRY_SDK_LANGUAGE}
|
|
@@ -166,7 +170,7 @@ export declare const CONTENT_TYPE_NDJSON = "application/x-ndjson";
|
|
|
166
170
|
/** Nanoseconds per millisecond. */
|
|
167
171
|
export declare const NANOS_PER_MILLI = 1000000n;
|
|
168
172
|
/**
|
|
169
|
-
* Matches a nanosecond epoch
|
|
173
|
+
* Matches a nanosecond epoch in decimal digits, for example "1755543600123000000".
|
|
170
174
|
* @see {@link NANOS_PER_MILLI}
|
|
171
175
|
*/
|
|
172
176
|
export declare const NANOS_PATTERN: RegExp;
|
|
@@ -183,8 +187,18 @@ export declare const HEADER_RETRY_AFTER = "Retry-After";
|
|
|
183
187
|
export declare const HEADER_BATCH_ID = "X-UiObs-Batch-Id";
|
|
184
188
|
/** Delivery attempt number header name. */
|
|
185
189
|
export declare const HEADER_ATTEMPT = "X-UiObs-Attempt";
|
|
190
|
+
/** Response header that carries sampling rules from the ingest server. */
|
|
191
|
+
export declare const HEADER_SAMPLING = "X-UiObs-Sampling";
|
|
186
192
|
/** Gzip encoding name. */
|
|
187
193
|
export declare const ENCODING_GZIP = "gzip";
|
|
194
|
+
/** Lowest valid HTTP status code. */
|
|
195
|
+
export declare const HTTP_STATUS_MIN = 100;
|
|
196
|
+
/** Highest valid HTTP status code. */
|
|
197
|
+
export declare const HTTP_STATUS_MAX = 599;
|
|
198
|
+
/** Lowest HTTP status code that accepts a batch. */
|
|
199
|
+
export declare const HTTP_SUCCESS_MIN = 200;
|
|
200
|
+
/** Lowest HTTP status code above the success range. */
|
|
201
|
+
export declare const HTTP_SUCCESS_END = 300;
|
|
188
202
|
/** 401, credentials missing or rejected. */
|
|
189
203
|
export declare const HTTP_UNAUTHORIZED = 401;
|
|
190
204
|
/** 403, valid credentials but access denied. */
|
|
@@ -218,9 +232,9 @@ export declare const BATCH_STORAGE_KEY_PREFIX = "ui-observability.batch.";
|
|
|
218
232
|
export declare const BATCH_KEY_TIME_WIDTH = 14;
|
|
219
233
|
/** localStorage key prefix for a batch that exit flush stores. */
|
|
220
234
|
export declare const EMERGENCY_STORAGE_KEY_PREFIX = "ui-observability.emergency.";
|
|
221
|
-
/**
|
|
235
|
+
/** Maximum number of exit batches in the emergency queue. */
|
|
222
236
|
export declare const EMERGENCY_MAX_ENTRIES = 20;
|
|
223
|
-
/** Key
|
|
237
|
+
/** Key that the library writes to test if localStorage accepts writes. */
|
|
224
238
|
export declare const STORAGE_PROBE_KEY = "ui-observability.probe";
|
|
225
239
|
/** Fraction of the store to evict on a quota error (1 in N). */
|
|
226
240
|
export declare const QUOTA_EVICTION_DIVISOR = 4;
|
|
@@ -243,7 +257,7 @@ export declare const STORAGE_NAME_INDEXEDDB = "indexeddb";
|
|
|
243
257
|
export declare const STORAGE_NAME_LOCAL = "localstorage";
|
|
244
258
|
/** In-memory adapter/strategy name. */
|
|
245
259
|
export declare const STORAGE_NAME_MEMORY = "memory";
|
|
246
|
-
/**
|
|
260
|
+
/** Name of the storage adapter that keeps nothing. */
|
|
247
261
|
export declare const STORAGE_NAME_NONE = "none";
|
|
248
262
|
/**
|
|
249
263
|
* Origin-wide lock name a drain runs under.
|
|
@@ -315,6 +329,11 @@ export declare const FNV_OFFSET_BASIS = 2166136261;
|
|
|
315
329
|
export declare const FNV_PRIME = 16777619;
|
|
316
330
|
/** Largest 32-bit unsigned value. */
|
|
317
331
|
export declare const UINT32_MAX = 4294967295;
|
|
332
|
+
/**
|
|
333
|
+
* Types that minLevel does not drop. An action is an audit fact and a metric is a measurement.
|
|
334
|
+
* The remote rate cap for records below minLevel does not apply to them.
|
|
335
|
+
*/
|
|
336
|
+
export declare const LEVEL_BYPASS_TYPES: readonly LogType[];
|
|
318
337
|
/** Record kind routed to the metric stream. */
|
|
319
338
|
export declare const LOG_TYPE_METRIC: LogType;
|
|
320
339
|
/** Protocol identifier for bus envelopes. The bus drops an envelope with a different version. */
|
|
@@ -323,6 +342,10 @@ export declare const BUS_PROTOCOL = "ui-observability/1";
|
|
|
323
342
|
export declare const RUNTIME_GLOBAL_KEY = "ui-observability.runtime";
|
|
324
343
|
/** Global key of the runtime that shutdown() stopped. Calls go to it until the next configure(). */
|
|
325
344
|
export declare const RUNTIME_STOPPED_KEY = "ui-observability.stopped";
|
|
345
|
+
/** Global symbol key of the library request scope count. All library copies on a page share it. */
|
|
346
|
+
export declare const LIBRARY_REQUEST_KEY = "ui-observability.request-scope";
|
|
347
|
+
/** Global symbol key of the library console scope count. All library copies on a page share it. */
|
|
348
|
+
export declare const LIBRARY_CONSOLE_KEY = "ui-observability.console-scope";
|
|
326
349
|
/** Maximum error records captured per throttling window before suppression. */
|
|
327
350
|
export declare const ERROR_STORM_MAX_PER_WINDOW = 20;
|
|
328
351
|
/** Error rate-limiting window duration in milliseconds. */
|
|
@@ -333,6 +356,12 @@ export declare const ERROR_STORM_WINDOW_MS = 10000;
|
|
|
333
356
|
* ERROR and FATAL records skip sampling. A direct logger.error call has no other limit.
|
|
334
357
|
*/
|
|
335
358
|
export declare const ERROR_CEILING_MAX_PER_WINDOW = 500;
|
|
359
|
+
/** Default minimum duration of a long frame that the library records, in milliseconds. */
|
|
360
|
+
export declare const LONG_FRAME_THRESHOLD_MS = 100;
|
|
361
|
+
/** Maximum long frames recorded in each storm window. A frozen tab cannot flood the pipeline. */
|
|
362
|
+
export declare const LONG_FRAME_MAX_PER_WINDOW = 20;
|
|
363
|
+
/** Maximum character length of a console breadcrumb message. */
|
|
364
|
+
export declare const CONSOLE_BREADCRUMB_MAX_CHARS = 200;
|
|
336
365
|
/** Maximum distinct error signatures tracked for deduplication before LRU eviction. */
|
|
337
366
|
export declare const MAX_TRACKED_ERROR_SIGNATURES = 200;
|
|
338
367
|
/** Maximum character length retained from clicked element text in breadcrumbs. */
|
|
@@ -351,7 +380,7 @@ export declare const GAP_REPORT_THROTTLE_MS = 60000;
|
|
|
351
380
|
export declare const CAPTURE_NAMESPACE = "uiobs.capture";
|
|
352
381
|
/** Default namespace for telemetry records emitted by storage subsystems. */
|
|
353
382
|
export declare const STORAGE_NAMESPACE = "uiobs.storage";
|
|
354
|
-
/**
|
|
383
|
+
/** Measurement unit that the library uses when the call gives no unit. */
|
|
355
384
|
export declare const DEFAULT_METRIC_UNIT = "count";
|
|
356
385
|
/** Default `service.name` when a consumer sets none. */
|
|
357
386
|
export declare const UNKNOWN_SERVICE_NAME = "unknown-service";
|
|
@@ -364,16 +393,26 @@ export declare const SAMPLING_RATE_MAX = 1;
|
|
|
364
393
|
* @see {@link SAMPLING_RATE_MAX}
|
|
365
394
|
*/
|
|
366
395
|
export declare const SAMPLING_RATE_FALLBACK = 1;
|
|
396
|
+
/** Version of the remote sampling rules that the library accepts. */
|
|
397
|
+
export declare const REMOTE_SAMPLING_VERSION = 1;
|
|
398
|
+
/** Maximum length of the sampling header, in characters. */
|
|
399
|
+
export declare const REMOTE_SAMPLING_MAX_CHARS = 4096;
|
|
400
|
+
/** Maximum time that remote sampling rules stay in force, in milliseconds. */
|
|
401
|
+
export declare const REMOTE_SAMPLING_MAX_TTL_MS: number;
|
|
402
|
+
/** Maximum namespace rates in one set of remote sampling rules. */
|
|
403
|
+
export declare const REMOTE_SAMPLING_MAX_RATES = 100;
|
|
404
|
+
/** Time between two requests of a forwarder for the remote sampling rules, in milliseconds. */
|
|
405
|
+
export declare const REMOTE_SAMPLING_POLL_MS = 30000;
|
|
367
406
|
/**
|
|
368
407
|
* Config keys with no default, excluded from `DEFAULT_CONFIG`.
|
|
369
408
|
* @see {@link DEFAULT_CONFIG}
|
|
370
409
|
*/
|
|
371
|
-
export declare const UNDEFAULTED_CONFIG_KEYS: readonly ["redact", "onDiagnostic", "headers", "serializer", "otelLoader"];
|
|
410
|
+
export declare const UNDEFAULTED_CONFIG_KEYS: readonly ["redact", "onDiagnostic", "headers", "serializer", "otelLoader", "transport", "transportOnExit"];
|
|
372
411
|
/**
|
|
373
412
|
* Nested config section keys.
|
|
374
413
|
* @see {@link ResolvedConfig}
|
|
375
414
|
*/
|
|
376
|
-
export declare const CONFIG_SECTIONS: readonly ["sampling", "bus", "capture"];
|
|
415
|
+
export declare const CONFIG_SECTIONS: readonly ["sampling", "bus", "journey", "capture"];
|
|
377
416
|
/**
|
|
378
417
|
* Section keys with no default, excluded from their section of `DEFAULT_CONFIG`.
|
|
379
418
|
* @see {@link UNDEFAULTED_CONFIG_KEYS}
|
|
@@ -423,7 +462,7 @@ export declare const RETRY_MAX_DELAY_MS = 60000;
|
|
|
423
462
|
export declare const RETRY_IDLE_DELAY_MS = 30000;
|
|
424
463
|
/** Max time a journey stays open, in milliseconds. Then the library treats it as abandoned. */
|
|
425
464
|
export declare const JOURNEY_MAX_AGE_MS: number;
|
|
426
|
-
/**
|
|
465
|
+
/** True if the journey ends for all contexts when the owning context closes. */
|
|
427
466
|
export declare const JOURNEY_END_ON_OWNER_CLOSE = false;
|
|
428
467
|
/** Query parameter checked at boot for a seeded journey token. */
|
|
429
468
|
export declare const JOURNEY_URL_PARAM = "__uiobs_journey";
|
|
@@ -435,6 +474,8 @@ export declare const BUS_HANDSHAKE_TIMEOUT_MS = 1500;
|
|
|
435
474
|
export declare const BUS_MAX_HANDSHAKE_ATTEMPTS = 3;
|
|
436
475
|
/** Max records a context buffers before it knows its bus role. */
|
|
437
476
|
export declare const BUS_MAX_BOOT_BUFFER_RECORDS = 500;
|
|
477
|
+
/** Max characters of an untrusted message type in a diagnostic detail. The sender sets the text. */
|
|
478
|
+
export declare const BUS_TYPE_DETAIL_MAX_CHARS = 32;
|
|
438
479
|
/** Breadcrumbs kept as context for the next error. */
|
|
439
480
|
export declare const MAX_BREADCRUMBS = 50;
|
|
440
481
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Category of a breadcrumb event. */
|
|
2
|
-
export type BreadcrumbCategory = "log" | "action" | "event" | "click" | "navigation" | "http" | "console";
|
|
2
|
+
export type BreadcrumbCategory = "log" | "action" | "event" | "click" | "navigation" | "http" | "console" | "frame";
|
|
3
3
|
/** Short summary of one event that the buffer keeps for an error record. */
|
|
4
4
|
export interface Breadcrumb {
|
|
5
5
|
/** Timestamp in epoch milliseconds. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Closed set of diagnostic event codes emitted by library subsystems. */
|
|
2
|
-
export type DiagnosticCode = "config.invalid" | "config.reconfigured" | "record.sanitize_failed" | "record.truncated" | "record.dropped_by_level" | "record.dropped_by_sampling" | "record.dropped_by_ceiling" | "record.dropped_by_redact" | "record.dropped_boot_buffer_full" | "record.dropped_malformed" | "journey.expired" | "journey.adopted" | "journey.token_too_large" | "trace.otel_failed" | "bus.role_resolved" | "bus.no_owner" | "bus.handshake_timeout" | "bus.untrusted_origin" | "bus.send_failed" | "transport.http_error" | "transport.timeout" | "transport.batch_split" | "transport.throttled" | "transport.dropped_permanent" | "transport.rejected_credentials" | "transport.serialize_failed" | "storage.unavailable" | "storage.degraded" | "storage.quota_exceeded" | "storage.evicted" | "storage.dead_lettered" | "pipeline.crashed" | "capture.install_failed" | "capture.rate_limited" | "capture.header_failed" | "capture.record_failed" | "openfin.unavailable" | "platform.api_blocked" | "handler.threw";
|
|
2
|
+
export type DiagnosticCode = "config.invalid" | "config.reconfigured" | "record.sanitize_failed" | "record.truncated" | "record.dropped_by_level" | "record.dropped_by_sampling" | "record.dropped_by_ceiling" | "record.dropped_by_redact" | "record.dropped_boot_buffer_full" | "record.dropped_malformed" | "record.dropped_no_destination" | "runtime.version_mismatch" | "journey.expired" | "journey.adopted" | "journey.token_too_large" | "trace.otel_failed" | "bus.role_resolved" | "bus.no_owner" | "bus.handshake_timeout" | "bus.untrusted_origin" | "bus.send_failed" | "transport.http_error" | "transport.timeout" | "transport.batch_split" | "transport.throttled" | "transport.dropped_permanent" | "transport.rejected_credentials" | "transport.serialize_failed" | "storage.unavailable" | "storage.degraded" | "storage.quota_exceeded" | "storage.evicted" | "storage.dead_lettered" | "pipeline.crashed" | "capture.install_failed" | "capture.rate_limited" | "capture.header_failed" | "capture.record_failed" | "openfin.unavailable" | "platform.api_blocked" | "handler.threw";
|
|
3
3
|
/** Diagnostic event payload dispatched to consumer handlers. */
|
|
4
4
|
export interface DiagnosticEvent {
|
|
5
5
|
/** Diagnostic fault code. */
|
|
@@ -64,7 +64,7 @@ export declare class Diagnostics {
|
|
|
64
64
|
* @param code Diagnostic code to report on rejection.
|
|
65
65
|
* @param message ASD-STE100 sentence that states the failure. The handler gets it as the event message.
|
|
66
66
|
* @param fn Async function to execute.
|
|
67
|
-
* @returns Promise
|
|
67
|
+
* @returns Promise that resolves to the return value, or undefined on rejection.
|
|
68
68
|
*/
|
|
69
69
|
guardAsync<T>(code: DiagnosticCode, message: string, fn: () => Promise<T>): Promise<T | undefined>;
|
|
70
70
|
/**
|
package/dist/core/journey.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { Diagnostics } from "./diagnostics";
|
|
|
4
4
|
export interface JourneyOptions {
|
|
5
5
|
/** Maximum open time of a journey, in milliseconds. After this time, the engine ends it. */
|
|
6
6
|
maxAgeMs: number;
|
|
7
|
-
/**
|
|
7
|
+
/** True if the journey ends for all contexts when the owning context closes. */
|
|
8
8
|
endOnOwnerClose: boolean;
|
|
9
9
|
/** Query parameter checked at boot for a seeded journey token. */
|
|
10
10
|
urlParam: string;
|
|
@@ -24,6 +24,13 @@ export interface Journey {
|
|
|
24
24
|
/** Context identifier of the document that started the journey. */
|
|
25
25
|
ownerContextId: string;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Parses and validates an unknown value into a Journey object. The value comes from
|
|
29
|
+
* sessionStorage or from a bus message of another realm.
|
|
30
|
+
* @param value Unverified parsed JSON value.
|
|
31
|
+
* @returns Validated Journey instance or null.
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseJourney(value: unknown): Journey | null;
|
|
27
34
|
/** Manages journey lifecycle, cross-window adoption, storage synchronization, and expiration. */
|
|
28
35
|
export declare class JourneyEngine {
|
|
29
36
|
private readonly options;
|
|
@@ -48,7 +55,7 @@ export declare class JourneyEngine {
|
|
|
48
55
|
/**
|
|
49
56
|
* Finds and adopts the initial journey. It checks the URL query, then sessionStorage,
|
|
50
57
|
* then OpenFin customData.
|
|
51
|
-
* @returns Promise
|
|
58
|
+
* @returns Promise that resolves when journey initialization completes.
|
|
52
59
|
*/
|
|
53
60
|
bootstrap(): Promise<void>;
|
|
54
61
|
/**
|
|
@@ -81,7 +88,7 @@ export declare class JourneyEngine {
|
|
|
81
88
|
* Validates and adopts a serialized journey token.
|
|
82
89
|
* @param token Base64url journey token.
|
|
83
90
|
* @param source Originating source description for diagnostics.
|
|
84
|
-
* @param broadcast
|
|
91
|
+
* @param broadcast True to send the adoption to the connected bus peers.
|
|
85
92
|
* @returns True if the token was valid, unexpired, and adopted.
|
|
86
93
|
*/
|
|
87
94
|
adopt(token: string, source: string, broadcast?: boolean): boolean;
|
|
@@ -120,11 +127,16 @@ export declare class JourneyEngine {
|
|
|
120
127
|
* @returns Token string or null.
|
|
121
128
|
*/
|
|
122
129
|
private readUrlToken;
|
|
130
|
+
/**
|
|
131
|
+
* Removes the journey token from the address bar after the engine adopts it.
|
|
132
|
+
* If not, a copy or a bookmark of the link starts the same journey in another session.
|
|
133
|
+
*/
|
|
134
|
+
private removeUrlToken;
|
|
123
135
|
/**
|
|
124
136
|
* Reads the journey token from the customData of the OpenFin window options.
|
|
125
137
|
* OPENFIN_OPTIONS_TIMEOUT_MS limits the wait. At the deadline, it reports
|
|
126
138
|
* openfin.unavailable and returns no token. A window without a token gives the same result.
|
|
127
|
-
* @returns Promise
|
|
139
|
+
* @returns Promise that resolves to token string or null.
|
|
128
140
|
*/
|
|
129
141
|
private readOpenFinToken;
|
|
130
142
|
}
|
package/dist/core/logger.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export declare class OneLogger {
|
|
|
10
10
|
private readonly bind;
|
|
11
11
|
readonly namespace: string;
|
|
12
12
|
private readonly options;
|
|
13
|
+
/** log.type of the level methods. It is "system" only for the namespaces of the library. */
|
|
14
|
+
private readonly levelType;
|
|
13
15
|
/**
|
|
14
16
|
* @param bind Returns the runtime for each write.
|
|
15
17
|
* A logger that exists before configure() writes to the configured runtime.
|
|
@@ -98,7 +100,7 @@ export declare class OneLogger {
|
|
|
98
100
|
* @param label Metric name prefix.
|
|
99
101
|
* @param fn Asynchronous function to time.
|
|
100
102
|
* @param attributes Optional contextual attributes.
|
|
101
|
-
* @returns Promise
|
|
103
|
+
* @returns Promise that resolves to the result of the timed function.
|
|
102
104
|
*/
|
|
103
105
|
timeAsync: <T>(label: string, fn: () => Promise<T>, attributes?: Record<string, unknown>) => Promise<T>;
|
|
104
106
|
/**
|
|
@@ -107,6 +109,7 @@ export declare class OneLogger {
|
|
|
107
109
|
* @param type Record classification.
|
|
108
110
|
* @param body Primary message.
|
|
109
111
|
* @param payload Optional contextual attributes.
|
|
112
|
+
* @param copied True when the payload is a copy that the library made. write() does not copy it.
|
|
110
113
|
*/
|
|
111
114
|
private write;
|
|
112
115
|
/**
|
|
@@ -126,10 +129,11 @@ export declare class OneLogger {
|
|
|
126
129
|
* @param payload Caller payload.
|
|
127
130
|
* @param error Error of an error call.
|
|
128
131
|
* @param record Built record, or null if the library did not build it or redact dropped it.
|
|
132
|
+
* @param dropped Reason of the drop when the builder dropped the record.
|
|
129
133
|
*/
|
|
130
134
|
private print;
|
|
131
135
|
/**
|
|
132
|
-
* Tests
|
|
136
|
+
* Tests if the console prints a level that the library does not send.
|
|
133
137
|
* @param runtime Runtime of this write.
|
|
134
138
|
* @param level Severity level.
|
|
135
139
|
* @returns True if logging is on and the console accepts the level.
|