@databricks/sql 1.13.0 → 1.14.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/DBSQLClient.d.ts +8 -0
- package/dist/DBSQLClient.js +25 -0
- package/dist/DBSQLClient.js.map +1 -1
- package/dist/DBSQLSession.js +4 -0
- package/dist/DBSQLSession.js.map +1 -1
- package/dist/contracts/IClientContext.d.ts +7 -0
- package/dist/contracts/IDBSQLClient.d.ts +6 -0
- package/dist/contracts/IDBSQLSession.d.ts +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/telemetry/CircuitBreaker.d.ts +73 -0
- package/dist/telemetry/CircuitBreaker.js +176 -0
- package/dist/telemetry/CircuitBreaker.js.map +1 -0
- package/dist/telemetry/DatabricksTelemetryExporter.d.ts +76 -0
- package/dist/telemetry/DatabricksTelemetryExporter.js +324 -0
- package/dist/telemetry/DatabricksTelemetryExporter.js.map +1 -0
- package/dist/telemetry/ExceptionClassifier.js +12 -0
- package/dist/telemetry/ExceptionClassifier.js.map +1 -1
- package/dist/telemetry/FeatureFlagCache.d.ts +61 -0
- package/dist/telemetry/FeatureFlagCache.js +208 -0
- package/dist/telemetry/FeatureFlagCache.js.map +1 -0
- package/dist/telemetry/MetricsAggregator.d.ts +72 -0
- package/dist/telemetry/MetricsAggregator.js +375 -0
- package/dist/telemetry/MetricsAggregator.js.map +1 -0
- package/dist/telemetry/TelemetryClient.d.ts +41 -0
- package/dist/telemetry/TelemetryClient.js +64 -0
- package/dist/telemetry/TelemetryClient.js.map +1 -0
- package/dist/telemetry/TelemetryClientProvider.d.ts +67 -0
- package/dist/telemetry/TelemetryClientProvider.js +148 -0
- package/dist/telemetry/TelemetryClientProvider.js.map +1 -0
- package/dist/telemetry/TelemetryEventEmitter.d.ts +93 -0
- package/dist/telemetry/TelemetryEventEmitter.js +172 -0
- package/dist/telemetry/TelemetryEventEmitter.js.map +1 -0
- package/dist/telemetry/telemetryUtils.d.ts +56 -0
- package/dist/telemetry/telemetryUtils.js +222 -0
- package/dist/telemetry/telemetryUtils.js.map +1 -0
- package/dist/telemetry/types.d.ts +37 -4
- package/dist/telemetry/types.js +15 -5
- package/dist/telemetry/types.js.map +1 -1
- package/dist/telemetry/urlUtils.d.ts +22 -0
- package/dist/telemetry/urlUtils.js +35 -0
- package/dist/telemetry/urlUtils.js.map +1 -0
- package/dist/utils/agentDetector.d.ts +20 -0
- package/dist/utils/agentDetector.js +39 -0
- package/dist/utils/agentDetector.js.map +1 -0
- package/dist/utils/buildUserAgentString.js +7 -1
- package/dist/utils/buildUserAgentString.js.map +1 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +3 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/queryTags.d.ts +12 -0
- package/dist/utils/queryTags.js +35 -0
- package/dist/utils/queryTags.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Databricks Contributors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.TelemetryTerminalError = void 0;
|
|
45
|
+
const uuid_1 = require("uuid");
|
|
46
|
+
const node_fetch_1 = __importStar(require("node-fetch"));
|
|
47
|
+
const IDBSQLLogger_1 = require("../contracts/IDBSQLLogger");
|
|
48
|
+
const AuthenticationError_1 = __importDefault(require("../errors/AuthenticationError"));
|
|
49
|
+
const HiveDriverError_1 = __importDefault(require("../errors/HiveDriverError"));
|
|
50
|
+
const types_1 = require("./types");
|
|
51
|
+
const CircuitBreaker_1 = require("./CircuitBreaker");
|
|
52
|
+
const ExceptionClassifier_1 = __importDefault(require("./ExceptionClassifier"));
|
|
53
|
+
const telemetryUtils_1 = require("./telemetryUtils");
|
|
54
|
+
const buildUserAgentString_1 = __importDefault(require("../utils/buildUserAgentString"));
|
|
55
|
+
/**
|
|
56
|
+
* Thrown for non-credential terminal telemetry failures (e.g. refusal to
|
|
57
|
+
* export to an invalid host). Separate from `AuthenticationError` so the
|
|
58
|
+
* classifier can keep the "short-circuit, don't retry, count as breaker
|
|
59
|
+
* failure" contract without muddying the auth taxonomy used by the rest of
|
|
60
|
+
* the driver.
|
|
61
|
+
*/
|
|
62
|
+
class TelemetryTerminalError extends HiveDriverError_1.default {
|
|
63
|
+
constructor() {
|
|
64
|
+
super(...arguments);
|
|
65
|
+
this.terminal = true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.TelemetryTerminalError = TelemetryTerminalError;
|
|
69
|
+
/**
|
|
70
|
+
* Exports telemetry metrics to the Databricks telemetry service.
|
|
71
|
+
*
|
|
72
|
+
* CRITICAL: export() never throws — all errors are swallowed and logged at
|
|
73
|
+
* LogLevel.debug (the one exception is a single warn on the first observed
|
|
74
|
+
* auth-missing, re-armed on recovery).
|
|
75
|
+
*/
|
|
76
|
+
class DatabricksTelemetryExporter {
|
|
77
|
+
constructor(context, host, circuitBreakerRegistry, authProvider) {
|
|
78
|
+
this.context = context;
|
|
79
|
+
this.host = host;
|
|
80
|
+
this.circuitBreakerRegistry = circuitBreakerRegistry;
|
|
81
|
+
this.authProvider = authProvider;
|
|
82
|
+
this.authMissingWarned = false;
|
|
83
|
+
this.circuitBreaker = circuitBreakerRegistry.getCircuitBreaker(host);
|
|
84
|
+
const config = this.context.getConfig();
|
|
85
|
+
this.authenticatedUserAgent = (0, buildUserAgentString_1.default)(config.userAgentEntry);
|
|
86
|
+
this.unauthenticatedUserAgent = (0, buildUserAgentString_1.default)(undefined);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Release the per-host circuit breaker. Intended for the owning client's
|
|
90
|
+
* close() path.
|
|
91
|
+
*
|
|
92
|
+
* NOTE: `CircuitBreakerRegistry` currently shares one breaker per host
|
|
93
|
+
* across consumers; calling this while another consumer is active will
|
|
94
|
+
* reset their failure-count memory. The owning-client is expected to be
|
|
95
|
+
* the last consumer on its host; multi-consumer refcounting on the
|
|
96
|
+
* registry will land in the consumer-wiring PR.
|
|
97
|
+
*/
|
|
98
|
+
dispose() {
|
|
99
|
+
this.circuitBreakerRegistry.removeCircuitBreaker(this.host);
|
|
100
|
+
}
|
|
101
|
+
async export(metrics) {
|
|
102
|
+
var _a;
|
|
103
|
+
if (!metrics || metrics.length === 0) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const logger = this.context.getLogger();
|
|
107
|
+
try {
|
|
108
|
+
await this.circuitBreaker.execute(() => this.exportWithRetry(metrics));
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
if (error instanceof CircuitBreaker_1.CircuitBreakerOpenError) {
|
|
112
|
+
logger.log(IDBSQLLogger_1.LogLevel.debug, 'Circuit breaker OPEN - dropping telemetry');
|
|
113
|
+
}
|
|
114
|
+
else if (error instanceof AuthenticationError_1.default) {
|
|
115
|
+
logger.log(IDBSQLLogger_1.LogLevel.debug, `Telemetry export auth failure: ${error.message}`);
|
|
116
|
+
}
|
|
117
|
+
else if (error instanceof TelemetryTerminalError) {
|
|
118
|
+
logger.log(IDBSQLLogger_1.LogLevel.debug, `Telemetry export refused: ${error.message}`);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
logger.log(IDBSQLLogger_1.LogLevel.debug, `Telemetry export error: ${(_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : error}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Retry wrapper shaped after HttpRetryPolicy: retries only on errors
|
|
127
|
+
* classified as retryable by ExceptionClassifier, stops on terminal ones,
|
|
128
|
+
* surfaces the last error to the circuit breaker.
|
|
129
|
+
*
|
|
130
|
+
* `maxRetries` is the number of retries *after* the first attempt (i.e.
|
|
131
|
+
* attempts = maxRetries + 1), matching HttpRetryPolicy's semantics.
|
|
132
|
+
*/
|
|
133
|
+
async exportWithRetry(metrics) {
|
|
134
|
+
var _a, _b, _c, _d, _e, _f;
|
|
135
|
+
const config = this.context.getConfig();
|
|
136
|
+
const logger = this.context.getLogger();
|
|
137
|
+
const rawMaxRetries = (_a = config.telemetryMaxRetries) !== null && _a !== void 0 ? _a : types_1.DEFAULT_TELEMETRY_CONFIG.maxRetries;
|
|
138
|
+
const maxRetries = Number.isFinite(rawMaxRetries) && rawMaxRetries >= 0 ? rawMaxRetries : types_1.DEFAULT_TELEMETRY_CONFIG.maxRetries;
|
|
139
|
+
const baseMs = (_b = config.telemetryBackoffBaseMs) !== null && _b !== void 0 ? _b : types_1.DEFAULT_TELEMETRY_CONFIG.backoffBaseMs;
|
|
140
|
+
const maxMs = (_c = config.telemetryBackoffMaxMs) !== null && _c !== void 0 ? _c : types_1.DEFAULT_TELEMETRY_CONFIG.backoffMaxMs;
|
|
141
|
+
const jitterMs = (_d = config.telemetryBackoffJitterMs) !== null && _d !== void 0 ? _d : types_1.DEFAULT_TELEMETRY_CONFIG.backoffJitterMs;
|
|
142
|
+
const totalAttempts = maxRetries + 1;
|
|
143
|
+
let lastError = null;
|
|
144
|
+
/* eslint-disable no-await-in-loop */
|
|
145
|
+
for (let attempt = 0; attempt < totalAttempts; attempt += 1) {
|
|
146
|
+
try {
|
|
147
|
+
await this.exportInternal(metrics);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
lastError = error;
|
|
152
|
+
if (error instanceof AuthenticationError_1.default ||
|
|
153
|
+
error instanceof TelemetryTerminalError ||
|
|
154
|
+
ExceptionClassifier_1.default.isTerminal(error)) {
|
|
155
|
+
throw error;
|
|
156
|
+
}
|
|
157
|
+
if (!ExceptionClassifier_1.default.isRetryable(error)) {
|
|
158
|
+
throw error;
|
|
159
|
+
}
|
|
160
|
+
if (attempt >= totalAttempts - 1) {
|
|
161
|
+
throw error;
|
|
162
|
+
}
|
|
163
|
+
const base = Math.min(baseMs * 2 ** attempt, maxMs);
|
|
164
|
+
const jitter = Math.random() * jitterMs;
|
|
165
|
+
const delay = Math.min(base + jitter, maxMs);
|
|
166
|
+
// Include the failing error so ops can see what's being retried,
|
|
167
|
+
// not just the cadence.
|
|
168
|
+
logger.log(IDBSQLLogger_1.LogLevel.debug, `Retrying telemetry export (attempt ${attempt + 1}/${totalAttempts}) after ${Math.round(delay)}ms: ${(_e = error === null || error === void 0 ? void 0 : error.statusCode) !== null && _e !== void 0 ? _e : ''} ${(0, telemetryUtils_1.redactSensitive)((_f = error === null || error === void 0 ? void 0 : error.message) !== null && _f !== void 0 ? _f : '')}`);
|
|
169
|
+
await this.sleep(delay);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/* eslint-enable no-await-in-loop */
|
|
173
|
+
if (lastError) {
|
|
174
|
+
throw lastError;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
async exportInternal(metrics) {
|
|
178
|
+
var _a;
|
|
179
|
+
const config = this.context.getConfig();
|
|
180
|
+
const logger = this.context.getLogger();
|
|
181
|
+
const authenticatedExport = (_a = config.telemetryAuthenticatedExport) !== null && _a !== void 0 ? _a : types_1.DEFAULT_TELEMETRY_CONFIG.authenticatedExport;
|
|
182
|
+
const endpoint = (0, telemetryUtils_1.buildTelemetryUrl)(this.host, authenticatedExport ? '/telemetry-ext' : '/telemetry-unauth');
|
|
183
|
+
if (!endpoint) {
|
|
184
|
+
// Malformed / deny-listed host — drop the batch rather than letting
|
|
185
|
+
// it target an attacker-controlled destination.
|
|
186
|
+
throw new TelemetryTerminalError('Refusing telemetry export: host failed validation');
|
|
187
|
+
}
|
|
188
|
+
const userAgent = authenticatedExport ? this.authenticatedUserAgent : this.unauthenticatedUserAgent;
|
|
189
|
+
let headers = {
|
|
190
|
+
'Content-Type': 'application/json',
|
|
191
|
+
'User-Agent': userAgent,
|
|
192
|
+
};
|
|
193
|
+
if (authenticatedExport) {
|
|
194
|
+
headers = { ...headers, ...(await this.getAuthHeaders()) };
|
|
195
|
+
if (!(0, telemetryUtils_1.hasAuthorization)(headers)) {
|
|
196
|
+
if (!this.authMissingWarned) {
|
|
197
|
+
this.authMissingWarned = true;
|
|
198
|
+
logger.log(IDBSQLLogger_1.LogLevel.warn, 'Telemetry: Authorization header missing — metrics will be dropped');
|
|
199
|
+
}
|
|
200
|
+
throw new AuthenticationError_1.default('Telemetry export: missing Authorization header');
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const protoLogs = metrics.map((m) => this.toTelemetryLog(m, authenticatedExport, userAgent));
|
|
204
|
+
const body = JSON.stringify({
|
|
205
|
+
uploadTime: Date.now(),
|
|
206
|
+
items: [],
|
|
207
|
+
protoLogs: protoLogs.map((log) => JSON.stringify(log)),
|
|
208
|
+
});
|
|
209
|
+
logger.log(IDBSQLLogger_1.LogLevel.debug, `Exporting ${metrics.length} telemetry metrics to ${authenticatedExport ? 'authenticated' : 'unauthenticated'} endpoint`);
|
|
210
|
+
const response = await this.sendRequest(endpoint, {
|
|
211
|
+
method: 'POST',
|
|
212
|
+
headers,
|
|
213
|
+
body,
|
|
214
|
+
timeout: 10000,
|
|
215
|
+
});
|
|
216
|
+
if (!response.ok) {
|
|
217
|
+
await response.text().catch(() => { });
|
|
218
|
+
const error = new Error(`Telemetry export failed: ${response.status} ${response.statusText}`);
|
|
219
|
+
error.statusCode = response.status;
|
|
220
|
+
throw error;
|
|
221
|
+
}
|
|
222
|
+
await response.text().catch(() => { });
|
|
223
|
+
// Successful round-trip re-arms the "auth missing" warn so operators see
|
|
224
|
+
// a fresh signal the next time auth breaks.
|
|
225
|
+
this.authMissingWarned = false;
|
|
226
|
+
logger.log(IDBSQLLogger_1.LogLevel.debug, `Successfully exported ${metrics.length} telemetry metrics`);
|
|
227
|
+
}
|
|
228
|
+
async getAuthHeaders() {
|
|
229
|
+
var _a;
|
|
230
|
+
if (!this.authProvider) {
|
|
231
|
+
return {};
|
|
232
|
+
}
|
|
233
|
+
const logger = this.context.getLogger();
|
|
234
|
+
try {
|
|
235
|
+
return (0, telemetryUtils_1.normalizeHeaders)(await this.authProvider.authenticate());
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
logger.log(IDBSQLLogger_1.LogLevel.debug, `Telemetry: auth provider threw: ${(_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : error}`);
|
|
239
|
+
return {};
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
async sendRequest(url, init) {
|
|
243
|
+
const connectionProvider = await this.context.getConnectionProvider();
|
|
244
|
+
const agent = await connectionProvider.getAgent();
|
|
245
|
+
const retryPolicy = await connectionProvider.getRetryPolicy();
|
|
246
|
+
const requestConfig = { agent, ...init };
|
|
247
|
+
const result = await retryPolicy.invokeWithRetry(() => {
|
|
248
|
+
const request = new node_fetch_1.Request(url, requestConfig);
|
|
249
|
+
return (0, node_fetch_1.default)(request).then((response) => ({ request, response }));
|
|
250
|
+
});
|
|
251
|
+
return result.response;
|
|
252
|
+
}
|
|
253
|
+
toTelemetryLog(metric, authenticatedExport, userAgent) {
|
|
254
|
+
var _a, _b;
|
|
255
|
+
// Unauthenticated export must not ship correlation IDs, fingerprint
|
|
256
|
+
// data, or raw error detail — an on-path observer could otherwise link
|
|
257
|
+
// sessions → workspaces → user activity without any auth.
|
|
258
|
+
const includeCorrelation = authenticatedExport;
|
|
259
|
+
const log = {
|
|
260
|
+
workspace_id: includeCorrelation ? metric.workspaceId : undefined,
|
|
261
|
+
frontend_log_event_id: (0, uuid_1.v4)(),
|
|
262
|
+
context: {
|
|
263
|
+
client_context: {
|
|
264
|
+
timestamp_millis: metric.timestamp,
|
|
265
|
+
user_agent: userAgent,
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
entry: {
|
|
269
|
+
sql_driver_log: {
|
|
270
|
+
session_id: includeCorrelation ? metric.sessionId : undefined,
|
|
271
|
+
sql_statement_id: includeCorrelation ? metric.statementId : undefined,
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
};
|
|
275
|
+
if (metric.metricType === 'connection' && metric.driverConfig && includeCorrelation) {
|
|
276
|
+
// system_configuration is a high-entropy client fingerprint (OS, arch,
|
|
277
|
+
// locale, process, runtime). Only ship on the authenticated path.
|
|
278
|
+
log.entry.sql_driver_log.system_configuration = {
|
|
279
|
+
driver_version: metric.driverConfig.driverVersion,
|
|
280
|
+
driver_name: metric.driverConfig.driverName,
|
|
281
|
+
runtime_name: 'Node.js',
|
|
282
|
+
runtime_version: metric.driverConfig.nodeVersion,
|
|
283
|
+
runtime_vendor: metric.driverConfig.runtimeVendor,
|
|
284
|
+
os_name: metric.driverConfig.platform,
|
|
285
|
+
os_version: metric.driverConfig.osVersion,
|
|
286
|
+
os_arch: metric.driverConfig.osArch,
|
|
287
|
+
locale_name: metric.driverConfig.localeName,
|
|
288
|
+
char_set_encoding: metric.driverConfig.charSetEncoding,
|
|
289
|
+
process_name: (0, telemetryUtils_1.sanitizeProcessName)(metric.driverConfig.processName) || undefined,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
else if (metric.metricType === 'statement') {
|
|
293
|
+
log.entry.sql_driver_log.operation_latency_ms = metric.latencyMs;
|
|
294
|
+
if (metric.resultFormat || metric.chunkCount) {
|
|
295
|
+
log.entry.sql_driver_log.sql_operation = {
|
|
296
|
+
execution_result: metric.resultFormat,
|
|
297
|
+
};
|
|
298
|
+
if (metric.chunkCount && metric.chunkCount > 0) {
|
|
299
|
+
log.entry.sql_driver_log.sql_operation.chunk_details = {
|
|
300
|
+
total_chunks_present: metric.chunkCount,
|
|
301
|
+
total_chunks_iterated: metric.chunkCount,
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
else if (metric.metricType === 'error') {
|
|
307
|
+
const stackOrMessage = (_b = (_a = metric.errorStack) !== null && _a !== void 0 ? _a : metric.errorMessage) !== null && _b !== void 0 ? _b : '';
|
|
308
|
+
log.entry.sql_driver_log.error_info = {
|
|
309
|
+
error_name: metric.errorName || 'UnknownError',
|
|
310
|
+
// Redact common secret shapes and cap length. On the unauth path we
|
|
311
|
+
// keep only the error class — no message body.
|
|
312
|
+
stack_trace: includeCorrelation ? (0, telemetryUtils_1.redactSensitive)(stackOrMessage) : '',
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
return log;
|
|
316
|
+
}
|
|
317
|
+
sleep(ms) {
|
|
318
|
+
return new Promise((resolve) => {
|
|
319
|
+
setTimeout(resolve, ms);
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
exports.default = DatabricksTelemetryExporter;
|
|
324
|
+
//# sourceMappingURL=DatabricksTelemetryExporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatabricksTelemetryExporter.js","sourceRoot":"","sources":["../../lib/telemetry/DatabricksTelemetryExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+BAAoC;AACpC,yDAAmE;AAEnE,4DAAqD;AAErD,wFAAgE;AAChE,gFAAwD;AACxD,mCAAoE;AACpE,qDAAmG;AACnG,gFAAwD;AACxD,qDAM0B;AAC1B,yFAAiE;AAgDjE;;;;;;GAMG;AACH,MAAa,sBAAuB,SAAQ,yBAAe;IAA3D;;QACW,aAAQ,GAAG,IAAa,CAAC;IACpC,CAAC;CAAA;AAFD,wDAEC;AAED;;;;;;GAMG;AACH,MAAqB,2BAA2B;IAW9C,YACU,OAAuB,EACvB,IAAY,EACZ,sBAA8C,EAC9C,YAA8B;QAH9B,YAAO,GAAP,OAAO,CAAgB;QACvB,SAAI,GAAJ,IAAI,CAAQ;QACZ,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,iBAAY,GAAZ,YAAY,CAAkB;QANhC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GAAG,MAAM,CAAC,SAAS,CAAC;YAEjE,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,UAAU,EAAE;gBAC5C,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,GAAG;oBACvC,gBAAgB,EAAE,MAAM,CAAC,YAAY;iBACtC,CAAC;gBAEF,IAAI,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,GAAG,CAAC,EAAE;oBAC9C,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC,aAAa,GAAG;wBACrD,oBAAoB,EAAE,MAAM,CAAC,UAAU;wBACvC,qBAAqB,EAAE,MAAM,CAAC,UAAU;qBACzC,CAAC;iBACH;aACF;SACF;aAAM,IAAI,MAAM,CAAC,UAAU,KAAK,OAAO,EAAE;YACxC,MAAM,cAAc,GAAG,MAAA,MAAA,MAAM,CAAC,UAAU,mCAAI,MAAM,CAAC,YAAY,mCAAI,EAAE,CAAC;YACtE,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,GAAG;gBACpC,UAAU,EAAE,MAAM,CAAC,SAAS,IAAI,cAAc;gBAC9C,oEAAoE;gBACpE,+CAA+C;gBAC/C,WAAW,EAAE,kBAAkB,CAAC,CAAC,CAAC,IAAA,gCAAe,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE;aACvE,CAAC;SACH;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAEO,KAAK,CAAC,EAAU;QACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AApSD,8CAoSC"}
|
|
@@ -80,6 +80,18 @@ class ExceptionClassifier {
|
|
|
80
80
|
if (error.name === 'TimeoutError' || error.message.includes('timeout')) {
|
|
81
81
|
return true;
|
|
82
82
|
}
|
|
83
|
+
// Transient network errors. Notably does NOT include `ENOTFOUND`:
|
|
84
|
+
// DNS "not found" usually indicates a misconfigured host, not a transient
|
|
85
|
+
// fault. Retrying pushes load at the resolver without any expectation of
|
|
86
|
+
// success; circuit-breaker failure accounting is the better response.
|
|
87
|
+
const errorCode = error.code;
|
|
88
|
+
if (errorCode === 'ECONNREFUSED' ||
|
|
89
|
+
errorCode === 'ECONNRESET' ||
|
|
90
|
+
errorCode === 'EHOSTUNREACH' ||
|
|
91
|
+
errorCode === 'ETIMEDOUT' ||
|
|
92
|
+
errorCode === 'EAI_AGAIN') {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
83
95
|
// Check for HTTP status codes in error properties
|
|
84
96
|
// Supporting both 'statusCode' and 'status' property names for flexibility
|
|
85
97
|
const statusCode = (_a = error.statusCode) !== null && _a !== void 0 ? _a : error.status;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExceptionClassifier.js","sourceRoot":"","sources":["../../lib/telemetry/ExceptionClassifier.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;AAEH,wFAAgE;AAChE,sEAA8C;AAE9C;;;;;;;;;GASG;AACH,MAAqB,mBAAmB;IACtC;;;;;;;;;OASG;IACH,MAAM,CAAC,UAAU,CAAC,KAAY;;QAC5B,2CAA2C;QAC3C,IAAI,KAAK,YAAY,6BAAmB,EAAE;YACxC,OAAO,IAAI,CAAC;SACb;QAED,kDAAkD;QAClD,2EAA2E;QAC3E,MAAM,UAAU,GAAG,MAAC,KAAa,CAAC,UAAU,mCAAK,KAAa,CAAC,MAAM,CAAC;QAEtE,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;YAClC,8BAA8B;YAC9B,6CAA6C;YAC7C,+CAA+C;YAC/C,sCAAsC;YACtC,4CAA4C;YAC5C,OAAO,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,GAAG,CAAC;SAC7F;QAED,2CAA2C;QAC3C,OAAO,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C;CACF;AAtFD,sCAsFC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Databricks Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import IClientContext from '../contracts/IClientContext';
|
|
17
|
+
import IAuthentication from '../connection/contracts/IAuthentication';
|
|
18
|
+
export interface FeatureFlagContext {
|
|
19
|
+
telemetryEnabled?: boolean;
|
|
20
|
+
lastFetched?: Date;
|
|
21
|
+
refCount: number;
|
|
22
|
+
cacheDuration: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Per-host feature-flag cache used to gate telemetry emission. Responsibilities:
|
|
26
|
+
* - dedupe in-flight fetches (thundering-herd protection);
|
|
27
|
+
* - ref-count so context goes away when the last consumer closes;
|
|
28
|
+
* - clamp server-provided TTL into a safe band.
|
|
29
|
+
*
|
|
30
|
+
* Shares HTTP plumbing (agent, user agent) with DatabricksTelemetryExporter.
|
|
31
|
+
* Consumer wiring lands in a later PR in this stack (see PR description).
|
|
32
|
+
*/
|
|
33
|
+
export default class FeatureFlagCache {
|
|
34
|
+
private context;
|
|
35
|
+
private authProvider?;
|
|
36
|
+
private contexts;
|
|
37
|
+
private fetchPromises;
|
|
38
|
+
private readonly userAgent;
|
|
39
|
+
private readonly CACHE_DURATION_MS;
|
|
40
|
+
private readonly MIN_CACHE_DURATION_S;
|
|
41
|
+
private readonly MAX_CACHE_DURATION_S;
|
|
42
|
+
private readonly FEATURE_FLAG_NAME;
|
|
43
|
+
constructor(context: IClientContext, authProvider?: IAuthentication | undefined);
|
|
44
|
+
getOrCreateContext(host: string): FeatureFlagContext;
|
|
45
|
+
releaseContext(host: string): void;
|
|
46
|
+
isTelemetryEnabled(host: string): Promise<boolean>;
|
|
47
|
+
/**
|
|
48
|
+
* Strips the `-oss` suffix the feature-flag API does not accept. The server
|
|
49
|
+
* keys off the SemVer triplet only, so anything appended would 404.
|
|
50
|
+
*/
|
|
51
|
+
private getDriverVersion;
|
|
52
|
+
private fetchFeatureFlag;
|
|
53
|
+
/**
|
|
54
|
+
* Retries transient network errors once before giving up. Without a retry
|
|
55
|
+
* a single hiccup would leave telemetry disabled for the full cache TTL
|
|
56
|
+
* (15 min). One retry gives an ephemeral DNS / connection-reset failure
|
|
57
|
+
* a second chance without pushing sustained load at a broken endpoint.
|
|
58
|
+
*/
|
|
59
|
+
private fetchWithRetry;
|
|
60
|
+
private getAuthHeaders;
|
|
61
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Databricks Contributors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
const node_fetch_1 = __importStar(require("node-fetch"));
|
|
45
|
+
const IDBSQLLogger_1 = require("../contracts/IDBSQLLogger");
|
|
46
|
+
const telemetryUtils_1 = require("./telemetryUtils");
|
|
47
|
+
const buildUserAgentString_1 = __importDefault(require("../utils/buildUserAgentString"));
|
|
48
|
+
const version_1 = __importDefault(require("../version"));
|
|
49
|
+
/**
|
|
50
|
+
* Per-host feature-flag cache used to gate telemetry emission. Responsibilities:
|
|
51
|
+
* - dedupe in-flight fetches (thundering-herd protection);
|
|
52
|
+
* - ref-count so context goes away when the last consumer closes;
|
|
53
|
+
* - clamp server-provided TTL into a safe band.
|
|
54
|
+
*
|
|
55
|
+
* Shares HTTP plumbing (agent, user agent) with DatabricksTelemetryExporter.
|
|
56
|
+
* Consumer wiring lands in a later PR in this stack (see PR description).
|
|
57
|
+
*/
|
|
58
|
+
class FeatureFlagCache {
|
|
59
|
+
constructor(context, authProvider) {
|
|
60
|
+
this.context = context;
|
|
61
|
+
this.authProvider = authProvider;
|
|
62
|
+
this.fetchPromises = new Map();
|
|
63
|
+
this.CACHE_DURATION_MS = 15 * 60 * 1000;
|
|
64
|
+
this.MIN_CACHE_DURATION_S = 60;
|
|
65
|
+
this.MAX_CACHE_DURATION_S = 3600;
|
|
66
|
+
this.FEATURE_FLAG_NAME = 'databricks.partnerplatform.clientConfigsFeatureFlags.enableTelemetryForNodeJs';
|
|
67
|
+
this.contexts = new Map();
|
|
68
|
+
this.userAgent = (0, buildUserAgentString_1.default)(this.context.getConfig().userAgentEntry);
|
|
69
|
+
}
|
|
70
|
+
getOrCreateContext(host) {
|
|
71
|
+
let ctx = this.contexts.get(host);
|
|
72
|
+
if (!ctx) {
|
|
73
|
+
ctx = {
|
|
74
|
+
refCount: 0,
|
|
75
|
+
cacheDuration: this.CACHE_DURATION_MS,
|
|
76
|
+
};
|
|
77
|
+
this.contexts.set(host, ctx);
|
|
78
|
+
}
|
|
79
|
+
ctx.refCount += 1;
|
|
80
|
+
return ctx;
|
|
81
|
+
}
|
|
82
|
+
releaseContext(host) {
|
|
83
|
+
const ctx = this.contexts.get(host);
|
|
84
|
+
if (ctx) {
|
|
85
|
+
ctx.refCount -= 1;
|
|
86
|
+
if (ctx.refCount <= 0) {
|
|
87
|
+
this.contexts.delete(host);
|
|
88
|
+
this.fetchPromises.delete(host);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async isTelemetryEnabled(host) {
|
|
93
|
+
var _a;
|
|
94
|
+
const logger = this.context.getLogger();
|
|
95
|
+
const ctx = this.contexts.get(host);
|
|
96
|
+
if (!ctx) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
const isExpired = !ctx.lastFetched || Date.now() - ctx.lastFetched.getTime() > ctx.cacheDuration;
|
|
100
|
+
if (isExpired) {
|
|
101
|
+
if (!this.fetchPromises.has(host)) {
|
|
102
|
+
const fetchPromise = this.fetchFeatureFlag(host)
|
|
103
|
+
.then((enabled) => {
|
|
104
|
+
ctx.telemetryEnabled = enabled;
|
|
105
|
+
ctx.lastFetched = new Date();
|
|
106
|
+
return enabled;
|
|
107
|
+
})
|
|
108
|
+
.catch((error) => {
|
|
109
|
+
var _a;
|
|
110
|
+
logger.log(IDBSQLLogger_1.LogLevel.debug, `Error fetching feature flag: ${error.message}`);
|
|
111
|
+
return (_a = ctx.telemetryEnabled) !== null && _a !== void 0 ? _a : false;
|
|
112
|
+
})
|
|
113
|
+
.finally(() => {
|
|
114
|
+
this.fetchPromises.delete(host);
|
|
115
|
+
});
|
|
116
|
+
this.fetchPromises.set(host, fetchPromise);
|
|
117
|
+
}
|
|
118
|
+
await this.fetchPromises.get(host);
|
|
119
|
+
}
|
|
120
|
+
return (_a = ctx.telemetryEnabled) !== null && _a !== void 0 ? _a : false;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Strips the `-oss` suffix the feature-flag API does not accept. The server
|
|
124
|
+
* keys off the SemVer triplet only, so anything appended would 404.
|
|
125
|
+
*/
|
|
126
|
+
getDriverVersion() {
|
|
127
|
+
return version_1.default.replace(/-oss$/, '');
|
|
128
|
+
}
|
|
129
|
+
async fetchFeatureFlag(host) {
|
|
130
|
+
const logger = this.context.getLogger();
|
|
131
|
+
try {
|
|
132
|
+
const endpoint = (0, telemetryUtils_1.buildTelemetryUrl)(host, `/api/2.0/connector-service/feature-flags/NODEJS/${this.getDriverVersion()}`);
|
|
133
|
+
if (!endpoint) {
|
|
134
|
+
logger.log(IDBSQLLogger_1.LogLevel.debug, `Feature flag fetch skipped: invalid host ${host}`);
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
const headers = {
|
|
138
|
+
'Content-Type': 'application/json',
|
|
139
|
+
'User-Agent': this.userAgent,
|
|
140
|
+
...(await this.getAuthHeaders()),
|
|
141
|
+
};
|
|
142
|
+
logger.log(IDBSQLLogger_1.LogLevel.debug, `Fetching feature flags from ${endpoint}`);
|
|
143
|
+
const response = await this.fetchWithRetry(endpoint, {
|
|
144
|
+
method: 'GET',
|
|
145
|
+
headers,
|
|
146
|
+
timeout: 10000,
|
|
147
|
+
});
|
|
148
|
+
if (!response.ok) {
|
|
149
|
+
await response.text().catch(() => { });
|
|
150
|
+
logger.log(IDBSQLLogger_1.LogLevel.debug, `Feature flag fetch failed: ${response.status} ${response.statusText}`);
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
const data = await response.json();
|
|
154
|
+
if (data && data.flags && Array.isArray(data.flags)) {
|
|
155
|
+
const ctx = this.contexts.get(host);
|
|
156
|
+
if (ctx && typeof data.ttl_seconds === 'number' && data.ttl_seconds > 0) {
|
|
157
|
+
const clampedTtl = Math.max(this.MIN_CACHE_DURATION_S, Math.min(this.MAX_CACHE_DURATION_S, data.ttl_seconds));
|
|
158
|
+
ctx.cacheDuration = clampedTtl * 1000;
|
|
159
|
+
logger.log(IDBSQLLogger_1.LogLevel.debug, `Updated cache duration to ${clampedTtl} seconds`);
|
|
160
|
+
}
|
|
161
|
+
const flag = data.flags.find((f) => f.name === this.FEATURE_FLAG_NAME);
|
|
162
|
+
if (flag) {
|
|
163
|
+
const enabled = String(flag.value).toLowerCase() === 'true';
|
|
164
|
+
logger.log(IDBSQLLogger_1.LogLevel.debug, `Feature flag ${this.FEATURE_FLAG_NAME}: ${enabled}`);
|
|
165
|
+
return enabled;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
logger.log(IDBSQLLogger_1.LogLevel.debug, `Feature flag ${this.FEATURE_FLAG_NAME} not found in response`);
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
logger.log(IDBSQLLogger_1.LogLevel.debug, `Error fetching feature flag from ${host}: ${error.message}`);
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Retries transient network errors once before giving up. Without a retry
|
|
178
|
+
* a single hiccup would leave telemetry disabled for the full cache TTL
|
|
179
|
+
* (15 min). One retry gives an ephemeral DNS / connection-reset failure
|
|
180
|
+
* a second chance without pushing sustained load at a broken endpoint.
|
|
181
|
+
*/
|
|
182
|
+
async fetchWithRetry(url, init) {
|
|
183
|
+
const connectionProvider = await this.context.getConnectionProvider();
|
|
184
|
+
const agent = await connectionProvider.getAgent();
|
|
185
|
+
const retryPolicy = await connectionProvider.getRetryPolicy();
|
|
186
|
+
const requestConfig = { agent, ...init };
|
|
187
|
+
const result = await retryPolicy.invokeWithRetry(() => {
|
|
188
|
+
const request = new node_fetch_1.Request(url, requestConfig);
|
|
189
|
+
return (0, node_fetch_1.default)(request).then((response) => ({ request, response }));
|
|
190
|
+
});
|
|
191
|
+
return result.response;
|
|
192
|
+
}
|
|
193
|
+
async getAuthHeaders() {
|
|
194
|
+
var _a;
|
|
195
|
+
if (!this.authProvider) {
|
|
196
|
+
return {};
|
|
197
|
+
}
|
|
198
|
+
try {
|
|
199
|
+
return (0, telemetryUtils_1.normalizeHeaders)(await this.authProvider.authenticate());
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
this.context.getLogger().log(IDBSQLLogger_1.LogLevel.debug, `Feature flag auth failed: ${(_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : error}`);
|
|
203
|
+
return {};
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
exports.default = FeatureFlagCache;
|
|
208
|
+
//# sourceMappingURL=FeatureFlagCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeatureFlagCache.js","sourceR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