@uipath/insights-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
|
@@ -2128,7 +2128,7 @@ var require_commander = __commonJS((exports) => {
|
|
|
2128
2128
|
var package_default = {
|
|
2129
2129
|
name: "@uipath/insights-tool",
|
|
2130
2130
|
license: "MIT",
|
|
2131
|
-
version: "1.198.0
|
|
2131
|
+
version: "1.198.0",
|
|
2132
2132
|
description: "Query UiPath Insights data — jobs, failures, and performance metrics.",
|
|
2133
2133
|
private: false,
|
|
2134
2134
|
repository: {
|
|
@@ -8865,11 +8865,36 @@ class NodeContextStorage {
|
|
|
8865
8865
|
return this.storage.getStore();
|
|
8866
8866
|
}
|
|
8867
8867
|
}
|
|
8868
|
+
// ../common/src/telemetry/trace-context.ts
|
|
8869
|
+
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
8870
|
+
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
8871
|
+
function getProcessEnv() {
|
|
8872
|
+
return globalThis.process?.env;
|
|
8873
|
+
}
|
|
8874
|
+
function parseInboundTraceparent(value) {
|
|
8875
|
+
if (!value) {
|
|
8876
|
+
return;
|
|
8877
|
+
}
|
|
8878
|
+
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
8879
|
+
if (!match) {
|
|
8880
|
+
return;
|
|
8881
|
+
}
|
|
8882
|
+
const [, traceId, parentSpanId] = match;
|
|
8883
|
+
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
8884
|
+
return;
|
|
8885
|
+
}
|
|
8886
|
+
return { traceId, parentSpanId };
|
|
8887
|
+
}
|
|
8888
|
+
function getInboundTraceContext() {
|
|
8889
|
+
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
8890
|
+
}
|
|
8891
|
+
|
|
8868
8892
|
// ../common/src/telemetry/session-id.ts
|
|
8869
8893
|
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
8870
8894
|
var TELEMETRY_SESSION_ID_PROPERTY = "session_id";
|
|
8871
8895
|
var telemetrySessionIdSlot = singleton("TelemetrySessionId");
|
|
8872
|
-
|
|
8896
|
+
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
8897
|
+
function getProcessEnv2() {
|
|
8873
8898
|
return globalThis.process?.env;
|
|
8874
8899
|
}
|
|
8875
8900
|
function normalizeSessionId(value) {
|
|
@@ -8880,18 +8905,165 @@ function normalizeSessionId(value) {
|
|
|
8880
8905
|
return trimmed || undefined;
|
|
8881
8906
|
}
|
|
8882
8907
|
function getConfiguredTelemetrySessionId() {
|
|
8883
|
-
return normalizeSessionId(
|
|
8908
|
+
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
8884
8909
|
}
|
|
8885
8910
|
function resolveTelemetrySessionId(existingSessionId) {
|
|
8886
8911
|
return getConfiguredTelemetrySessionId() ?? normalizeSessionId(existingSessionId);
|
|
8887
8912
|
}
|
|
8913
|
+
function getTelemetryOperationId() {
|
|
8914
|
+
const existing = telemetryOperationIdSlot.get();
|
|
8915
|
+
if (existing) {
|
|
8916
|
+
return existing;
|
|
8917
|
+
}
|
|
8918
|
+
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
8919
|
+
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
8920
|
+
telemetryOperationIdSlot.set(generated);
|
|
8921
|
+
return generated;
|
|
8922
|
+
}
|
|
8888
8923
|
// ../common/src/telemetry/global-telemetry-properties.ts
|
|
8889
8924
|
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
8890
8925
|
function getGlobalTelemetryProperties() {
|
|
8891
8926
|
return telemetryPropsSlot.get();
|
|
8892
8927
|
}
|
|
8893
8928
|
|
|
8929
|
+
// ../common/src/telemetry/pii-redactor.ts
|
|
8930
|
+
var REDACTED = "[REDACTED]";
|
|
8931
|
+
var MAX_VALUE_LENGTH = 200;
|
|
8932
|
+
var SENSITIVE_NAME_TOKENS = new Set([
|
|
8933
|
+
"token",
|
|
8934
|
+
"tokens",
|
|
8935
|
+
"secret",
|
|
8936
|
+
"secrets",
|
|
8937
|
+
"password",
|
|
8938
|
+
"passwords",
|
|
8939
|
+
"pwd",
|
|
8940
|
+
"credential",
|
|
8941
|
+
"credentials",
|
|
8942
|
+
"auth",
|
|
8943
|
+
"authentication",
|
|
8944
|
+
"authorization",
|
|
8945
|
+
"authority",
|
|
8946
|
+
"cert",
|
|
8947
|
+
"certificate",
|
|
8948
|
+
"certificates"
|
|
8949
|
+
]);
|
|
8950
|
+
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
8951
|
+
"api",
|
|
8952
|
+
"access",
|
|
8953
|
+
"client",
|
|
8954
|
+
"private",
|
|
8955
|
+
"public",
|
|
8956
|
+
"signing",
|
|
8957
|
+
"encryption",
|
|
8958
|
+
"session",
|
|
8959
|
+
"master",
|
|
8960
|
+
"shared",
|
|
8961
|
+
"root",
|
|
8962
|
+
"ssh",
|
|
8963
|
+
"rsa",
|
|
8964
|
+
"aes",
|
|
8965
|
+
"hmac",
|
|
8966
|
+
"oauth"
|
|
8967
|
+
]);
|
|
8968
|
+
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;
|
|
8969
|
+
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
8970
|
+
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
8971
|
+
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
8972
|
+
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
8973
|
+
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
8974
|
+
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
8975
|
+
function shortHash(input) {
|
|
8976
|
+
let hash = 2166136261;
|
|
8977
|
+
for (let i = 0;i < input.length; i++) {
|
|
8978
|
+
hash ^= input.charCodeAt(i);
|
|
8979
|
+
hash = Math.imul(hash, 16777619);
|
|
8980
|
+
}
|
|
8981
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
8982
|
+
}
|
|
8983
|
+
function redactUrl(raw) {
|
|
8984
|
+
try {
|
|
8985
|
+
const url = new URL(raw);
|
|
8986
|
+
return `${url.protocol}//${url.host}`;
|
|
8987
|
+
} catch {
|
|
8988
|
+
return `url#${shortHash(raw)}`;
|
|
8989
|
+
}
|
|
8990
|
+
}
|
|
8991
|
+
function redactValueDetectors(value) {
|
|
8992
|
+
let out = value;
|
|
8993
|
+
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
8994
|
+
out = out.replace(URL_PATTERN, (match) => {
|
|
8995
|
+
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
8996
|
+
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
8997
|
+
return `${redactUrl(core2)}${trailing}`;
|
|
8998
|
+
});
|
|
8999
|
+
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
9000
|
+
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
9001
|
+
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
9002
|
+
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
9003
|
+
if (out.length > MAX_VALUE_LENGTH) {
|
|
9004
|
+
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
9005
|
+
}
|
|
9006
|
+
return out;
|
|
9007
|
+
}
|
|
9008
|
+
function redactValue(value) {
|
|
9009
|
+
return redactValueDetectors(value);
|
|
9010
|
+
}
|
|
9011
|
+
function redactError(error) {
|
|
9012
|
+
const safe = new Error(redactValueDetectors(error.message ?? ""));
|
|
9013
|
+
safe.name = error.name;
|
|
9014
|
+
safe.stack = typeof error.stack === "string" ? redactValueDetectors(error.stack) : undefined;
|
|
9015
|
+
return safe;
|
|
9016
|
+
}
|
|
9017
|
+
function nameTokens(name) {
|
|
9018
|
+
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);
|
|
9019
|
+
}
|
|
9020
|
+
function isSensitiveName(name) {
|
|
9021
|
+
const tokens = nameTokens(name);
|
|
9022
|
+
for (let i = 0;i < tokens.length; i++) {
|
|
9023
|
+
const token = tokens[i];
|
|
9024
|
+
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
9025
|
+
return true;
|
|
9026
|
+
}
|
|
9027
|
+
if (token === "key" || token === "keys") {
|
|
9028
|
+
const prev = tokens[i - 1];
|
|
9029
|
+
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
9030
|
+
return true;
|
|
9031
|
+
}
|
|
9032
|
+
}
|
|
9033
|
+
}
|
|
9034
|
+
return false;
|
|
9035
|
+
}
|
|
9036
|
+
function redactProperty(name, value) {
|
|
9037
|
+
if (value === undefined || value === null) {
|
|
9038
|
+
return;
|
|
9039
|
+
}
|
|
9040
|
+
if (isSensitiveName(name)) {
|
|
9041
|
+
return REDACTED;
|
|
9042
|
+
}
|
|
9043
|
+
if (typeof value === "boolean" || typeof value === "number") {
|
|
9044
|
+
return value;
|
|
9045
|
+
}
|
|
9046
|
+
if (typeof value !== "string") {
|
|
9047
|
+
return "[OBJECT]";
|
|
9048
|
+
}
|
|
9049
|
+
return redactValueDetectors(value);
|
|
9050
|
+
}
|
|
9051
|
+
function redactProperties(properties) {
|
|
9052
|
+
const out = {};
|
|
9053
|
+
for (const [name, value] of Object.entries(properties)) {
|
|
9054
|
+
const redacted = redactProperty(name, value);
|
|
9055
|
+
if (redacted !== undefined) {
|
|
9056
|
+
out[name] = redacted;
|
|
9057
|
+
}
|
|
9058
|
+
}
|
|
9059
|
+
return out;
|
|
9060
|
+
}
|
|
9061
|
+
|
|
8894
9062
|
// ../common/src/telemetry/telemetry-service.ts
|
|
9063
|
+
var TELEMETRY_OPERATION_ID_PROPERTY = "uip.trace.operation_id";
|
|
9064
|
+
var TELEMETRY_PARENT_ID_PROPERTY = "uip.trace.parent_id";
|
|
9065
|
+
var TELEMETRY_SPAN_ID_PROPERTY = "uip.trace.span_id";
|
|
9066
|
+
|
|
8895
9067
|
class TelemetryService {
|
|
8896
9068
|
telemetryProvider;
|
|
8897
9069
|
contextStorage;
|
|
@@ -8918,11 +9090,15 @@ class TelemetryService {
|
|
|
8918
9090
|
trackException(error, properties) {
|
|
8919
9091
|
const context = this.getCurrentContext();
|
|
8920
9092
|
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
8921
|
-
this.telemetryProvider.trackException(error, enrichedProperties);
|
|
9093
|
+
this.telemetryProvider.trackException(redactError(error), enrichedProperties);
|
|
8922
9094
|
}
|
|
8923
9095
|
async trackRequest(name, fn, properties) {
|
|
9096
|
+
const parentContext = this.getCurrentContext();
|
|
9097
|
+
const operationId = parentContext?.operationId ?? this.operationId ?? getTelemetryOperationId();
|
|
9098
|
+
const parentId = parentContext ? parentContext.id : this.inboundParentIdFor(operationId);
|
|
8924
9099
|
const context = {
|
|
8925
|
-
operationId
|
|
9100
|
+
operationId,
|
|
9101
|
+
...parentId !== undefined ? { parentId } : {},
|
|
8926
9102
|
id: this.generateId()
|
|
8927
9103
|
};
|
|
8928
9104
|
const startTime = performance.now();
|
|
@@ -8940,6 +9116,45 @@ class TelemetryService {
|
|
|
8940
9116
|
throw error;
|
|
8941
9117
|
}
|
|
8942
9118
|
}
|
|
9119
|
+
trackRequestResult(name, durationMs, success, properties, context) {
|
|
9120
|
+
const requestContext = context ?? {
|
|
9121
|
+
operationId: this.operationId ?? getTelemetryOperationId(),
|
|
9122
|
+
id: this.generateId()
|
|
9123
|
+
};
|
|
9124
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, requestContext);
|
|
9125
|
+
this.telemetryProvider.trackRequest(name, durationMs, success, enrichedProperties);
|
|
9126
|
+
}
|
|
9127
|
+
createRequestContext() {
|
|
9128
|
+
const operationId = this.operationId ?? getTelemetryOperationId();
|
|
9129
|
+
const parentId = this.inboundParentIdFor(operationId);
|
|
9130
|
+
return {
|
|
9131
|
+
operationId,
|
|
9132
|
+
...parentId !== undefined ? { parentId } : {},
|
|
9133
|
+
id: this.generateId()
|
|
9134
|
+
};
|
|
9135
|
+
}
|
|
9136
|
+
inboundParentIdFor(operationId) {
|
|
9137
|
+
const inbound = getInboundTraceContext();
|
|
9138
|
+
return inbound && inbound.traceId === operationId ? inbound.parentSpanId : undefined;
|
|
9139
|
+
}
|
|
9140
|
+
runWithContext(context, fn) {
|
|
9141
|
+
return this.contextStorage.run(context, fn);
|
|
9142
|
+
}
|
|
9143
|
+
createDependencyContext() {
|
|
9144
|
+
const parentContext = this.getCurrentContext();
|
|
9145
|
+
if (!parentContext) {
|
|
9146
|
+
return;
|
|
9147
|
+
}
|
|
9148
|
+
return {
|
|
9149
|
+
operationId: parentContext.operationId,
|
|
9150
|
+
parentId: parentContext.id,
|
|
9151
|
+
id: this.generateId()
|
|
9152
|
+
};
|
|
9153
|
+
}
|
|
9154
|
+
trackDependencyResult(name, type2, durationMs, success, properties, context, resultCode) {
|
|
9155
|
+
const enrichedProperties = this.enrichPropertiesWithContext(properties, context);
|
|
9156
|
+
this.telemetryProvider.trackDependency(redactValue(name), type2, durationMs, success, enrichedProperties, resultCode);
|
|
9157
|
+
}
|
|
8943
9158
|
async trackDependencyOperation(name, type2, fn, properties) {
|
|
8944
9159
|
const parentContext = this.getCurrentContext();
|
|
8945
9160
|
if (!parentContext) {
|
|
@@ -8976,8 +9191,12 @@ class TelemetryService {
|
|
|
8976
9191
|
...getExecutionContextTelemetryProperties(),
|
|
8977
9192
|
...globalProperties,
|
|
8978
9193
|
...this.defaultProperties,
|
|
8979
|
-
...properties,
|
|
8980
|
-
...context
|
|
9194
|
+
...redactProperties(properties ?? {}),
|
|
9195
|
+
...context ? {
|
|
9196
|
+
[TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
|
|
9197
|
+
...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
|
|
9198
|
+
[TELEMETRY_SPAN_ID_PROPERTY]: context.id
|
|
9199
|
+
} : {}
|
|
8981
9200
|
};
|
|
8982
9201
|
if (sessionId === undefined) {
|
|
8983
9202
|
delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
|
|
@@ -8987,7 +9206,16 @@ class TelemetryService {
|
|
|
8987
9206
|
return enriched;
|
|
8988
9207
|
}
|
|
8989
9208
|
generateId() {
|
|
8990
|
-
|
|
9209
|
+
const bytes = new Uint8Array(8);
|
|
9210
|
+
let hex = "";
|
|
9211
|
+
do {
|
|
9212
|
+
crypto.getRandomValues(bytes);
|
|
9213
|
+
hex = "";
|
|
9214
|
+
for (const byte of bytes) {
|
|
9215
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
9216
|
+
}
|
|
9217
|
+
} while (/^0+$/.test(hex));
|
|
9218
|
+
return hex;
|
|
8991
9219
|
}
|
|
8992
9220
|
}
|
|
8993
9221
|
// ../common/src/telemetry/node-appinsights-telemetry-provider.ts
|
|
@@ -9689,134 +9917,11 @@ function buildCommandTelemetryAttribution(commandPath, skillSource) {
|
|
|
9689
9917
|
};
|
|
9690
9918
|
}
|
|
9691
9919
|
|
|
9692
|
-
// ../common/src/telemetry/pii-redactor.ts
|
|
9693
|
-
var REDACTED = "[REDACTED]";
|
|
9694
|
-
var MAX_VALUE_LENGTH = 200;
|
|
9695
|
-
var SENSITIVE_NAME_TOKENS = new Set([
|
|
9696
|
-
"token",
|
|
9697
|
-
"tokens",
|
|
9698
|
-
"secret",
|
|
9699
|
-
"secrets",
|
|
9700
|
-
"password",
|
|
9701
|
-
"passwords",
|
|
9702
|
-
"pwd",
|
|
9703
|
-
"credential",
|
|
9704
|
-
"credentials",
|
|
9705
|
-
"auth",
|
|
9706
|
-
"authentication",
|
|
9707
|
-
"authorization",
|
|
9708
|
-
"authority",
|
|
9709
|
-
"cert",
|
|
9710
|
-
"certificate",
|
|
9711
|
-
"certificates"
|
|
9712
|
-
]);
|
|
9713
|
-
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
9714
|
-
"api",
|
|
9715
|
-
"access",
|
|
9716
|
-
"client",
|
|
9717
|
-
"private",
|
|
9718
|
-
"public",
|
|
9719
|
-
"signing",
|
|
9720
|
-
"encryption",
|
|
9721
|
-
"session",
|
|
9722
|
-
"master",
|
|
9723
|
-
"shared",
|
|
9724
|
-
"root",
|
|
9725
|
-
"ssh",
|
|
9726
|
-
"rsa",
|
|
9727
|
-
"aes",
|
|
9728
|
-
"hmac",
|
|
9729
|
-
"oauth"
|
|
9730
|
-
]);
|
|
9731
|
-
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;
|
|
9732
|
-
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
9733
|
-
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
9734
|
-
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
9735
|
-
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
9736
|
-
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
9737
|
-
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
9738
|
-
function shortHash(input) {
|
|
9739
|
-
let hash = 2166136261;
|
|
9740
|
-
for (let i = 0;i < input.length; i++) {
|
|
9741
|
-
hash ^= input.charCodeAt(i);
|
|
9742
|
-
hash = Math.imul(hash, 16777619);
|
|
9743
|
-
}
|
|
9744
|
-
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
9745
|
-
}
|
|
9746
|
-
function redactUrl(raw) {
|
|
9747
|
-
try {
|
|
9748
|
-
const url = new URL(raw);
|
|
9749
|
-
return `${url.protocol}//${url.host}`;
|
|
9750
|
-
} catch {
|
|
9751
|
-
return `url#${shortHash(raw)}`;
|
|
9752
|
-
}
|
|
9753
|
-
}
|
|
9754
|
-
function redactValueDetectors(value) {
|
|
9755
|
-
let out = value;
|
|
9756
|
-
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
9757
|
-
out = out.replace(URL_PATTERN, (match) => {
|
|
9758
|
-
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
9759
|
-
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
9760
|
-
return `${redactUrl(core2)}${trailing}`;
|
|
9761
|
-
});
|
|
9762
|
-
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
9763
|
-
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
9764
|
-
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
9765
|
-
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
9766
|
-
if (out.length > MAX_VALUE_LENGTH) {
|
|
9767
|
-
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
9768
|
-
}
|
|
9769
|
-
return out;
|
|
9770
|
-
}
|
|
9771
|
-
function nameTokens(name) {
|
|
9772
|
-
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);
|
|
9773
|
-
}
|
|
9774
|
-
function isSensitiveName(name) {
|
|
9775
|
-
const tokens = nameTokens(name);
|
|
9776
|
-
for (let i = 0;i < tokens.length; i++) {
|
|
9777
|
-
const token = tokens[i];
|
|
9778
|
-
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
9779
|
-
return true;
|
|
9780
|
-
}
|
|
9781
|
-
if (token === "key" || token === "keys") {
|
|
9782
|
-
const prev = tokens[i - 1];
|
|
9783
|
-
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
9784
|
-
return true;
|
|
9785
|
-
}
|
|
9786
|
-
}
|
|
9787
|
-
}
|
|
9788
|
-
return false;
|
|
9789
|
-
}
|
|
9790
|
-
function redactProperty(name, value) {
|
|
9791
|
-
if (value === undefined || value === null) {
|
|
9792
|
-
return;
|
|
9793
|
-
}
|
|
9794
|
-
if (isSensitiveName(name)) {
|
|
9795
|
-
return REDACTED;
|
|
9796
|
-
}
|
|
9797
|
-
if (typeof value === "boolean" || typeof value === "number") {
|
|
9798
|
-
return value;
|
|
9799
|
-
}
|
|
9800
|
-
if (typeof value !== "string") {
|
|
9801
|
-
return "[OBJECT]";
|
|
9802
|
-
}
|
|
9803
|
-
return redactValueDetectors(value);
|
|
9804
|
-
}
|
|
9805
|
-
function redactProperties(properties) {
|
|
9806
|
-
const out = {};
|
|
9807
|
-
for (const [name, value] of Object.entries(properties)) {
|
|
9808
|
-
const redacted = redactProperty(name, value);
|
|
9809
|
-
if (redacted !== undefined) {
|
|
9810
|
-
out[name] = redacted;
|
|
9811
|
-
}
|
|
9812
|
-
}
|
|
9813
|
-
return out;
|
|
9814
|
-
}
|
|
9815
|
-
|
|
9816
9920
|
// ../common/src/trackedAction.ts
|
|
9817
9921
|
var pollSignalSlot = singleton("PollSignal");
|
|
9818
9922
|
var cliErrorCodeValues = new Set(CLI_ERROR_CODES);
|
|
9819
9923
|
var retryHintValues = new Set(RETRY_HINTS);
|
|
9924
|
+
var TELEMETRY_COMMAND_ARG_PREFIX = "uip.cmd.arg.";
|
|
9820
9925
|
var processContext = {
|
|
9821
9926
|
exit: (code) => {
|
|
9822
9927
|
process.exitCode = code;
|
|
@@ -9827,22 +9932,18 @@ var processContext = {
|
|
|
9827
9932
|
};
|
|
9828
9933
|
function extractCommandParams(cmd) {
|
|
9829
9934
|
const params = {};
|
|
9935
|
+
const add2 = (name, value) => {
|
|
9936
|
+
if (name && value !== undefined) {
|
|
9937
|
+
params[`${TELEMETRY_COMMAND_ARG_PREFIX}${name}`] = value;
|
|
9938
|
+
}
|
|
9939
|
+
};
|
|
9830
9940
|
const registered = cmd.registeredArguments ?? [];
|
|
9831
9941
|
const processed = cmd.processedArgs ?? [];
|
|
9832
9942
|
for (let i = 0;i < registered.length; i++) {
|
|
9833
|
-
|
|
9834
|
-
if (value === undefined) {
|
|
9835
|
-
continue;
|
|
9836
|
-
}
|
|
9837
|
-
const name = registered[i].name();
|
|
9838
|
-
if (name) {
|
|
9839
|
-
params[name] = value;
|
|
9840
|
-
}
|
|
9943
|
+
add2(registered[i].name(), processed[i]);
|
|
9841
9944
|
}
|
|
9842
9945
|
for (const [key, value] of Object.entries(cmd.opts())) {
|
|
9843
|
-
|
|
9844
|
-
params[key] = value;
|
|
9845
|
-
}
|
|
9946
|
+
add2(key, value);
|
|
9846
9947
|
}
|
|
9847
9948
|
return params;
|
|
9848
9949
|
}
|
|
@@ -9885,11 +9986,12 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
9885
9986
|
return this.action(async (...args) => {
|
|
9886
9987
|
const telemetryName = deriveCommandPath(command);
|
|
9887
9988
|
const props = typeof properties === "function" ? properties(...args) : properties;
|
|
9989
|
+
const requestContext = telemetry.createRequestContext();
|
|
9888
9990
|
const startTime = performance.now();
|
|
9889
9991
|
let errorMessage;
|
|
9890
9992
|
let fallbackExitCode = EXIT_CODES.Success;
|
|
9891
9993
|
clearRecordedCommandFailureTelemetry();
|
|
9892
|
-
const [error] = await catchError(fn(...args));
|
|
9994
|
+
const [error] = await catchError(telemetry.runWithContext(requestContext, () => fn(...args)));
|
|
9893
9995
|
if (error) {
|
|
9894
9996
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
9895
9997
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
@@ -9925,16 +10027,21 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
9925
10027
|
recordedFailure,
|
|
9926
10028
|
pollSignal: context.pollSignal
|
|
9927
10029
|
});
|
|
9928
|
-
|
|
9929
|
-
|
|
10030
|
+
const commandParams = extractCommandParams(command);
|
|
10031
|
+
if (props) {
|
|
10032
|
+
for (const key of Object.keys(props)) {
|
|
10033
|
+
delete commandParams[`${TELEMETRY_COMMAND_ARG_PREFIX}${key}`];
|
|
10034
|
+
}
|
|
10035
|
+
}
|
|
10036
|
+
const baseProperties = redactProperties({
|
|
10037
|
+
...commandParams,
|
|
9930
10038
|
...props,
|
|
9931
10039
|
...buildCommandTelemetryAttribution(telemetryName, process.env.UIPATH_SKILL),
|
|
9932
10040
|
command: "true",
|
|
9933
|
-
duration: String(durationMs),
|
|
9934
|
-
success: String(success),
|
|
9935
10041
|
...terminalTelemetry,
|
|
9936
10042
|
...errorMessage ? { errorMessage } : {}
|
|
9937
|
-
})
|
|
10043
|
+
});
|
|
10044
|
+
telemetry.trackRequestResult(telemetryName, durationMs, success, baseProperties, requestContext);
|
|
9938
10045
|
});
|
|
9939
10046
|
};
|
|
9940
10047
|
// ../common/src/console-guard.ts
|
|
@@ -30146,4 +30253,4 @@ export {
|
|
|
30146
30253
|
metadata
|
|
30147
30254
|
};
|
|
30148
30255
|
|
|
30149
|
-
//# debugId=
|
|
30256
|
+
//# debugId=74173FE65C6811AC64756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/insights-tool",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.198.0
|
|
4
|
+
"version": "1.198.0",
|
|
5
5
|
"description": "Query UiPath Insights data — jobs, failures, and performance metrics.",
|
|
6
6
|
"private": false,
|
|
7
7
|
"repository": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "1fadf03d7a8dd102742571dff569fdac11808afb"
|
|
30
30
|
}
|