@uipath/traces-tool 1.198.0-preview.95 → 1.198.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tool.js +257 -150
- package/package.json +2 -2
package/dist/tool.js
CHANGED
|
@@ -21230,7 +21230,7 @@ var init_server = __esm(() => {
|
|
|
21230
21230
|
var package_default = {
|
|
21231
21231
|
name: "@uipath/traces-tool",
|
|
21232
21232
|
license: "MIT",
|
|
21233
|
-
version: "1.198.0
|
|
21233
|
+
version: "1.198.0",
|
|
21234
21234
|
description: "Query execution traces for UiPath jobs",
|
|
21235
21235
|
private: false,
|
|
21236
21236
|
keywords: [
|
|
@@ -27404,11 +27404,36 @@ class NodeContextStorage {
|
|
|
27404
27404
|
return this.storage.getStore();
|
|
27405
27405
|
}
|
|
27406
27406
|
}
|
|
27407
|
+
// ../common/src/telemetry/trace-context.ts
|
|
27408
|
+
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
27409
|
+
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
27410
|
+
function getProcessEnv() {
|
|
27411
|
+
return globalThis.process?.env;
|
|
27412
|
+
}
|
|
27413
|
+
function parseInboundTraceparent(value) {
|
|
27414
|
+
if (!value) {
|
|
27415
|
+
return;
|
|
27416
|
+
}
|
|
27417
|
+
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
27418
|
+
if (!match) {
|
|
27419
|
+
return;
|
|
27420
|
+
}
|
|
27421
|
+
const [, traceId, parentSpanId] = match;
|
|
27422
|
+
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
27423
|
+
return;
|
|
27424
|
+
}
|
|
27425
|
+
return { traceId, parentSpanId };
|
|
27426
|
+
}
|
|
27427
|
+
function getInboundTraceContext() {
|
|
27428
|
+
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
27429
|
+
}
|
|
27430
|
+
|
|
27407
27431
|
// ../common/src/telemetry/session-id.ts
|
|
27408
27432
|
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
27409
27433
|
var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
|
|
27410
27434
|
var telemetrySessionIdSlot = singleton("TelemetrySessionId");
|
|
27411
|
-
|
|
27435
|
+
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
27436
|
+
function getProcessEnv2() {
|
|
27412
27437
|
return globalThis.process?.env;
|
|
27413
27438
|
}
|
|
27414
27439
|
function normalizeSessionId(value) {
|
|
@@ -27419,18 +27444,165 @@ function normalizeSessionId(value) {
|
|
|
27419
27444
|
return trimmed || undefined;
|
|
27420
27445
|
}
|
|
27421
27446
|
function getConfiguredTelemetrySessionId() {
|
|
27422
|
-
return normalizeSessionId(
|
|
27447
|
+
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
27423
27448
|
}
|
|
27424
27449
|
function resolveTelemetrySessionId(existingSessionId) {
|
|
27425
27450
|
return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
|
|
27426
27451
|
}
|
|
27452
|
+
function getTelemetryOperationId() {
|
|
27453
|
+
const existing = telemetryOperationIdSlot.get();
|
|
27454
|
+
if (existing) {
|
|
27455
|
+
return existing;
|
|
27456
|
+
}
|
|
27457
|
+
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
27458
|
+
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
27459
|
+
telemetryOperationIdSlot.set(generated);
|
|
27460
|
+
return generated;
|
|
27461
|
+
}
|
|
27427
27462
|
// ../common/src/telemetry/global-telemetry-properties.ts
|
|
27428
27463
|
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
27429
27464
|
function getGlobalTelemetryProperties() {
|
|
27430
27465
|
return telemetryPropsSlot.get();
|
|
27431
27466
|
}
|
|
27432
27467
|
|
|
27468
|
+
// ../common/src/telemetry/pii-redactor.ts
|
|
27469
|
+
var REDACTED = "[REDACTED]";
|
|
27470
|
+
var MAX_VALUE_LENGTH = 200;
|
|
27471
|
+
var SENSITIVE_NAME_TOKENS = new Set([
|
|
27472
|
+
"token",
|
|
27473
|
+
"tokens",
|
|
27474
|
+
"secret",
|
|
27475
|
+
"secrets",
|
|
27476
|
+
"password",
|
|
27477
|
+
"passwords",
|
|
27478
|
+
"pwd",
|
|
27479
|
+
"credential",
|
|
27480
|
+
"credentials",
|
|
27481
|
+
"auth",
|
|
27482
|
+
"authentication",
|
|
27483
|
+
"authorization",
|
|
27484
|
+
"authority",
|
|
27485
|
+
"cert",
|
|
27486
|
+
"certificate",
|
|
27487
|
+
"certificates"
|
|
27488
|
+
]);
|
|
27489
|
+
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
27490
|
+
"api",
|
|
27491
|
+
"access",
|
|
27492
|
+
"client",
|
|
27493
|
+
"private",
|
|
27494
|
+
"public",
|
|
27495
|
+
"signing",
|
|
27496
|
+
"encryption",
|
|
27497
|
+
"session",
|
|
27498
|
+
"master",
|
|
27499
|
+
"shared",
|
|
27500
|
+
"root",
|
|
27501
|
+
"ssh",
|
|
27502
|
+
"rsa",
|
|
27503
|
+
"aes",
|
|
27504
|
+
"hmac",
|
|
27505
|
+
"oauth"
|
|
27506
|
+
]);
|
|
27507
|
+
var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
|
|
27508
|
+
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
27509
|
+
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
27510
|
+
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
27511
|
+
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
27512
|
+
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
27513
|
+
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
27514
|
+
function shortHash(input) {
|
|
27515
|
+
let hash = 2166136261;
|
|
27516
|
+
for (let i = 0;i < input.length; i++) {
|
|
27517
|
+
hash ^= input.charCodeAt(i);
|
|
27518
|
+
hash = Math.imul(hash, 16777619);
|
|
27519
|
+
}
|
|
27520
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
27521
|
+
}
|
|
27522
|
+
function redactUrl(raw) {
|
|
27523
|
+
try {
|
|
27524
|
+
const url = new URL(raw);
|
|
27525
|
+
return `${url.protocol}//${url.host}`;
|
|
27526
|
+
} catch {
|
|
27527
|
+
return `url#${shortHash(raw)}`;
|
|
27528
|
+
}
|
|
27529
|
+
}
|
|
27530
|
+
function redactValueDetectors(value) {
|
|
27531
|
+
let out = value;
|
|
27532
|
+
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
27533
|
+
out = out.replace(URL_PATTERN, (match) => {
|
|
27534
|
+
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
27535
|
+
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
27536
|
+
return `${redactUrl(core2)}${trailing}`;
|
|
27537
|
+
});
|
|
27538
|
+
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
27539
|
+
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
27540
|
+
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
27541
|
+
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
27542
|
+
if (out.length > MAX_VALUE_LENGTH) {
|
|
27543
|
+
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
27544
|
+
}
|
|
27545
|
+
return out;
|
|
27546
|
+
}
|
|
27547
|
+
function redactValue(value) {
|
|
27548
|
+
return redactValueDetectors(value);
|
|
27549
|
+
}
|
|
27550
|
+
function redactError(error) {
|
|
27551
|
+
const safe = new Error(redactValueDetectors(error.message ?? ""));
|
|
27552
|
+
safe.name = error.name;
|
|
27553
|
+
safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
|
|
27554
|
+
return safe;
|
|
27555
|
+
}
|
|
27556
|
+
function nameTokens(name) {
|
|
27557
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s._-]+/).map((t) => t.toLowerCase()).filter(Boolean);
|
|
27558
|
+
}
|
|
27559
|
+
function isSensitiveName(name) {
|
|
27560
|
+
const tokens = nameTokens(name);
|
|
27561
|
+
for (let i = 0;i < tokens.length; i++) {
|
|
27562
|
+
const token = tokens[i];
|
|
27563
|
+
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
27564
|
+
return true;
|
|
27565
|
+
}
|
|
27566
|
+
if (token === "key" || token === "keys") {
|
|
27567
|
+
const prev = tokens[i - 1];
|
|
27568
|
+
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
27569
|
+
return true;
|
|
27570
|
+
}
|
|
27571
|
+
}
|
|
27572
|
+
}
|
|
27573
|
+
return false;
|
|
27574
|
+
}
|
|
27575
|
+
function redactProperty(name, value) {
|
|
27576
|
+
if (value === undefined || value === null) {
|
|
27577
|
+
return;
|
|
27578
|
+
}
|
|
27579
|
+
if (isSensitiveName(name)) {
|
|
27580
|
+
return REDACTED;
|
|
27581
|
+
}
|
|
27582
|
+
if (typeof value === "boolean" || typeof value === "number") {
|
|
27583
|
+
return value;
|
|
27584
|
+
}
|
|
27585
|
+
if (typeof value !== "string") {
|
|
27586
|
+
return "[OBJECT]";
|
|
27587
|
+
}
|
|
27588
|
+
return redactValueDetectors(value);
|
|
27589
|
+
}
|
|
27590
|
+
function redactProperties(properties) {
|
|
27591
|
+
const out = {};
|
|
27592
|
+
for (const [name, value] of Object.entries(properties)) {
|
|
27593
|
+
const redacted = redactProperty(name, value);
|
|
27594
|
+
if (redacted !== undefined) {
|
|
27595
|
+
out[name] = redacted;
|
|
27596
|
+
}
|
|
27597
|
+
}
|
|
27598
|
+
return out;
|
|
27599
|
+
}
|
|
27600
|
+
|
|
27433
27601
|
// ../common/src/telemetry/telemetry-service.ts
|
|
27602
|
+
var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
|
|
27603
|
+
var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
|
|
27604
|
+
var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
|
|
27605
|
+
|
|
27434
27606
|
class TelemetryService {
|
|
27435
27607
|
telemetryProvider;
|
|
27436
27608
|
contextStorage;
|
|
@@ -27457,11 +27629,15 @@ class TelemetryService {
|
|
|
27457
27629
|
trackException(error, properties) {
|
|
27458
27630
|
const context = this.getCurrentContext();
|
|
27459
27631
|
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
27460
|
-
this.telemetryProvider.trackException(error, enrichedProperties);
|
|
27632
|
+
this.telemetryProvider.trackException(redactError(error), enrichedProperties);
|
|
27461
27633
|
}
|
|
27462
27634
|
async trackRequest(name, fn, properties) {
|
|
27635
|
+
const parentContext = this.getCurrentContext();
|
|
27636
|
+
const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
|
|
27637
|
+
const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
|
|
27463
27638
|
const context = {
|
|
27464
|
-
operationId
|
|
27639
|
+
operationId,
|
|
27640
|
+
...parentId !== undefined ? { parentId } : {},
|
|
27465
27641
|
id: this.generateId()
|
|
27466
27642
|
};
|
|
27467
27643
|
const startTime = performance.now();
|
|
@@ -27479,6 +27655,45 @@ class TelemetryService {
|
|
|
27479
27655
|
throw error;
|
|
27480
27656
|
}
|
|
27481
27657
|
}
|
|
27658
|
+
trackRequestResult(name, durationMs, success, properties, context) {
|
|
27659
|
+
const requestContext = context ?? {
|
|
27660
|
+
operationId: this.operationId ?? getTelemetryOperationId(),
|
|
27661
|
+
id: this.generateId()
|
|
27662
|
+
};
|
|
27663
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
|
|
27664
|
+
this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
|
|
27665
|
+
}
|
|
27666
|
+
createRequestContext() {
|
|
27667
|
+
const operationId = this.operationId ?? getTelemetryOperationId();
|
|
27668
|
+
const parentId = this.inboundParentIdFor(operationId);
|
|
27669
|
+
return {
|
|
27670
|
+
operationId,
|
|
27671
|
+
...parentId !== undefined ? { parentId } : {},
|
|
27672
|
+
id: this.generateId()
|
|
27673
|
+
};
|
|
27674
|
+
}
|
|
27675
|
+
inboundParentIdFor(operationId) {
|
|
27676
|
+
const inbound = getInboundTraceContext();
|
|
27677
|
+
return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
|
|
27678
|
+
}
|
|
27679
|
+
runWithContext(context, fn) {
|
|
27680
|
+
return this.contextStorage.run(context, fn);
|
|
27681
|
+
}
|
|
27682
|
+
createDependencyContext() {
|
|
27683
|
+
const parentContext = this.getCurrentContext();
|
|
27684
|
+
if (!parentContext) {
|
|
27685
|
+
return;
|
|
27686
|
+
}
|
|
27687
|
+
return {
|
|
27688
|
+
operationId: parentContext.operationId,
|
|
27689
|
+
parentId: parentContext.id,
|
|
27690
|
+
id: this.generateId()
|
|
27691
|
+
};
|
|
27692
|
+
}
|
|
27693
|
+
trackDependencyResult(name, type2, durationMs, success, properties, context, resultCode) {
|
|
27694
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
27695
|
+
this.telemetryProvider.trackDependency(redactValue(name), type2, durationMs, success, enrichedProperties, resultCode);
|
|
27696
|
+
}
|
|
27482
27697
|
async trackDependencyOperation(name, type2, fn, properties) {
|
|
27483
27698
|
const parentContext = this.getCurrentContext();
|
|
27484
27699
|
if (!parentContext) {
|
|
@@ -27515,8 +27730,12 @@ class TelemetryService {
|
|
|
27515
27730
|
...getExecutionContextTelemetryProperties(),
|
|
27516
27731
|
...globalProperties,
|
|
27517
27732
|
...this.defaultProperties,
|
|
27518
|
-
...properties,
|
|
27519
|
-
...context
|
|
27733
|
+
...redactProperties(properties ?? {}),
|
|
27734
|
+
...context ? {
|
|
27735
|
+
[TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
|
|
27736
|
+
...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
|
|
27737
|
+
[TELEMETRY_SPAN_ID_PROPERTY]: context.id
|
|
27738
|
+
} : {}
|
|
27520
27739
|
};
|
|
27521
27740
|
if (sessionId === undefined) {
|
|
27522
27741
|
delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
|
|
@@ -27526,7 +27745,16 @@ class TelemetryService {
|
|
|
27526
27745
|
return enriched;
|
|
27527
27746
|
}
|
|
27528
27747
|
generateId() {
|
|
27529
|
-
|
|
27748
|
+
const bytes = new Uint8Array(8);
|
|
27749
|
+
let hex = "";
|
|
27750
|
+
do {
|
|
27751
|
+
crypto.getRandomValues(bytes);
|
|
27752
|
+
hex = "";
|
|
27753
|
+
for (const byte of bytes) {
|
|
27754
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
27755
|
+
}
|
|
27756
|
+
} while (/^0+$/.test(hex));
|
|
27757
|
+
return hex;
|
|
27530
27758
|
}
|
|
27531
27759
|
}
|
|
27532
27760
|
// ../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
@@ -28228,134 +28456,11 @@ function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
|
28228
28456
|
};
|
|
28229
28457
|
}
|
|
28230
28458
|
|
|
28231
|
-
// ../common/src/telemetry/pii-redactor.ts
|
|
28232
|
-
var REDACTED = "[REDACTED]";
|
|
28233
|
-
var MAX_VALUE_LENGTH = 200;
|
|
28234
|
-
var SENSITIVE_NAME_TOKENS = new Set([
|
|
28235
|
-
"token",
|
|
28236
|
-
"tokens",
|
|
28237
|
-
"secret",
|
|
28238
|
-
"secrets",
|
|
28239
|
-
"password",
|
|
28240
|
-
"passwords",
|
|
28241
|
-
"pwd",
|
|
28242
|
-
"credential",
|
|
28243
|
-
"credentials",
|
|
28244
|
-
"auth",
|
|
28245
|
-
"authentication",
|
|
28246
|
-
"authorization",
|
|
28247
|
-
"authority",
|
|
28248
|
-
"cert",
|
|
28249
|
-
"certificate",
|
|
28250
|
-
"certificates"
|
|
28251
|
-
]);
|
|
28252
|
-
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
28253
|
-
"api",
|
|
28254
|
-
"access",
|
|
28255
|
-
"client",
|
|
28256
|
-
"private",
|
|
28257
|
-
"public",
|
|
28258
|
-
"signing",
|
|
28259
|
-
"encryption",
|
|
28260
|
-
"session",
|
|
28261
|
-
"master",
|
|
28262
|
-
"shared",
|
|
28263
|
-
"root",
|
|
28264
|
-
"ssh",
|
|
28265
|
-
"rsa",
|
|
28266
|
-
"aes",
|
|
28267
|
-
"hmac",
|
|
28268
|
-
"oauth"
|
|
28269
|
-
]);
|
|
28270
|
-
var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
|
|
28271
|
-
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
28272
|
-
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
28273
|
-
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
28274
|
-
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
28275
|
-
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
28276
|
-
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
28277
|
-
function shortHash(input) {
|
|
28278
|
-
let hash = 2166136261;
|
|
28279
|
-
for (let i = 0;i < input.length; i++) {
|
|
28280
|
-
hash ^= input.charCodeAt(i);
|
|
28281
|
-
hash = Math.imul(hash, 16777619);
|
|
28282
|
-
}
|
|
28283
|
-
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
28284
|
-
}
|
|
28285
|
-
function redactUrl(raw) {
|
|
28286
|
-
try {
|
|
28287
|
-
const url = new URL(raw);
|
|
28288
|
-
return `${url.protocol}//${url.host}`;
|
|
28289
|
-
} catch {
|
|
28290
|
-
return `url#${shortHash(raw)}`;
|
|
28291
|
-
}
|
|
28292
|
-
}
|
|
28293
|
-
function redactValueDetectors(value) {
|
|
28294
|
-
let out = value;
|
|
28295
|
-
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
28296
|
-
out = out.replace(URL_PATTERN, (match) => {
|
|
28297
|
-
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
28298
|
-
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
28299
|
-
return `${redactUrl(core2)}${trailing}`;
|
|
28300
|
-
});
|
|
28301
|
-
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
28302
|
-
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
28303
|
-
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
28304
|
-
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
28305
|
-
if (out.length > MAX_VALUE_LENGTH) {
|
|
28306
|
-
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
28307
|
-
}
|
|
28308
|
-
return out;
|
|
28309
|
-
}
|
|
28310
|
-
function nameTokens(name) {
|
|
28311
|
-
return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s_-]+/).map((t) => t.toLowerCase()).filter(Boolean);
|
|
28312
|
-
}
|
|
28313
|
-
function isSensitiveName(name) {
|
|
28314
|
-
const tokens = nameTokens(name);
|
|
28315
|
-
for (let i = 0;i < tokens.length; i++) {
|
|
28316
|
-
const token = tokens[i];
|
|
28317
|
-
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
28318
|
-
return true;
|
|
28319
|
-
}
|
|
28320
|
-
if (token === "key" || token === "keys") {
|
|
28321
|
-
const prev = tokens[i - 1];
|
|
28322
|
-
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
28323
|
-
return true;
|
|
28324
|
-
}
|
|
28325
|
-
}
|
|
28326
|
-
}
|
|
28327
|
-
return false;
|
|
28328
|
-
}
|
|
28329
|
-
function redactProperty(name, value) {
|
|
28330
|
-
if (value === undefined || value === null) {
|
|
28331
|
-
return;
|
|
28332
|
-
}
|
|
28333
|
-
if (isSensitiveName(name)) {
|
|
28334
|
-
return REDACTED;
|
|
28335
|
-
}
|
|
28336
|
-
if (typeof value === "boolean" || typeof value === "number") {
|
|
28337
|
-
return value;
|
|
28338
|
-
}
|
|
28339
|
-
if (typeof value !== "string") {
|
|
28340
|
-
return "[OBJECT]";
|
|
28341
|
-
}
|
|
28342
|
-
return redactValueDetectors(value);
|
|
28343
|
-
}
|
|
28344
|
-
function redactProperties(properties) {
|
|
28345
|
-
const out = {};
|
|
28346
|
-
for (const [name, value] of Object.entries(properties)) {
|
|
28347
|
-
const redacted = redactProperty(name, value);
|
|
28348
|
-
if (redacted !== undefined) {
|
|
28349
|
-
out[name] = redacted;
|
|
28350
|
-
}
|
|
28351
|
-
}
|
|
28352
|
-
return out;
|
|
28353
|
-
}
|
|
28354
|
-
|
|
28355
28459
|
// ../common/src/trackedAction.ts
|
|
28356
28460
|
var pollSignalSlot = singleton("PollSignal");
|
|
28357
28461
|
var cliErrorCodeValues = new Set(CLI_ERROR_CODES);
|
|
28358
28462
|
var retryHintValues = new Set(RETRY_HINTS);
|
|
28463
|
+
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
28359
28464
|
var processContext = {
|
|
28360
28465
|
exit: (code) => {
|
|
28361
28466
|
process.exitCode = code;
|
|
@@ -28366,22 +28471,18 @@ var processContext = {
|
|
|
28366
28471
|
};
|
|
28367
28472
|
function extractCommandParams(cmd) {
|
|
28368
28473
|
const params = {};
|
|
28474
|
+
const add2 = (name, value) => {
|
|
28475
|
+
if (name && value !== undefined) {
|
|
28476
|
+
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = value;
|
|
28477
|
+
}
|
|
28478
|
+
};
|
|
28369
28479
|
const registered = cmd.registeredArguments ?? [];
|
|
28370
28480
|
const processed = cmd.processedArgs ?? [];
|
|
28371
28481
|
for (let i = 0;i < registered.length; i++) {
|
|
28372
|
-
|
|
28373
|
-
if (value === undefined) {
|
|
28374
|
-
continue;
|
|
28375
|
-
}
|
|
28376
|
-
const name = registered[i].name();
|
|
28377
|
-
if (name) {
|
|
28378
|
-
params[name] = value;
|
|
28379
|
-
}
|
|
28482
|
+
add2(registered[i].name(), processed[i]);
|
|
28380
28483
|
}
|
|
28381
28484
|
for (const [key, value] of Object.entries(cmd.opts())) {
|
|
28382
|
-
|
|
28383
|
-
params[key] = value;
|
|
28384
|
-
}
|
|
28485
|
+
add2(key, value);
|
|
28385
28486
|
}
|
|
28386
28487
|
return params;
|
|
28387
28488
|
}
|
|
@@ -28424,11 +28525,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
28424
28525
|
return this.action(async (...args) => {
|
|
28425
28526
|
const telemetryName = deriveCommandPath(command);
|
|
28426
28527
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
28528
|
+
const requestContext = telemetry.createRequestContext();
|
|
28427
28529
|
const startTime = performance.now();
|
|
28428
28530
|
let errorMessage;
|
|
28429
28531
|
let fallbackExitCode = EXIT_CODES.Success;
|
|
28430
28532
|
clearRecordedCommandFailureTelemetry();
|
|
28431
|
-
const [error] = await catchError(fn(...args));
|
|
28533
|
+
const [error] = await catchError(telemetry.runWithContext(requestContext, () => fn(...args)));
|
|
28432
28534
|
if (error) {
|
|
28433
28535
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
28434
28536
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
@@ -28464,16 +28566,21 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
28464
28566
|
recordedFailure,
|
|
28465
28567
|
pollSignal: context.pollSignal
|
|
28466
28568
|
});
|
|
28467
|
-
|
|
28468
|
-
|
|
28569
|
+
const commandParams = extractCommandParams(command);
|
|
28570
|
+
if (props) {
|
|
28571
|
+
for (const key of Object.keys(props)) {
|
|
28572
|
+
delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
|
|
28573
|
+
}
|
|
28574
|
+
}
|
|
28575
|
+
const baseProperties = redactProperties({
|
|
28576
|
+
...commandParams,
|
|
28469
28577
|
...props,
|
|
28470
28578
|
...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
|
|
28471
28579
|
command: "true",
|
|
28472
|
-
duration: String(durationMs),
|
|
28473
|
-
success: String(success),
|
|
28474
28580
|
...terminalTelemetry,
|
|
28475
28581
|
...errorMessage ? { errorMessage } : {}
|
|
28476
|
-
})
|
|
28582
|
+
});
|
|
28583
|
+
telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
|
|
28477
28584
|
});
|
|
28478
28585
|
};
|
|
28479
28586
|
|
|
@@ -34838,4 +34945,4 @@ export {
|
|
|
34838
34945
|
metadata
|
|
34839
34946
|
};
|
|
34840
34947
|
|
|
34841
|
-
//# debugId=
|
|
34948
|
+
//# debugId=0C38F450C5CD249264756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/traces-tool",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.198.0
|
|
4
|
+
"version": "1.198.0",
|
|
5
5
|
"description": "Query execution traces for UiPath jobs",
|
|
6
6
|
"private": false,
|
|
7
7
|
"keywords": [
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"registry": "https://registry.npmjs.org/"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "1fadf03d7a8dd102742571dff569fdac11808afb"
|
|
25
25
|
}
|