@utk09/ui-observability 0.9.3 → 0.9.4
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 +45 -0
- package/README.md +108 -33
- package/dist/{batch-D5qvsMQ_.cjs → batch-C4oF6XZT.cjs} +2 -2
- package/dist/{batch-D5qvsMQ_.cjs.map → batch-C4oF6XZT.cjs.map} +1 -1
- package/dist/{batch-DDgxg16_.js → batch-D-4xl7op.js} +4 -4
- package/dist/{batch-DDgxg16_.js.map → batch-D-4xl7op.js.map} +1 -1
- package/dist/{bus-C6RwKzPW.js → bus-Cyvq-Ngx.js} +5 -5
- package/dist/{bus-C6RwKzPW.js.map → bus-Cyvq-Ngx.js.map} +1 -1
- package/dist/{bus-WPVDFw2y.cjs → bus-rOhVuRee.cjs} +2 -2
- package/dist/{bus-WPVDFw2y.cjs.map → bus-rOhVuRee.cjs.map} +1 -1
- package/dist/capture/network.d.ts +1 -0
- package/dist/capture/types.d.ts +3 -0
- package/dist/capture/web-socket.d.ts +40 -0
- package/dist/{console-Dv5GfaNn.js → console-BT7mcgU6.js} +3 -3
- package/dist/{console-Dv5GfaNn.js.map → console-BT7mcgU6.js.map} +1 -1
- package/dist/{console-BSusX_M-.cjs → console-Boqa7new.cjs} +2 -2
- package/dist/{console-BSusX_M-.cjs.map → console-Boqa7new.cjs.map} +1 -1
- package/dist/constants-BgRS6MB0.cjs +2 -0
- package/dist/constants-BgRS6MB0.cjs.map +1 -0
- package/dist/constants-L_d5YvvQ.js +160 -0
- package/dist/constants-L_d5YvvQ.js.map +1 -0
- package/dist/constants.d.ts +34 -2
- package/dist/core/breadcrumbs.d.ts +3 -1
- package/dist/core/diagnostics.d.ts +1 -1
- package/dist/core/journey.d.ts +7 -0
- package/dist/core/meter.d.ts +19 -1
- package/dist/core/pipeline.d.ts +12 -4
- package/dist/core/record.d.ts +40 -8
- package/dist/core/remote-sampling.d.ts +7 -3
- package/dist/core/runtime.d.ts +62 -3
- package/dist/core/sampling.d.ts +32 -1
- package/dist/core/sender.d.ts +8 -0
- package/dist/core/spans.d.ts +34 -0
- package/dist/{errors-DCZWcHkd.js → errors-BDI96zKc.js} +6 -6
- package/dist/errors-BDI96zKc.js.map +1 -0
- package/dist/errors-_xEsCVXn.cjs +3 -0
- package/dist/errors-_xEsCVXn.cjs.map +1 -0
- package/dist/identity-Bwku7zzN.cjs +2 -0
- package/dist/identity-Bwku7zzN.cjs.map +1 -0
- package/dist/{identity-Di-QXGCC.js → identity-Dtv917nz.js} +33 -23
- package/dist/identity-Dtv917nz.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +803 -524
- package/dist/index.js.map +1 -1
- package/dist/{indexeddb-storage-DX18p39D.cjs → indexeddb-storage-Cvavrf-y.cjs} +2 -2
- package/dist/{indexeddb-storage-DX18p39D.cjs.map → indexeddb-storage-Cvavrf-y.cjs.map} +1 -1
- package/dist/{indexeddb-storage-T9YIYVYC.js → indexeddb-storage-HgkQUTyS.js} +26 -26
- package/dist/{indexeddb-storage-T9YIYVYC.js.map → indexeddb-storage-HgkQUTyS.js.map} +1 -1
- package/dist/{interactions-_hfOerfC.cjs → interactions-Bhe1ft8P.cjs} +2 -2
- package/dist/interactions-Bhe1ft8P.cjs.map +1 -0
- package/dist/{interactions-BLH_tX87.js → interactions-Ck01cEij.js} +3 -3
- package/dist/interactions-Ck01cEij.js.map +1 -0
- package/dist/journey-Co9OlzrW.cjs +2 -0
- package/dist/journey-Co9OlzrW.cjs.map +1 -0
- package/dist/{journey-yALMEWF7.js → journey-DRK0A8u_.js} +37 -34
- package/dist/journey-DRK0A8u_.js.map +1 -0
- package/dist/{library-request-CQD4HUiP.js → library-request-ChCar5F8.js} +3 -3
- package/dist/{library-request-CQD4HUiP.js.map → library-request-ChCar5F8.js.map} +1 -1
- package/dist/{library-request-BcAxuwsf.cjs → library-request-gMFOCNcn.cjs} +2 -2
- package/dist/{library-request-BcAxuwsf.cjs.map → library-request-gMFOCNcn.cjs.map} +1 -1
- package/dist/log-record-cwFiLyPY.js +17 -0
- package/dist/log-record-cwFiLyPY.js.map +1 -0
- package/dist/log-record-jX9eWUP8.cjs +2 -0
- package/dist/log-record-jX9eWUP8.cjs.map +1 -0
- package/dist/{long-frames-D4Bm3Zkz.cjs → long-frames-Bky6nZDF.cjs} +2 -2
- package/dist/long-frames-Bky6nZDF.cjs.map +1 -0
- package/dist/{long-frames-DD_Um9_4.js → long-frames-DDumopji.js} +4 -4
- package/dist/long-frames-DDumopji.js.map +1 -0
- package/dist/models/config.d.ts +56 -5
- package/dist/models/log-record.d.ts +1 -1
- package/dist/models/plugin.d.ts +47 -0
- package/dist/models/stats.d.ts +11 -0
- package/dist/{network--GoE7_Or.js → network-BsBZ6_-Q.js} +43 -29
- package/dist/network-BsBZ6_-Q.js.map +1 -0
- package/dist/network-_4csBGBM.cjs +2 -0
- package/dist/network-_4csBGBM.cjs.map +1 -0
- package/dist/{platform-GaM6h7XM.js → platform-4yYjMD-B.js} +11 -6
- package/dist/platform-4yYjMD-B.js.map +1 -0
- package/dist/{platform-kIL5AZB7.cjs → platform-o7r1ocOu.cjs} +2 -2
- package/dist/platform-o7r1ocOu.cjs.map +1 -0
- package/dist/remote-rules-1KqfVBIu.js +91 -0
- package/dist/remote-rules-1KqfVBIu.js.map +1 -0
- package/dist/remote-rules-BHgEGlYi.cjs +2 -0
- package/dist/remote-rules-BHgEGlYi.cjs.map +1 -0
- package/dist/sampling-C4my-ma0.cjs +2 -0
- package/dist/sampling-C4my-ma0.cjs.map +1 -0
- package/dist/sampling-nYIWP_vP.js +86 -0
- package/dist/sampling-nYIWP_vP.js.map +1 -0
- package/dist/{sanitize-DP0xDPrt.js → sanitize-BiUKCUG6.js} +2 -2
- package/dist/{sanitize-DP0xDPrt.js.map → sanitize-BiUKCUG6.js.map} +1 -1
- package/dist/{sanitize--_e4oOPX.cjs → sanitize-BxuPSXOk.cjs} +2 -2
- package/dist/{sanitize--_e4oOPX.cjs.map → sanitize-BxuPSXOk.cjs.map} +1 -1
- package/dist/sender-6vrT9fFL.cjs +3 -0
- package/dist/sender-6vrT9fFL.cjs.map +1 -0
- package/dist/{sender-BUBWLn5i.js → sender-DFQMF39P.js} +382 -275
- package/dist/sender-DFQMF39P.js.map +1 -0
- package/dist/{storm-DhHGHhOc.cjs → storm-6YYbXzT_.cjs} +2 -2
- package/dist/{storm-DhHGHhOc.cjs.map → storm-6YYbXzT_.cjs.map} +1 -1
- package/dist/{storm-OD5J6Ylm.js → storm-CfO0Sam2.js} +2 -2
- package/dist/{storm-OD5J6Ylm.js.map → storm-CfO0Sam2.js.map} +1 -1
- package/dist/transport/exit-flush.d.ts +6 -0
- package/dist/transport/http-transport.d.ts +2 -1
- package/dist/transport/serializers/otlp-traces.d.ts +3 -0
- package/dist/transport/serializers/select.d.ts +8 -5
- package/dist/transport/status-transport.d.ts +7 -0
- package/dist/types-BR9t_w28.js +8 -0
- package/dist/types-BR9t_w28.js.map +1 -0
- package/dist/types-C7WNpnG1.cjs +2 -0
- package/dist/types-C7WNpnG1.cjs.map +1 -0
- package/dist/utils/identity.d.ts +11 -0
- package/dist/utils/platform.d.ts +8 -0
- package/dist/utils/tracing.d.ts +82 -4
- package/dist/web-socket-Ar4cZxmd.js +102 -0
- package/dist/web-socket-Ar4cZxmd.js.map +1 -0
- package/dist/web-socket-BwJdwSHl.cjs +2 -0
- package/dist/web-socket-BwJdwSHl.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/constants-Cb92egPS.cjs +0 -2
- package/dist/constants-Cb92egPS.cjs.map +0 -1
- package/dist/constants-DhH6VI5a.js +0 -144
- package/dist/constants-DhH6VI5a.js.map +0 -1
- package/dist/deadline-CUrH0Hd8.cjs +0 -2
- package/dist/deadline-CUrH0Hd8.cjs.map +0 -1
- package/dist/deadline-DeqXEliN.js +0 -31
- package/dist/deadline-DeqXEliN.js.map +0 -1
- package/dist/errors-DCZWcHkd.js.map +0 -1
- package/dist/errors-ERu-su8m.cjs +0 -3
- package/dist/errors-ERu-su8m.cjs.map +0 -1
- package/dist/identity-C1WLItSl.cjs +0 -2
- package/dist/identity-C1WLItSl.cjs.map +0 -1
- package/dist/identity-Di-QXGCC.js.map +0 -1
- package/dist/interactions-BLH_tX87.js.map +0 -1
- package/dist/interactions-_hfOerfC.cjs.map +0 -1
- package/dist/journey-BRUj0hqD.cjs +0 -2
- package/dist/journey-BRUj0hqD.cjs.map +0 -1
- package/dist/journey-yALMEWF7.js.map +0 -1
- package/dist/long-frames-D4Bm3Zkz.cjs.map +0 -1
- package/dist/long-frames-DD_Um9_4.js.map +0 -1
- package/dist/network--GoE7_Or.js.map +0 -1
- package/dist/network-DcuS2H1P.cjs +0 -2
- package/dist/network-DcuS2H1P.cjs.map +0 -1
- package/dist/platform-GaM6h7XM.js.map +0 -1
- package/dist/platform-kIL5AZB7.cjs.map +0 -1
- package/dist/remote-rules-6ePq8CrI.js +0 -84
- package/dist/remote-rules-6ePq8CrI.js.map +0 -1
- package/dist/remote-rules-CI3gbRCL.cjs +0 -2
- package/dist/remote-rules-CI3gbRCL.cjs.map +0 -1
- package/dist/sampling-C-M8p3FK.cjs +0 -2
- package/dist/sampling-C-M8p3FK.cjs.map +0 -1
- package/dist/sampling-Ud_WiuU9.js +0 -65
- package/dist/sampling-Ud_WiuU9.js.map +0 -1
- package/dist/sender-BESHz6my.cjs +0 -3
- package/dist/sender-BESHz6my.cjs.map +0 -1
- package/dist/sender-BUBWLn5i.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-BgRS6MB0.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","ECS_VERSION","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","JOURNEY_ID_PATTERN","JOURNEY_CLOCK_SKEW_MS","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","LOG_TYPE_ACTION","LOG_TYPE_SPAN","BUS_PROTOCOL","RUNTIME_GLOBAL_KEY","RUNTIME_STOPPED_KEY","LIBRARY_REQUEST_KEY","LIBRARY_CONSOLE_KEY","TRANSPORT_CALL_KEY","ERROR_STORM_WINDOW_MS","CONSOLE_DEFAULT_STYLES","DURATION_PRECISION","GAP_REPORT_THROTTLE_MS","CAPTURE_NAMESPACE","STORAGE_NAMESPACE","DEFAULT_METRIC_UNIT","METRIC_NAMESPACE","ATTR_METRIC_OVERFLOW","METRIC_DEFAULT_BOUNDARIES","METRIC_KEYS","TRACE_NAMESPACE","SPAN_KEYS","UNKNOWN_SERVICE_NAME","REMOTE_SAMPLING_MAX_CHARS","REMOTE_SAMPLING_MAX_TTL_MS","REMOTE_SAMPLING_POLL_MS","UNDEFAULTED_CONFIG_KEYS","CONFIG_SECTIONS","UNDEFAULTED_SECTION_KEYS","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","BUS_MAX_BOOT_BUFFER_ACTIONS","ERROR_DEDUPE_MS","RECORD_LIMITS","DEFAULT_CONFIG"],"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 build writes the version of package.json here.\n * @see {@link RESOURCE_TELEMETRY_SDK_VERSION}\n */\nexport const TELEMETRY_SDK_VERSION = __UIOBS_VERSION__;\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/** ECS version of the documents. The Elastic ECS logging libraries write this version. */\nexport const ECS_VERSION = \"8.10.0\";\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 length of a journey id from startJourney(), in characters. The token of a journey with this\n * id and a full name stays below the token limit.\n * @see {@link JOURNEY_TOKEN_MAX_CHARS}\n */\nexport const JOURNEY_ID_MAX_CHARS = 64;\n\n/**\n * Accepted journey id from startJourney(): letters, digits, \"_\", \".\", \":\" and \"-\". Each character\n * is one byte in UTF-8. A multibyte id makes the token larger than its limit.\n */\nexport const JOURNEY_ID_PATTERN = new RegExp(`^[\\\\w.:-]{1,${String(JOURNEY_ID_MAX_CHARS)}}$`);\n\n/**\n * Time that the start of a journey token can be ahead of this clock, in milliseconds. Two machines\n * can disagree on the time. A token further ahead never expires.\n */\nexport const JOURNEY_CLOCK_SKEW_MS = 5 * 60 * 1000;\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. A metric and a span are measurements.\n * The remote rate cap for records below minLevel does not apply to them.\n */\nexport const LEVEL_BYPASS_TYPES: readonly LogType[] = [\"action\", \"metric\", \"span\"];\n\n// ----------------------------------\n// Pipeline\n// ----------------------------------\n\n/** Record kind routed to the metric stream. */\nexport const LOG_TYPE_METRIC: LogType = \"metric\";\n\n/** Record kind of an audit fact. Storage and the hold buffers drop it last. */\nexport const LOG_TYPE_ACTION: LogType = \"action\";\n\n/** Record kind routed to the trace stream. */\nexport const LOG_TYPE_SPAN: LogType = \"span\";\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/** Global symbol key of the count of custom transport calls that wait for an answer. */\nexport const TRANSPORT_CALL_KEY = \"ui-observability.transport-calls\";\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 WebSocket events recorded in each storm window. A reconnect loop cannot flood the pipeline. */\nexport const WEBSOCKET_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/** Namespace of the points that the counter and histogram instruments give. */\nexport const METRIC_NAMESPACE = \"uiobs.metrics\";\n\n/** Maximum attribute sets of one instrument in one interval. More sets go to one overflow set. */\nexport const METRIC_MAX_SERIES = 100;\n\n/** Maximum bucket boundaries of one histogram. More boundaries make a large point. */\nexport const METRIC_MAX_BOUNDARIES = 50;\n\n/** Attribute of the overflow set. OpenTelemetry uses the same key. */\nexport const ATTR_METRIC_OVERFLOW = \"otel.metric.overflow\";\n\n/** Default histogram boundaries. They are the OpenTelemetry default boundaries. */\nexport const METRIC_DEFAULT_BOUNDARIES: readonly number[] = [\n 0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000,\n];\n\n/**\n * Attribute keys of an aggregated metric point. The OTLP metrics serializer reads them.\n * Sampling keeps each record with a start time. A sample of a sum gives a false sum.\n */\nexport const METRIC_KEYS = {\n start: \"metric.start_time_unix_nano\",\n attributeKeys: \"metric.attribute_keys\",\n count: \"metric.count\",\n sum: \"metric.sum\",\n min: \"metric.min\",\n max: \"metric.max\",\n bounds: \"metric.bounds\",\n buckets: \"metric.bucket_counts\",\n} as const;\n\n/** Namespace of the span records. */\nexport const TRACE_NAMESPACE = \"uiobs.traces\";\n\n/** Attribute keys of the span fields of a span record. The traces serializer reads them. */\nexport const SPAN_KEYS = {\n kind: \"span.kind\",\n parentId: \"span.parent_id\",\n start: \"span.start_time_unix_nano\",\n end: \"span.end_time_unix_nano\",\n status: \"span.status\",\n} as const;\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 \"contextProvider\",\n \"redact\",\n \"onDiagnostic\",\n \"onDrop\",\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 = [\n \"sampling\",\n \"bus\",\n \"journey\",\n \"batching\",\n \"retention\",\n \"limits\",\n \"capture\",\n] 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 batching: [],\n retention: [],\n limits: [],\n capture: [\"webVitalsLoader\"],\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 that are not actions in one hold buffer. A full buffer drops the oldest. */\nexport const BUS_MAX_BOOT_BUFFER_RECORDS = 500;\n\n/** Max action records in one hold buffer. Actions have their own cap. A log storm cannot push one out. */\nexport const BUS_MAX_BOOT_BUFFER_ACTIONS = 2000;\n\n/** Max different values in each list of an onDrop summary. */\nexport const DROP_SUMMARY_MAX_ITEMS = 20;\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\n// ----------------------------------\n// Config defaults\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 * It comes after the constants that it reads. A const cannot be read before its line.\n * @see {@link ResolvedConfig}\n * @see {@link UNDEFAULTED_CONFIG_KEYS}\n */\nexport const DEFAULT_CONFIG: Omit<ResolvedConfig, \"serializer\"> = {\n endpoint: \"\",\n metricsEndpoint: \"\",\n tracesEndpoint: \"\",\n serviceName: \"\",\n serviceVersion: \"\",\n environment: \"\",\n enabled: true,\n minLevel: \"INFO\",\n minLevels: {},\n processors: [],\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\", maxAgeMs: JOURNEY_MAX_AGE_MS },\n batching: {\n logFlushIntervalMs: LOG_FLUSH_INTERVAL_MS,\n logBatchSize: LOG_BATCH_SIZE,\n metricFlushIntervalMs: METRIC_FLUSH_INTERVAL_MS,\n metricBatchSize: METRIC_BATCH_SIZE,\n },\n retention: { mode: \"limited\", ...STORAGE_LIMITS },\n limits: { ...RECORD_LIMITS },\n capture: {\n errors: true,\n rejections: true,\n resourceErrors: false,\n fetch: false,\n xhr: false,\n httpMetrics: true,\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 webSocket: false,\n plugins: [],\n },\n console: { level: null, styles: CONSOLE_DEFAULT_STYLES },\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
//#region src/constants.ts
|
|
2
|
+
var ee = "[ui-observability]", te = 1e3, e = "ui-observability.session", ne = "ui-observability.tab", re = 18e5, ie = 6e4, t = /OpenFin/i, n = /\bwv\b/, r = /\b(iPhone|iPad|iPod)\b/, i = /\bMacintosh\b/, a = /\bMobile\b/, o = "AppleWebKit", s = "Safari/", c = 55296, l = 56319, u = 2048, d = {
|
|
3
|
+
TRACE: 1,
|
|
4
|
+
DEBUG: 5,
|
|
5
|
+
INFO: 9,
|
|
6
|
+
WARN: 13,
|
|
7
|
+
ERROR: 17,
|
|
8
|
+
FATAL: 21
|
|
9
|
+
}, f = d, p = "log.type", m = "log.seq", h = "app.namespace", g = "page.url", _ = "url.full", v = "journey.id", y = "journey.name", b = "journey.parent_id", x = "uiobs.sanitize_failed", S = "error.data", C = "breadcrumbs", w = "uiobs.attributes_dropped", T = "uiobs.attributes_bytes", E = "service.name", D = "service.version", O = "deployment.environment", k = "telemetry.sdk.name", A = "telemetry.sdk.version", j = "telemetry.sdk.language", M = "host.platform", N = "session.id", P = "tab.id", F = "context.id", I = "browser.user_agent", L = "openfin.uuid", R = "openfin.name", z = "@utk09/ui-observability", B = "0.9.4", V = "webjs", H = "otlp", U = { WARN: "warning" }, W = "8.10.0", G = "application/json", K = "application/x-ndjson", q = 1000000n, J = /^\d+$/, Y = "Content-Type", ae = "Content-Encoding", oe = "Retry-After", se = "X-UiObs-Batch-Id", ce = "X-UiObs-Attempt", le = "X-UiObs-Sampling", ue = "gzip", de = 1e3, fe = 6e4, pe = "text/plain;charset=UTF-8", me = "uiobs_batch_id", he = "uiobs_exit", ge = "ui-observability.batch.", _e = "ui-observability.emergency.", ve = "ui-observability.probe", ye = "QuotaExceededError", be = "batches", xe = "createdAt", Se = "indexeddb", Ce = "localstorage", we = "memory", Te = "none", X = "ui-observability.drain", Ee = "ui-observability.emergency", De = "ui-observability.journey", Oe = /* @__PURE__ */ RegExp("^[\\w.:-]{1,64}$"), ke = 3e5, Ae = 2e3, je = "uiObsJourney", Me = /\+/g, Ne = /\//g, Pe = /=+$/, Fe = /-/g, Ie = /_/g, Le = 3e5, Re = "traceparent", ze = 2166136261, Be = 16777619, Ve = 4294967295, He = [
|
|
10
|
+
"action",
|
|
11
|
+
"metric",
|
|
12
|
+
"span"
|
|
13
|
+
], Ue = "metric", We = "action", Ge = "span", Ke = "ui-observability/1", qe = "ui-observability.runtime", Je = "ui-observability.stopped", Ye = "ui-observability.request-scope", Xe = "ui-observability.console-scope", Ze = "ui-observability.transport-calls", Qe = 1e4, Z = {
|
|
14
|
+
namespace: "color:#888",
|
|
15
|
+
TRACE: "color:#888;font-weight:bold",
|
|
16
|
+
DEBUG: "color:#888;font-weight:bold",
|
|
17
|
+
INFO: "color:#1e6fd9;font-weight:bold",
|
|
18
|
+
WARN: "color:#c77700;font-weight:bold",
|
|
19
|
+
ERROR: "color:#d32f2f;font-weight:bold",
|
|
20
|
+
FATAL: "color:#d32f2f;font-weight:bold"
|
|
21
|
+
}, $e = 1e3, et = 6e4, tt = "uiobs.capture", nt = "uiobs.storage", rt = "count", it = "uiobs.metrics", at = "otel.metric.overflow", ot = [
|
|
22
|
+
0,
|
|
23
|
+
5,
|
|
24
|
+
10,
|
|
25
|
+
25,
|
|
26
|
+
50,
|
|
27
|
+
75,
|
|
28
|
+
100,
|
|
29
|
+
250,
|
|
30
|
+
500,
|
|
31
|
+
750,
|
|
32
|
+
1e3,
|
|
33
|
+
2500,
|
|
34
|
+
5e3,
|
|
35
|
+
7500,
|
|
36
|
+
1e4
|
|
37
|
+
], st = {
|
|
38
|
+
start: "metric.start_time_unix_nano",
|
|
39
|
+
attributeKeys: "metric.attribute_keys",
|
|
40
|
+
count: "metric.count",
|
|
41
|
+
sum: "metric.sum",
|
|
42
|
+
min: "metric.min",
|
|
43
|
+
max: "metric.max",
|
|
44
|
+
bounds: "metric.bounds",
|
|
45
|
+
buckets: "metric.bucket_counts"
|
|
46
|
+
}, ct = "uiobs.traces", lt = {
|
|
47
|
+
kind: "span.kind",
|
|
48
|
+
parentId: "span.parent_id",
|
|
49
|
+
start: "span.start_time_unix_nano",
|
|
50
|
+
end: "span.end_time_unix_nano",
|
|
51
|
+
status: "span.status"
|
|
52
|
+
}, ut = "unknown-service", dt = 4096, ft = 36e5, pt = 3e4, mt = [
|
|
53
|
+
"contextProvider",
|
|
54
|
+
"redact",
|
|
55
|
+
"onDiagnostic",
|
|
56
|
+
"onDrop",
|
|
57
|
+
"headers",
|
|
58
|
+
"serializer",
|
|
59
|
+
"otelLoader",
|
|
60
|
+
"transport",
|
|
61
|
+
"transportOnExit"
|
|
62
|
+
], ht = [
|
|
63
|
+
"sampling",
|
|
64
|
+
"bus",
|
|
65
|
+
"journey",
|
|
66
|
+
"batching",
|
|
67
|
+
"retention",
|
|
68
|
+
"limits",
|
|
69
|
+
"capture"
|
|
70
|
+
], gt = {
|
|
71
|
+
sampling: [],
|
|
72
|
+
bus: [],
|
|
73
|
+
journey: [],
|
|
74
|
+
batching: [],
|
|
75
|
+
retention: [],
|
|
76
|
+
limits: [],
|
|
77
|
+
capture: ["webVitalsLoader"]
|
|
78
|
+
}, _t = "DEBUG", vt = 2e3, yt = 1e4, bt = 15e3, xt = 1024, St = "UiObservability", Ct = {
|
|
79
|
+
maxBatches: 500,
|
|
80
|
+
maxAgeMs: 864e5,
|
|
81
|
+
maxAttempts: 5
|
|
82
|
+
}, wt = 1e4, Tt = 2e3, Et = 6e4, Dt = 3e4, Q = 18e5, Ot = "__uiobs_journey", kt = "ui_observability_control", At = 1500, jt = 2e3, Mt = 5e3, $ = {
|
|
83
|
+
maxBodyChars: 4096,
|
|
84
|
+
maxAttributeChars: 8192,
|
|
85
|
+
maxAttributeCount: 128,
|
|
86
|
+
maxStackChars: 8192,
|
|
87
|
+
maxDepth: 6,
|
|
88
|
+
maxArrayLength: 100,
|
|
89
|
+
maxNodes: 1e4,
|
|
90
|
+
maxRecordBytes: 32768
|
|
91
|
+
}, Nt = {
|
|
92
|
+
endpoint: "",
|
|
93
|
+
metricsEndpoint: "",
|
|
94
|
+
tracesEndpoint: "",
|
|
95
|
+
serviceName: "",
|
|
96
|
+
serviceVersion: "",
|
|
97
|
+
environment: "",
|
|
98
|
+
enabled: !0,
|
|
99
|
+
minLevel: "INFO",
|
|
100
|
+
minLevels: {},
|
|
101
|
+
processors: [],
|
|
102
|
+
compression: "gzip",
|
|
103
|
+
credentials: "omit",
|
|
104
|
+
storage: "auto",
|
|
105
|
+
identity: "storage",
|
|
106
|
+
sampling: {
|
|
107
|
+
defaultRate: 1,
|
|
108
|
+
rates: {},
|
|
109
|
+
alwaysSampleTypes: ["action"],
|
|
110
|
+
remote: !1,
|
|
111
|
+
remoteMaxRate: 1
|
|
112
|
+
},
|
|
113
|
+
bus: {
|
|
114
|
+
mode: "auto",
|
|
115
|
+
trustedOrigins: [],
|
|
116
|
+
openFinRole: "auto"
|
|
117
|
+
},
|
|
118
|
+
journey: {
|
|
119
|
+
scope: "auto",
|
|
120
|
+
maxAgeMs: Q
|
|
121
|
+
},
|
|
122
|
+
batching: {
|
|
123
|
+
logFlushIntervalMs: vt,
|
|
124
|
+
logBatchSize: 100,
|
|
125
|
+
metricFlushIntervalMs: yt,
|
|
126
|
+
metricBatchSize: 500
|
|
127
|
+
},
|
|
128
|
+
retention: {
|
|
129
|
+
mode: "limited",
|
|
130
|
+
...Ct
|
|
131
|
+
},
|
|
132
|
+
limits: { ...$ },
|
|
133
|
+
capture: {
|
|
134
|
+
errors: !0,
|
|
135
|
+
rejections: !0,
|
|
136
|
+
resourceErrors: !1,
|
|
137
|
+
fetch: !1,
|
|
138
|
+
xhr: !1,
|
|
139
|
+
httpMetrics: !0,
|
|
140
|
+
interactions: !1,
|
|
141
|
+
navigation: !1,
|
|
142
|
+
webVitals: !1,
|
|
143
|
+
longFrames: !1,
|
|
144
|
+
longFrameThresholdMs: 100,
|
|
145
|
+
console: !1,
|
|
146
|
+
fullUrls: !1,
|
|
147
|
+
ignoreUrls: [],
|
|
148
|
+
propagateTraceHeaderTo: [],
|
|
149
|
+
webSocket: !1,
|
|
150
|
+
plugins: []
|
|
151
|
+
},
|
|
152
|
+
console: {
|
|
153
|
+
level: null,
|
|
154
|
+
styles: Z
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
//#endregion
|
|
158
|
+
export { Y as $, Dt as $t, _t as A, u as An, t as At, U as B, F as Bt, kt as C, Le as Cn, it as Ct, tt as D, mt as Dn, q as Dt, Ke as E, Ve as En, J as Et, Nt as F, dt as Ft, Mt as G, E as Gt, Ee as H, M as Ht, rt as I, ft as It, Be as J, P as Jt, Qe as K, D as Kt, te as L, pt as Lt, G as M, he as Mt, K as N, ye as Nt, xt as O, gt as On, je as Ot, pe as P, $ as Pt, ae as Q, Tt as Qt, X as R, bt as Rt, fe as S, Re as Sn, st as St, jt as T, Ze as Tn, a as Tt, _e as U, R as Ut, W as V, O as Vt, ue as W, L as Wt, ce as X, k as Xt, et as Y, j as Yt, se as Z, A as Zt, Ie as _, ve as _n, We as _t, C as a, re as an, be as at, Ne as b, z as bn, i as bt, y as c, d as cn, Oe as ct, p as d, wt as dn, Ot as dt, Et as en, oe as et, at as f, nt as fn, He as ft, Fe as g, Te as gn, Ye as gt, _ as h, we as hn, ee as ht, w as i, H as in, xe as it, Z as j, o as jn, me as jt, ht as k, ut as kn, Ae as kt, b as l, lt as ln, Q as lt, x as m, Ce as mn, Xe as mt, h as n, Je as nn, l as nt, S as o, e as on, r as ot, g as p, Se as pn, f as pt, ze as q, N as qt, T as r, s as rn, c as rt, v as s, ie as sn, ke as st, n as t, qe as tn, le as tt, m as u, St as un, De as ut, Pe as v, ne as vn, Ue as vt, At as w, ct as wn, de as wt, ge as x, B as xn, ot as xt, Me as y, V as yn, Ge as yt, $e as z, I as zt };
|
|
159
|
+
|
|
160
|
+
//# sourceMappingURL=constants-L_d5YvvQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-L_d5YvvQ.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","ECS_VERSION","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","JOURNEY_ID_PATTERN","JOURNEY_CLOCK_SKEW_MS","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","LOG_TYPE_ACTION","LOG_TYPE_SPAN","BUS_PROTOCOL","RUNTIME_GLOBAL_KEY","RUNTIME_STOPPED_KEY","LIBRARY_REQUEST_KEY","LIBRARY_CONSOLE_KEY","TRANSPORT_CALL_KEY","ERROR_STORM_WINDOW_MS","CONSOLE_DEFAULT_STYLES","DURATION_PRECISION","GAP_REPORT_THROTTLE_MS","CAPTURE_NAMESPACE","STORAGE_NAMESPACE","DEFAULT_METRIC_UNIT","METRIC_NAMESPACE","ATTR_METRIC_OVERFLOW","METRIC_DEFAULT_BOUNDARIES","METRIC_KEYS","TRACE_NAMESPACE","SPAN_KEYS","UNKNOWN_SERVICE_NAME","REMOTE_SAMPLING_MAX_CHARS","REMOTE_SAMPLING_MAX_TTL_MS","REMOTE_SAMPLING_POLL_MS","UNDEFAULTED_CONFIG_KEYS","CONFIG_SECTIONS","UNDEFAULTED_SECTION_KEYS","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","BUS_MAX_BOOT_BUFFER_ACTIONS","ERROR_DEDUPE_MS","RECORD_LIMITS","DEFAULT_CONFIG"],"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 build writes the version of package.json here.\n * @see {@link RESOURCE_TELEMETRY_SDK_VERSION}\n */\nexport const TELEMETRY_SDK_VERSION = __UIOBS_VERSION__;\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/** ECS version of the documents. The Elastic ECS logging libraries write this version. */\nexport const ECS_VERSION = \"8.10.0\";\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 length of a journey id from startJourney(), in characters. The token of a journey with this\n * id and a full name stays below the token limit.\n * @see {@link JOURNEY_TOKEN_MAX_CHARS}\n */\nexport const JOURNEY_ID_MAX_CHARS = 64;\n\n/**\n * Accepted journey id from startJourney(): letters, digits, \"_\", \".\", \":\" and \"-\". Each character\n * is one byte in UTF-8. A multibyte id makes the token larger than its limit.\n */\nexport const JOURNEY_ID_PATTERN = new RegExp(`^[\\\\w.:-]{1,${String(JOURNEY_ID_MAX_CHARS)}}$`);\n\n/**\n * Time that the start of a journey token can be ahead of this clock, in milliseconds. Two machines\n * can disagree on the time. A token further ahead never expires.\n */\nexport const JOURNEY_CLOCK_SKEW_MS = 5 * 60 * 1000;\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. A metric and a span are measurements.\n * The remote rate cap for records below minLevel does not apply to them.\n */\nexport const LEVEL_BYPASS_TYPES: readonly LogType[] = [\"action\", \"metric\", \"span\"];\n\n// ----------------------------------\n// Pipeline\n// ----------------------------------\n\n/** Record kind routed to the metric stream. */\nexport const LOG_TYPE_METRIC: LogType = \"metric\";\n\n/** Record kind of an audit fact. Storage and the hold buffers drop it last. */\nexport const LOG_TYPE_ACTION: LogType = \"action\";\n\n/** Record kind routed to the trace stream. */\nexport const LOG_TYPE_SPAN: LogType = \"span\";\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/** Global symbol key of the count of custom transport calls that wait for an answer. */\nexport const TRANSPORT_CALL_KEY = \"ui-observability.transport-calls\";\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 WebSocket events recorded in each storm window. A reconnect loop cannot flood the pipeline. */\nexport const WEBSOCKET_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/** Namespace of the points that the counter and histogram instruments give. */\nexport const METRIC_NAMESPACE = \"uiobs.metrics\";\n\n/** Maximum attribute sets of one instrument in one interval. More sets go to one overflow set. */\nexport const METRIC_MAX_SERIES = 100;\n\n/** Maximum bucket boundaries of one histogram. More boundaries make a large point. */\nexport const METRIC_MAX_BOUNDARIES = 50;\n\n/** Attribute of the overflow set. OpenTelemetry uses the same key. */\nexport const ATTR_METRIC_OVERFLOW = \"otel.metric.overflow\";\n\n/** Default histogram boundaries. They are the OpenTelemetry default boundaries. */\nexport const METRIC_DEFAULT_BOUNDARIES: readonly number[] = [\n 0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000,\n];\n\n/**\n * Attribute keys of an aggregated metric point. The OTLP metrics serializer reads them.\n * Sampling keeps each record with a start time. A sample of a sum gives a false sum.\n */\nexport const METRIC_KEYS = {\n start: \"metric.start_time_unix_nano\",\n attributeKeys: \"metric.attribute_keys\",\n count: \"metric.count\",\n sum: \"metric.sum\",\n min: \"metric.min\",\n max: \"metric.max\",\n bounds: \"metric.bounds\",\n buckets: \"metric.bucket_counts\",\n} as const;\n\n/** Namespace of the span records. */\nexport const TRACE_NAMESPACE = \"uiobs.traces\";\n\n/** Attribute keys of the span fields of a span record. The traces serializer reads them. */\nexport const SPAN_KEYS = {\n kind: \"span.kind\",\n parentId: \"span.parent_id\",\n start: \"span.start_time_unix_nano\",\n end: \"span.end_time_unix_nano\",\n status: \"span.status\",\n} as const;\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 \"contextProvider\",\n \"redact\",\n \"onDiagnostic\",\n \"onDrop\",\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 = [\n \"sampling\",\n \"bus\",\n \"journey\",\n \"batching\",\n \"retention\",\n \"limits\",\n \"capture\",\n] 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 batching: [],\n retention: [],\n limits: [],\n capture: [\"webVitalsLoader\"],\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 that are not actions in one hold buffer. A full buffer drops the oldest. */\nexport const BUS_MAX_BOOT_BUFFER_RECORDS = 500;\n\n/** Max action records in one hold buffer. Actions have their own cap. A log storm cannot push one out. */\nexport const BUS_MAX_BOOT_BUFFER_ACTIONS = 2000;\n\n/** Max different values in each list of an onDrop summary. */\nexport const DROP_SUMMARY_MAX_ITEMS = 20;\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\n// ----------------------------------\n// Config defaults\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 * It comes after the constants that it reads. A const cannot be read before its line.\n * @see {@link ResolvedConfig}\n * @see {@link UNDEFAULTED_CONFIG_KEYS}\n */\nexport const DEFAULT_CONFIG: Omit<ResolvedConfig, \"serializer\"> = {\n endpoint: \"\",\n metricsEndpoint: \"\",\n tracesEndpoint: \"\",\n serviceName: \"\",\n serviceVersion: \"\",\n environment: \"\",\n enabled: true,\n minLevel: \"INFO\",\n minLevels: {},\n processors: [],\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\", maxAgeMs: JOURNEY_MAX_AGE_MS },\n batching: {\n logFlushIntervalMs: LOG_FLUSH_INTERVAL_MS,\n logBatchSize: LOG_BATCH_SIZE,\n metricFlushIntervalMs: METRIC_FLUSH_INTERVAL_MS,\n metricBatchSize: METRIC_BATCH_SIZE,\n },\n retention: { mode: \"limited\", ...STORAGE_LIMITS },\n limits: { ...RECORD_LIMITS },\n capture: {\n errors: true,\n rejections: true,\n resourceErrors: false,\n fetch: false,\n xhr: false,\n httpMetrics: true,\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 webSocket: false,\n plugins: [],\n },\n console: { level: null, styles: CONSOLE_DEFAULT_STYLES },\n};\n"],"mappings":"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"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -162,6 +162,8 @@ export declare const SERIALIZER_NAME_ECS = "ecs";
|
|
|
162
162
|
* @see {@link SERIALIZER_NAME_ECS}
|
|
163
163
|
*/
|
|
164
164
|
export declare const ECS_LEVEL_NAMES: Partial<Record<LogLevel, string>>;
|
|
165
|
+
/** ECS version of the documents. The Elastic ECS logging libraries write this version. */
|
|
166
|
+
export declare const ECS_VERSION = "8.10.0";
|
|
165
167
|
/** Content type for an OTLP/JSON body. */
|
|
166
168
|
export declare const CONTENT_TYPE_JSON = "application/json";
|
|
167
169
|
/** Content type for newline-delimited JSON. */
|
|
@@ -277,6 +279,22 @@ export declare const JOURNEY_STORAGE_KEY = "ui-observability.journey";
|
|
|
277
279
|
* @see {@link JOURNEY_TOKEN_MAX_CHARS}
|
|
278
280
|
*/
|
|
279
281
|
export declare const JOURNEY_TOKEN_NAME_MAX_CHARS = 64;
|
|
282
|
+
/**
|
|
283
|
+
* Max length of a journey id from startJourney(), in characters. The token of a journey with this
|
|
284
|
+
* id and a full name stays below the token limit.
|
|
285
|
+
* @see {@link JOURNEY_TOKEN_MAX_CHARS}
|
|
286
|
+
*/
|
|
287
|
+
export declare const JOURNEY_ID_MAX_CHARS = 64;
|
|
288
|
+
/**
|
|
289
|
+
* Accepted journey id from startJourney(): letters, digits, "_", ".", ":" and "-". Each character
|
|
290
|
+
* is one byte in UTF-8. A multibyte id makes the token larger than its limit.
|
|
291
|
+
*/
|
|
292
|
+
export declare const JOURNEY_ID_PATTERN: RegExp;
|
|
293
|
+
/**
|
|
294
|
+
* Time that the start of a journey token can be ahead of this clock, in milliseconds. Two machines
|
|
295
|
+
* can disagree on the time. A token further ahead never expires.
|
|
296
|
+
*/
|
|
297
|
+
export declare const JOURNEY_CLOCK_SKEW_MS: number;
|
|
280
298
|
/**
|
|
281
299
|
* Max whole-token length, in characters. It rejects an oversized token. It does not
|
|
282
300
|
* validate the token content.
|
|
@@ -329,7 +347,7 @@ export declare const FNV_PRIME = 16777619;
|
|
|
329
347
|
/** Largest 32-bit unsigned value. */
|
|
330
348
|
export declare const UINT32_MAX = 4294967295;
|
|
331
349
|
/**
|
|
332
|
-
* Types that minLevel does not drop. An action is an audit fact and a
|
|
350
|
+
* Types that minLevel does not drop. An action is an audit fact. A metric and a span are measurements.
|
|
333
351
|
* The remote rate cap for records below minLevel does not apply to them.
|
|
334
352
|
*/
|
|
335
353
|
export declare const LEVEL_BYPASS_TYPES: readonly LogType[];
|
|
@@ -337,6 +355,8 @@ export declare const LEVEL_BYPASS_TYPES: readonly LogType[];
|
|
|
337
355
|
export declare const LOG_TYPE_METRIC: LogType;
|
|
338
356
|
/** Record kind of an audit fact. Storage and the hold buffers drop it last. */
|
|
339
357
|
export declare const LOG_TYPE_ACTION: LogType;
|
|
358
|
+
/** Record kind routed to the trace stream. */
|
|
359
|
+
export declare const LOG_TYPE_SPAN: LogType;
|
|
340
360
|
/** Protocol identifier for bus envelopes. The bus drops an envelope with a different version. */
|
|
341
361
|
export declare const BUS_PROTOCOL = "ui-observability/1";
|
|
342
362
|
/** Global window property key used to locate a same-origin runtime instance. */
|
|
@@ -363,6 +383,8 @@ export declare const ERROR_CEILING_MAX_PER_WINDOW = 500;
|
|
|
363
383
|
export declare const LONG_FRAME_THRESHOLD_MS = 100;
|
|
364
384
|
/** Maximum long frames recorded in each storm window. A frozen tab cannot flood the pipeline. */
|
|
365
385
|
export declare const LONG_FRAME_MAX_PER_WINDOW = 20;
|
|
386
|
+
/** Maximum WebSocket events recorded in each storm window. A reconnect loop cannot flood the pipeline. */
|
|
387
|
+
export declare const WEBSOCKET_MAX_PER_WINDOW = 20;
|
|
366
388
|
/** Maximum character length of a console breadcrumb message. */
|
|
367
389
|
export declare const CONSOLE_BREADCRUMB_MAX_CHARS = 200;
|
|
368
390
|
/** Maximum distinct error signatures tracked for deduplication before LRU eviction. */
|
|
@@ -409,6 +431,16 @@ export declare const METRIC_KEYS: {
|
|
|
409
431
|
readonly bounds: "metric.bounds";
|
|
410
432
|
readonly buckets: "metric.bucket_counts";
|
|
411
433
|
};
|
|
434
|
+
/** Namespace of the span records. */
|
|
435
|
+
export declare const TRACE_NAMESPACE = "uiobs.traces";
|
|
436
|
+
/** Attribute keys of the span fields of a span record. The traces serializer reads them. */
|
|
437
|
+
export declare const SPAN_KEYS: {
|
|
438
|
+
readonly kind: "span.kind";
|
|
439
|
+
readonly parentId: "span.parent_id";
|
|
440
|
+
readonly start: "span.start_time_unix_nano";
|
|
441
|
+
readonly end: "span.end_time_unix_nano";
|
|
442
|
+
readonly status: "span.status";
|
|
443
|
+
};
|
|
412
444
|
/** Default `service.name` when a consumer sets none. */
|
|
413
445
|
export declare const UNKNOWN_SERVICE_NAME = "unknown-service";
|
|
414
446
|
/** Lowest sampling rate (drop everything). */
|
|
@@ -434,7 +466,7 @@ export declare const REMOTE_SAMPLING_POLL_MS = 30000;
|
|
|
434
466
|
* Config keys with no default, excluded from `DEFAULT_CONFIG`.
|
|
435
467
|
* @see {@link DEFAULT_CONFIG}
|
|
436
468
|
*/
|
|
437
|
-
export declare const UNDEFAULTED_CONFIG_KEYS: readonly ["redact", "onDiagnostic", "onDrop", "headers", "serializer", "otelLoader", "transport", "transportOnExit"];
|
|
469
|
+
export declare const UNDEFAULTED_CONFIG_KEYS: readonly ["contextProvider", "redact", "onDiagnostic", "onDrop", "headers", "serializer", "otelLoader", "transport", "transportOnExit"];
|
|
438
470
|
/**
|
|
439
471
|
* Nested config section keys.
|
|
440
472
|
* @see {@link ResolvedConfig}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Category of a breadcrumb event. */
|
|
2
|
-
export type BreadcrumbCategory = "log" | "action" | "event" | "click" | "navigation" | "http" | "console" | "frame";
|
|
2
|
+
export type BreadcrumbCategory = "log" | "action" | "event" | "click" | "navigation" | "http" | "console" | "frame" | "custom";
|
|
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. */
|
|
@@ -33,6 +33,8 @@ export declare class BreadcrumbBuffer {
|
|
|
33
33
|
* @param crumb Breadcrumb to add.
|
|
34
34
|
*/
|
|
35
35
|
push(crumb: Breadcrumb): void;
|
|
36
|
+
/** Removes all breadcrumbs. A new session must not carry the trail of the previous user. */
|
|
37
|
+
clear(): void;
|
|
36
38
|
/**
|
|
37
39
|
* Returns all stored breadcrumbs ordered from oldest to newest.
|
|
38
40
|
* @returns List of breadcrumbs in time order.
|
|
@@ -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" | "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" | "capture.transport_request" | "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_processor" | "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" | "capture.transport_request" | "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. */
|
package/dist/core/journey.d.ts
CHANGED
|
@@ -68,6 +68,13 @@ export declare class JourneyEngine {
|
|
|
68
68
|
parent?: boolean;
|
|
69
69
|
id?: string;
|
|
70
70
|
}): Journey;
|
|
71
|
+
/**
|
|
72
|
+
* Gives the id of a new journey. A longer id, or an id with multibyte characters, makes the
|
|
73
|
+
* journey token too long for adoptJourney().
|
|
74
|
+
* @param requested Id from the app, or undefined.
|
|
75
|
+
* @returns The requested id when it matches JOURNEY_ID_PATTERN, else a new id.
|
|
76
|
+
*/
|
|
77
|
+
private journeyId;
|
|
71
78
|
/** Ends the active journey and broadcasts the change. */
|
|
72
79
|
end(): void;
|
|
73
80
|
/**
|
package/dist/core/meter.d.ts
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
import type { InstrumentDef, MetricAttributes } from "../models/metric";
|
|
1
|
+
import type { Counter, Histogram, HistogramOptions, InstrumentDef, InstrumentOptions, MetricAttributes } from "../models/metric";
|
|
2
2
|
import type { Diagnostics } from "./diagnostics";
|
|
3
|
+
/** Adds a value to an instrument of the runtime. */
|
|
4
|
+
export type RecordMetric = (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Makes a counter handle.
|
|
7
|
+
* @param name Metric name.
|
|
8
|
+
* @param options Unit of the values.
|
|
9
|
+
* @param record Adds a value to the instrument.
|
|
10
|
+
* @returns The counter.
|
|
11
|
+
*/
|
|
12
|
+
export declare function makeCounter(name: string, options: InstrumentOptions, record: RecordMetric): Counter;
|
|
13
|
+
/**
|
|
14
|
+
* Makes a histogram handle.
|
|
15
|
+
* @param name Metric name.
|
|
16
|
+
* @param options Unit of the values and the bucket boundaries.
|
|
17
|
+
* @param record Adds a value to the instrument.
|
|
18
|
+
* @returns The histogram.
|
|
19
|
+
*/
|
|
20
|
+
export declare function makeHistogram(name: string, options: HistogramOptions, record: RecordMetric): Histogram;
|
|
3
21
|
/** Sums the values of the counter and histogram instruments for one interval. */
|
|
4
22
|
export declare class Meter {
|
|
5
23
|
private readonly intervalMs;
|
package/dist/core/pipeline.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { BatchTransport } from "../transport/status-transport";
|
|
|
5
5
|
import type { RetryEngine } from "../transport/retry-engine";
|
|
6
6
|
import type { Diagnostics } from "./diagnostics";
|
|
7
7
|
/** Name of a pipeline stream. */
|
|
8
|
-
export type StreamName = "logs" | "metrics";
|
|
8
|
+
export type StreamName = "logs" | "metrics" | "traces";
|
|
9
9
|
/** Batching policy for one record stream. */
|
|
10
10
|
export interface StreamOptions {
|
|
11
11
|
/** Maximum time in milliseconds that a partial batch waits before the pipeline sends it. */
|
|
@@ -53,8 +53,8 @@ export declare class LogPipeline {
|
|
|
53
53
|
* Records already given to fetch go again under a new batch ID. The server cannot
|
|
54
54
|
* deduplicate them. Thus the exit flush can deliver duplicates. This is intentional.
|
|
55
55
|
* A closing document cannot confirm delivery.
|
|
56
|
-
* @returns One batch
|
|
57
|
-
*
|
|
56
|
+
* @returns One batch for each stream, metrics first. A stream with no records has no batch.
|
|
57
|
+
* A mixed batch sends a metric to the endpoint of the logs.
|
|
58
58
|
*/
|
|
59
59
|
drainForExit(): LogBatch[];
|
|
60
60
|
/**
|
|
@@ -64,6 +64,14 @@ export declare class LogPipeline {
|
|
|
64
64
|
* @returns Promise that resolves when the pipeline sends or stores each batch, or on destroy.
|
|
65
65
|
*/
|
|
66
66
|
flushPending(): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Counts the records that wait and the records in requests.
|
|
69
|
+
* @returns Records in the buffers and the queue, and records in dispatch.
|
|
70
|
+
*/
|
|
71
|
+
counts(): {
|
|
72
|
+
pending: number;
|
|
73
|
+
inFlight: number;
|
|
74
|
+
};
|
|
67
75
|
/** Stops the flush timers and refuses further records. */
|
|
68
76
|
destroy(): void;
|
|
69
77
|
/**
|
|
@@ -75,7 +83,7 @@ export declare class LogPipeline {
|
|
|
75
83
|
/**
|
|
76
84
|
* Sorts a record into its stream. Sampling already ran. RecordBuilder samples a local
|
|
77
85
|
* record. The runtime samples a forwarded record. This method catches each fault.
|
|
78
|
-
* A record without `attributes` makes
|
|
86
|
+
* A record without `attributes` makes streamOf throw. An uncaught throw goes into the
|
|
79
87
|
* log call of the caller.
|
|
80
88
|
* @param record Record to sort.
|
|
81
89
|
*/
|