@dxos/observability 0.3.11-main.604a65a → 0.3.11-main.69484a6
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/lib/browser/index.mjs +553 -28
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +602 -26
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/index.js +0 -1
- package/dist/types/src/index.js.map +1 -1
- package/dist/types/src/observability.d.ts +4 -3
- package/dist/types/src/observability.d.ts.map +1 -1
- package/dist/types/src/observability.js +25 -26
- package/dist/types/src/observability.js.map +1 -1
- package/dist/types/src/{helpers/map-spaces.d.ts → util.d.ts} +3 -2
- package/dist/types/src/util.d.ts.map +1 -0
- package/dist/types/src/{helpers/map-spaces.js → util.js} +2 -1
- package/dist/types/src/util.js.map +1 -0
- package/package.json +14 -15
- package/src/index.ts +0 -1
- package/src/observability.ts +24 -26
- package/src/{helpers/map-spaces.ts → util.ts} +2 -1
- package/dist/lib/browser/chunk-ROSK6U3K.mjs +0 -83
- package/dist/lib/browser/chunk-ROSK6U3K.mjs.map +0 -7
- package/dist/lib/browser/chunk-STWCJK52.mjs +0 -748
- package/dist/lib/browser/chunk-STWCJK52.mjs.map +0 -7
- package/dist/lib/browser/observability-XIDFB6PJ.mjs +0 -10
- package/dist/lib/browser/observability-XIDFB6PJ.mjs.map +0 -7
- package/dist/lib/browser/segment/index.mjs +0 -8
- package/dist/lib/browser/segment/index.mjs.map +0 -7
- package/dist/lib/node/chunk-ARUBPK2W.cjs +0 -170
- package/dist/lib/node/chunk-ARUBPK2W.cjs.map +0 -7
- package/dist/lib/node/chunk-DE7OVD7T.cjs +0 -769
- package/dist/lib/node/chunk-DE7OVD7T.cjs.map +0 -7
- package/dist/lib/node/observability-YMIQHLME.cjs +0 -32
- package/dist/lib/node/observability-YMIQHLME.cjs.map +0 -7
- package/dist/lib/node/segment/index.cjs +0 -30
- package/dist/lib/node/segment/index.cjs.map +0 -7
- package/dist/types/src/helpers/app-observability.d.ts +0 -19
- package/dist/types/src/helpers/app-observability.d.ts.map +0 -1
- package/dist/types/src/helpers/app-observability.js +0 -195
- package/dist/types/src/helpers/app-observability.js.map +0 -1
- package/dist/types/src/helpers/index.d.ts +0 -4
- package/dist/types/src/helpers/index.d.ts.map +0 -1
- package/dist/types/src/helpers/index.js +0 -23
- package/dist/types/src/helpers/index.js.map +0 -1
- package/dist/types/src/helpers/map-spaces.d.ts.map +0 -1
- package/dist/types/src/helpers/map-spaces.js.map +0 -1
- package/dist/types/src/helpers/setup-telemetry-listeners.d.ts +0 -4
- package/dist/types/src/helpers/setup-telemetry-listeners.d.ts.map +0 -1
- package/dist/types/src/helpers/setup-telemetry-listeners.js +0 -96
- package/dist/types/src/helpers/setup-telemetry-listeners.js.map +0 -1
- package/src/helpers/app-observability.ts +0 -205
- package/src/helpers/index.ts +0 -7
- package/src/helpers/setup-telemetry-listeners.ts +0 -115
|
@@ -1,32 +1,557 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from "
|
|
15
|
-
import "
|
|
16
|
-
import "
|
|
17
|
-
import "
|
|
2
|
+
DatadogMetrics
|
|
3
|
+
} from "./chunk-2J5YS65Q.mjs";
|
|
4
|
+
import {
|
|
5
|
+
captureException,
|
|
6
|
+
configureTracing,
|
|
7
|
+
enableSentryLogProcessor,
|
|
8
|
+
init,
|
|
9
|
+
setTag
|
|
10
|
+
} from "./chunk-6KUJPLEH.mjs";
|
|
11
|
+
|
|
12
|
+
// packages/sdk/observability/src/observability.ts
|
|
13
|
+
import { Event, scheduleTaskInterval } from "@dxos/async";
|
|
14
|
+
import { Context } from "@dxos/context";
|
|
15
|
+
import { invariant } from "@dxos/invariant";
|
|
16
|
+
import { log as log2 } from "@dxos/log";
|
|
17
|
+
import { ConnectionState } from "@dxos/network-manager";
|
|
18
|
+
import { DeviceKind, Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
19
|
+
import { isNode } from "@dxos/util";
|
|
20
|
+
|
|
21
|
+
// packages/sdk/observability/src/cli-observability-secrets.json
|
|
22
|
+
var cli_observability_secrets_default = {
|
|
23
|
+
SENTRY_DESTINATION: "https://2647916221e643869965e78469479aa4@o4504012000067584.ingest.sentry.io/4504012027265029",
|
|
24
|
+
TELEMETRY_API_KEY: "B00QG6PtJJrJ0VVFe0H5a6bcUUShKyZM",
|
|
25
|
+
IPDATA_API_KEY: "73dfdecdf979c18f07d50cf841bbdd9e589f237256326ac8cca23786",
|
|
26
|
+
DATADOG_API_KEY: null,
|
|
27
|
+
DATADOG_APP_KEY: null
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// packages/sdk/observability/src/segment/browser.ts
|
|
31
|
+
import snippet from "@segment/snippet";
|
|
32
|
+
import { log } from "@dxos/log";
|
|
33
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/observability/src/segment/browser.ts";
|
|
34
|
+
var SegmentTelemetry = class {
|
|
35
|
+
constructor({ apiKey, batchSize, getTags }) {
|
|
36
|
+
this._getTags = getTags;
|
|
37
|
+
try {
|
|
38
|
+
const contents = snippet.min({
|
|
39
|
+
apiKey,
|
|
40
|
+
page: false
|
|
41
|
+
});
|
|
42
|
+
const script = document.createElement("script");
|
|
43
|
+
script.innerHTML = contents;
|
|
44
|
+
document.body.append(script);
|
|
45
|
+
} catch (err) {
|
|
46
|
+
log.catch("Failed to initialize telemetry", err, {
|
|
47
|
+
F: __dxlog_file,
|
|
48
|
+
L: 27,
|
|
49
|
+
S: this,
|
|
50
|
+
C: (f, a) => f(...a)
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
page({ identityId: userId, ...options } = {}) {
|
|
55
|
+
try {
|
|
56
|
+
window.analytics?.page({
|
|
57
|
+
context: Object.fromEntries(this._getTags().entries()),
|
|
58
|
+
...options,
|
|
59
|
+
userId
|
|
60
|
+
});
|
|
61
|
+
} catch (err) {
|
|
62
|
+
log.catch("Failed to track page", err, {
|
|
63
|
+
F: __dxlog_file,
|
|
64
|
+
L: 39,
|
|
65
|
+
S: this,
|
|
66
|
+
C: (f, a) => f(...a)
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
event({ identityId: userId, name: event, ...options }) {
|
|
71
|
+
try {
|
|
72
|
+
options.properties = {
|
|
73
|
+
...options.properties,
|
|
74
|
+
...Object.fromEntries(this._getTags().entries())
|
|
75
|
+
};
|
|
76
|
+
window.analytics?.track({
|
|
77
|
+
...options,
|
|
78
|
+
event
|
|
79
|
+
});
|
|
80
|
+
} catch (err) {
|
|
81
|
+
log.catch("Failed to track event", err, {
|
|
82
|
+
F: __dxlog_file,
|
|
83
|
+
L: 54,
|
|
84
|
+
S: this,
|
|
85
|
+
C: (f, a) => f(...a)
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async flush() {
|
|
90
|
+
try {
|
|
91
|
+
await window.analytics?.flush((err) => {
|
|
92
|
+
captureException(err);
|
|
93
|
+
});
|
|
94
|
+
} catch (err) {
|
|
95
|
+
log.catch("Failed to flush telemetry", err, {
|
|
96
|
+
F: __dxlog_file,
|
|
97
|
+
L: 64,
|
|
98
|
+
S: this,
|
|
99
|
+
C: (f, a) => f(...a)
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// packages/sdk/observability/src/util.ts
|
|
106
|
+
var mapSpaces = (spaces, options = {
|
|
107
|
+
verbose: false,
|
|
108
|
+
truncateKeys: false
|
|
109
|
+
}) => {
|
|
110
|
+
return spaces.map((space) => {
|
|
111
|
+
const { open, ready } = space.internal.data.metrics ?? {};
|
|
112
|
+
const startup = open && ready && ready.getTime() - open.getTime();
|
|
113
|
+
const pipeline = space.internal.data.pipeline;
|
|
114
|
+
const startDataMutations = pipeline?.currentEpoch?.subject.assertion.timeframe.totalMessages() ?? 0;
|
|
115
|
+
const epoch = pipeline?.currentEpoch?.subject.assertion.number;
|
|
116
|
+
const currentDataMutations = pipeline?.currentDataTimeframe?.totalMessages() ?? 0;
|
|
117
|
+
const totalDataMutations = pipeline?.targetDataTimeframe?.totalMessages() ?? 0;
|
|
118
|
+
return {
|
|
119
|
+
// TODO(nf): truncate keys for DD?
|
|
120
|
+
key: space.key.truncate(),
|
|
121
|
+
open: space.isOpen,
|
|
122
|
+
name: space.properties.name,
|
|
123
|
+
members: space.members.get().length,
|
|
124
|
+
objects: space.db.query().objects.length,
|
|
125
|
+
startup,
|
|
126
|
+
epoch,
|
|
127
|
+
// appliedEpoch,
|
|
128
|
+
startDataMutations,
|
|
129
|
+
currentDataMutations,
|
|
130
|
+
totalDataMutations,
|
|
131
|
+
// TODO(burdon): Negative?
|
|
132
|
+
progress: (Math.min(Math.abs((currentDataMutations - startDataMutations) / (totalDataMutations - startDataMutations)), 1) * 100).toFixed(0)
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// packages/sdk/observability/src/observability.ts
|
|
138
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/observability/src/observability.ts";
|
|
139
|
+
var SPACE_METRICS_MIN_INTERVAL = 1e3 * 60;
|
|
140
|
+
var DATADOG_IDLE_INTERVAL = 1e3 * 60 * 1;
|
|
141
|
+
var ERROR_TAGS = [
|
|
142
|
+
"identityKey",
|
|
143
|
+
"username",
|
|
144
|
+
"deviceKey",
|
|
145
|
+
"group"
|
|
146
|
+
];
|
|
147
|
+
var Observability = class {
|
|
148
|
+
// TODO(nf): make platform a required extension?
|
|
149
|
+
constructor({ namespace, config, secrets, group, mode, telemetry, errorLog, logProcessor }) {
|
|
150
|
+
this._mode = "disabled";
|
|
151
|
+
// TODO(nf): accept upstream context?
|
|
152
|
+
this._ctx = new Context();
|
|
153
|
+
this._tags = /* @__PURE__ */ new Map();
|
|
154
|
+
this._namespace = namespace;
|
|
155
|
+
this._config = config;
|
|
156
|
+
this._mode = mode ?? "disabled";
|
|
157
|
+
this._group = group;
|
|
158
|
+
this._secrets = this._loadSecrets(config, secrets);
|
|
159
|
+
this._telemetryBatchSize = telemetry?.batchSize ?? 30;
|
|
160
|
+
this._errorReportingOptions = errorLog?.sentryInitOptions;
|
|
161
|
+
this._errorLogProcessor = logProcessor ?? false;
|
|
162
|
+
if (this._group) {
|
|
163
|
+
this.setTag("group", this._group);
|
|
164
|
+
}
|
|
165
|
+
this.setTag("namespace", this._namespace);
|
|
166
|
+
if (this._mode === "full") {
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
_loadSecrets(config, secrets) {
|
|
170
|
+
if (isNode()) {
|
|
171
|
+
return cli_observability_secrets_default;
|
|
172
|
+
} else {
|
|
173
|
+
invariant(config, "runtime config is required", {
|
|
174
|
+
F: __dxlog_file2,
|
|
175
|
+
L: 117,
|
|
176
|
+
S: this,
|
|
177
|
+
A: [
|
|
178
|
+
"config",
|
|
179
|
+
"'runtime config is required'"
|
|
180
|
+
]
|
|
181
|
+
});
|
|
182
|
+
log2("config", {
|
|
183
|
+
rtc: this._secrets,
|
|
184
|
+
config
|
|
185
|
+
}, {
|
|
186
|
+
F: __dxlog_file2,
|
|
187
|
+
L: 118,
|
|
188
|
+
S: this,
|
|
189
|
+
C: (f, a) => f(...a)
|
|
190
|
+
});
|
|
191
|
+
return {
|
|
192
|
+
DX_ENVIRONMENT: config.get("runtime.app.env.DX_ENVIRONMENT"),
|
|
193
|
+
DX_RELEASE: config.get("runtime.app.env.DX_RELEASE"),
|
|
194
|
+
SENTRY_DESTINATION: config.get("runtime.app.env.DX_SENTRY_DESTINATION"),
|
|
195
|
+
TELEMETRY_API_KEY: config.get("runtime.app.env.DX_TELEMETRY_API_KEY"),
|
|
196
|
+
IPDATA_API_KEY: config.get("runtime.app.env.DX_IPDATA_API_KEY"),
|
|
197
|
+
DATADOG_API_KEY: config.get("runtime.app.env.DX_DATADOG_API_KEY"),
|
|
198
|
+
DATADOG_APP_KEY: config.get("runtime.app.env.DX_DATADOG_APP_KEY"),
|
|
199
|
+
...secrets
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
initialize() {
|
|
204
|
+
this._initMetrics();
|
|
205
|
+
this._initTelemetry();
|
|
206
|
+
this._initErrorLogs();
|
|
207
|
+
}
|
|
208
|
+
async close() {
|
|
209
|
+
await this._ctx.dispose();
|
|
210
|
+
}
|
|
211
|
+
setMode(mode) {
|
|
212
|
+
this._mode = mode;
|
|
213
|
+
}
|
|
214
|
+
get mode() {
|
|
215
|
+
return this._mode;
|
|
216
|
+
}
|
|
217
|
+
get enabled() {
|
|
218
|
+
return this._mode !== "disabled";
|
|
219
|
+
}
|
|
220
|
+
//
|
|
221
|
+
// Tags
|
|
222
|
+
//
|
|
223
|
+
/**
|
|
224
|
+
* Set a tag for all observability services.
|
|
225
|
+
*/
|
|
226
|
+
setTag(key, value) {
|
|
227
|
+
if (this.enabled && ERROR_TAGS.includes(key)) {
|
|
228
|
+
setTag(key, value);
|
|
229
|
+
}
|
|
230
|
+
this._tags.set(key, value);
|
|
231
|
+
}
|
|
232
|
+
// TODO(nf): Combine with setDeviceTags.
|
|
233
|
+
async setIdentityTags(client) {
|
|
234
|
+
client.services.services.IdentityService.queryIdentity().subscribe((idqr) => {
|
|
235
|
+
if (!idqr?.identity?.identityKey) {
|
|
236
|
+
log2("empty response from identity service", {
|
|
237
|
+
idqr
|
|
238
|
+
}, {
|
|
239
|
+
F: __dxlog_file2,
|
|
240
|
+
L: 175,
|
|
241
|
+
S: this,
|
|
242
|
+
C: (f, a) => f(...a)
|
|
243
|
+
});
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
this.setTag("identityKey", idqr?.identity?.identityKey.truncate());
|
|
247
|
+
if (idqr?.identity?.profile?.displayName) {
|
|
248
|
+
this.setTag("username", idqr?.identity?.profile?.displayName);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
async setDeviceTags(client) {
|
|
253
|
+
client.services.services.DevicesService.queryDevices().subscribe((dqr) => {
|
|
254
|
+
if (!dqr || !dqr.devices || dqr.devices.length === 0) {
|
|
255
|
+
log2("empty response from device service", {
|
|
256
|
+
device: dqr
|
|
257
|
+
}, {
|
|
258
|
+
F: __dxlog_file2,
|
|
259
|
+
L: 191,
|
|
260
|
+
S: this,
|
|
261
|
+
C: (f, a) => f(...a)
|
|
262
|
+
});
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
invariant(dqr, "empty response from device service", {
|
|
266
|
+
F: __dxlog_file2,
|
|
267
|
+
L: 194,
|
|
268
|
+
S: this,
|
|
269
|
+
A: [
|
|
270
|
+
"dqr",
|
|
271
|
+
"'empty response from device service'"
|
|
272
|
+
]
|
|
273
|
+
});
|
|
274
|
+
const thisDevice = dqr.devices.find((device) => device.kind === DeviceKind.CURRENT);
|
|
275
|
+
if (!thisDevice) {
|
|
276
|
+
log2("no current device", {
|
|
277
|
+
device: dqr
|
|
278
|
+
}, {
|
|
279
|
+
F: __dxlog_file2,
|
|
280
|
+
L: 198,
|
|
281
|
+
S: this,
|
|
282
|
+
C: (f, a) => f(...a)
|
|
283
|
+
});
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
this.setTag("deviceKey", thisDevice.deviceKey.truncate());
|
|
287
|
+
if (thisDevice.profile?.label) {
|
|
288
|
+
this.setTag("deviceProfile", thisDevice.profile.label);
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
//
|
|
293
|
+
// Metrics
|
|
294
|
+
//
|
|
295
|
+
_initMetrics() {
|
|
296
|
+
if (this.enabled && this._secrets.DATADOG_API_KEY) {
|
|
297
|
+
this._metrics = new DatadogMetrics({
|
|
298
|
+
apiKey: this._secrets.DATADOG_API_KEY,
|
|
299
|
+
getTags: () => this._tags,
|
|
300
|
+
// TODO(nf): move/refactor from telementryContext, needed to read CORS proxy
|
|
301
|
+
config: this._config
|
|
302
|
+
});
|
|
303
|
+
} else {
|
|
304
|
+
log2("datadog disabled", void 0, {
|
|
305
|
+
F: __dxlog_file2,
|
|
306
|
+
L: 221,
|
|
307
|
+
S: this,
|
|
308
|
+
C: (f, a) => f(...a)
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Gauge metric.
|
|
314
|
+
*
|
|
315
|
+
* The default implementation uses Datadog.
|
|
316
|
+
*/
|
|
317
|
+
gauge(name, value, extraTags) {
|
|
318
|
+
this._metrics?.gauge(name, value, extraTags);
|
|
319
|
+
}
|
|
320
|
+
// TODO(nf): Refactor into ObservabilityExtensions.
|
|
321
|
+
startNetworkMetrics(client) {
|
|
322
|
+
const updateSignalMetrics = new Event();
|
|
323
|
+
updateSignalMetrics.on(this._ctx, async (networkStatus) => {
|
|
324
|
+
log2("send signal metrics", void 0, {
|
|
325
|
+
F: __dxlog_file2,
|
|
326
|
+
L: 241,
|
|
327
|
+
S: this,
|
|
328
|
+
C: (f, a) => f(...a)
|
|
329
|
+
});
|
|
330
|
+
networkStatus.signaling.forEach(({ server, state }) => {
|
|
331
|
+
this.gauge("dxos.client.network.signal.connectionState", state, {
|
|
332
|
+
server
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
let swarmCount = 0;
|
|
336
|
+
const connectionStates = /* @__PURE__ */ new Map();
|
|
337
|
+
for (const state in ConnectionState) {
|
|
338
|
+
connectionStates.set(state, 0);
|
|
339
|
+
}
|
|
340
|
+
let totalReadBufferSize = 0;
|
|
341
|
+
let totalWriteBufferSize = 0;
|
|
342
|
+
let totalChannelBufferSize = 0;
|
|
343
|
+
networkStatus.connectionInfo?.forEach((connectionInfo) => {
|
|
344
|
+
swarmCount++;
|
|
345
|
+
for (const conn of connectionInfo.connections ?? []) {
|
|
346
|
+
connectionStates.set(conn.state, (connectionStates.get(conn.state) ?? 0) + 1);
|
|
347
|
+
totalReadBufferSize += conn.readBufferSize ?? 0;
|
|
348
|
+
totalWriteBufferSize += conn.writeBufferSize ?? 0;
|
|
349
|
+
for (const stream of conn.streams ?? []) {
|
|
350
|
+
totalChannelBufferSize += stream.writeBufferSize ?? 0;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
this.gauge("dxos.client.network.swarm.count", swarmCount);
|
|
354
|
+
for (const state in ConnectionState) {
|
|
355
|
+
this.gauge("dxos.client.network.connection.count", connectionStates.get(state) ?? 0, {
|
|
356
|
+
state
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
this.gauge("dxox.client.network.totalReadBufferSize", totalReadBufferSize);
|
|
360
|
+
this.gauge("dxos.client.network.totalWriteBufferSize", totalWriteBufferSize);
|
|
361
|
+
this.gauge("dxos.client.network.totalChannelBufferSize", totalChannelBufferSize);
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
client.services.services.NetworkService?.queryStatus().subscribe((networkStatus) => {
|
|
365
|
+
updateSignalMetrics.emit(networkStatus);
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
startSpacesMetrics(client) {
|
|
369
|
+
let spaces = client.spaces.get();
|
|
370
|
+
const subscriptions = /* @__PURE__ */ new Map();
|
|
371
|
+
this._ctx.onDispose(() => subscriptions.forEach((subscription) => subscription.unsubscribe()));
|
|
372
|
+
const updateSpaceMetrics = new Event().debounce(SPACE_METRICS_MIN_INTERVAL);
|
|
373
|
+
updateSpaceMetrics.on(this._ctx, async (space) => {
|
|
374
|
+
log2("send space update", void 0, {
|
|
375
|
+
F: __dxlog_file2,
|
|
376
|
+
L: 293,
|
|
377
|
+
S: this,
|
|
378
|
+
C: (f, a) => f(...a)
|
|
379
|
+
});
|
|
380
|
+
for (const sp of mapSpaces(spaces, {
|
|
381
|
+
truncateKeys: true
|
|
382
|
+
})) {
|
|
383
|
+
this.gauge("dxos.client.space.members", sp.members, {
|
|
384
|
+
key: sp.key
|
|
385
|
+
});
|
|
386
|
+
this.gauge("dxos.client.space.objects", sp.objects, {
|
|
387
|
+
key: sp.key
|
|
388
|
+
});
|
|
389
|
+
this.gauge("dxos.client.space.epoch", sp.epoch, {
|
|
390
|
+
key: sp.key
|
|
391
|
+
});
|
|
392
|
+
this.gauge("dxos.client.space.currentDataMutations", sp.currentDataMutations, {
|
|
393
|
+
key: sp.key
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
const subscribeToSpaceUpdate = (space) => space.pipeline.subscribe({
|
|
398
|
+
next: () => {
|
|
399
|
+
updateSpaceMetrics.emit();
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
spaces.forEach((space) => {
|
|
403
|
+
subscriptions.set(space.key.toHex(), subscribeToSpaceUpdate(space));
|
|
404
|
+
});
|
|
405
|
+
client.spaces.subscribe({
|
|
406
|
+
next: async () => {
|
|
407
|
+
spaces = client.spaces.get();
|
|
408
|
+
spaces.filter((space) => !subscriptions.has(space.key.toHex())).forEach((space) => {
|
|
409
|
+
subscriptions.set(space.key.toHex(), subscribeToSpaceUpdate(space));
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
scheduleTaskInterval(this._ctx, async () => updateSpaceMetrics.emit(), DATADOG_IDLE_INTERVAL);
|
|
414
|
+
}
|
|
415
|
+
async startRuntimeMetrics(client, frequency = DATADOG_IDLE_INTERVAL) {
|
|
416
|
+
const platform = await client.services.services.SystemService?.getPlatform();
|
|
417
|
+
invariant(platform, "platform is required", {
|
|
418
|
+
F: __dxlog_file2,
|
|
419
|
+
L: 330,
|
|
420
|
+
S: this,
|
|
421
|
+
A: [
|
|
422
|
+
"platform",
|
|
423
|
+
"'platform is required'"
|
|
424
|
+
]
|
|
425
|
+
});
|
|
426
|
+
this.setTag("platform_type", Platform.PLATFORM_TYPE[platform.type].toLowerCase());
|
|
427
|
+
if (this._mode === "full") {
|
|
428
|
+
if (platform.platform) {
|
|
429
|
+
this.setTag("platform", platform.platform);
|
|
430
|
+
}
|
|
431
|
+
if (platform.arch) {
|
|
432
|
+
this.setTag("arch", platform.arch);
|
|
433
|
+
}
|
|
434
|
+
if (platform.runtime) {
|
|
435
|
+
this.setTag("runtime", platform.runtime);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
scheduleTaskInterval(this._ctx, async () => {
|
|
439
|
+
log2("platform", void 0, {
|
|
440
|
+
F: __dxlog_file2,
|
|
441
|
+
L: 348,
|
|
442
|
+
S: this,
|
|
443
|
+
C: (f, a) => f(...a)
|
|
444
|
+
});
|
|
445
|
+
client.services.services.SystemService?.getPlatform().then((platform2) => {
|
|
446
|
+
log2("platform", {
|
|
447
|
+
platform: platform2
|
|
448
|
+
}, {
|
|
449
|
+
F: __dxlog_file2,
|
|
450
|
+
L: 351,
|
|
451
|
+
S: this,
|
|
452
|
+
C: (f, a) => f(...a)
|
|
453
|
+
});
|
|
454
|
+
if (platform2.memory) {
|
|
455
|
+
this.gauge("dxos.client.runtime.rss", platform2.memory.rss);
|
|
456
|
+
this.gauge("dxos.client.runtime.heapTotal", platform2.memory.heapTotal);
|
|
457
|
+
this.gauge("dxos.client.runtime.heapUsed", platform2.memory.heapUsed);
|
|
458
|
+
}
|
|
459
|
+
}).catch((error) => log2("platform error", {
|
|
460
|
+
error
|
|
461
|
+
}, {
|
|
462
|
+
F: __dxlog_file2,
|
|
463
|
+
L: 358,
|
|
464
|
+
S: this,
|
|
465
|
+
C: (f, a) => f(...a)
|
|
466
|
+
}));
|
|
467
|
+
}, frequency);
|
|
468
|
+
}
|
|
469
|
+
//
|
|
470
|
+
// Telemetry
|
|
471
|
+
//
|
|
472
|
+
_initTelemetry() {
|
|
473
|
+
if (this._secrets.TELEMETRY_API_KEY && this._mode !== "disabled") {
|
|
474
|
+
this._telemetry = new SegmentTelemetry({
|
|
475
|
+
apiKey: this._secrets.TELEMETRY_API_KEY,
|
|
476
|
+
batchSize: this._telemetryBatchSize,
|
|
477
|
+
getTags: () => this._tags
|
|
478
|
+
});
|
|
479
|
+
} else {
|
|
480
|
+
log2("segment disabled", void 0, {
|
|
481
|
+
F: __dxlog_file2,
|
|
482
|
+
L: 376,
|
|
483
|
+
S: this,
|
|
484
|
+
C: (f, a) => f(...a)
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* A telemetry event.
|
|
490
|
+
*
|
|
491
|
+
* The default implementation uses Segment.
|
|
492
|
+
*/
|
|
493
|
+
event(options) {
|
|
494
|
+
this._telemetry?.event(options);
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* A telemetry page view.
|
|
498
|
+
*
|
|
499
|
+
* The default implementation uses Segment.
|
|
500
|
+
*/
|
|
501
|
+
page(options) {
|
|
502
|
+
this._telemetry?.page(options);
|
|
503
|
+
}
|
|
504
|
+
//
|
|
505
|
+
// Error Logs
|
|
506
|
+
//
|
|
507
|
+
_initErrorLogs() {
|
|
508
|
+
if (this._secrets.SENTRY_DESTINATION && this._mode !== "disabled") {
|
|
509
|
+
log2.info("Initializing Sentry", {
|
|
510
|
+
dest: this._secrets.SENTRY_DESTINATION,
|
|
511
|
+
options: this._errorReportingOptions
|
|
512
|
+
}, {
|
|
513
|
+
F: __dxlog_file2,
|
|
514
|
+
L: 405,
|
|
515
|
+
S: this,
|
|
516
|
+
C: (f, a) => f(...a)
|
|
517
|
+
});
|
|
518
|
+
init({
|
|
519
|
+
...this._errorReportingOptions,
|
|
520
|
+
destination: this._secrets.SENTRY_DESTINATION,
|
|
521
|
+
scrubFilenames: this._mode !== "full"
|
|
522
|
+
});
|
|
523
|
+
if (this._errorReportingOptions?.tracing) {
|
|
524
|
+
configureTracing();
|
|
525
|
+
}
|
|
526
|
+
if (this._errorLogProcessor) {
|
|
527
|
+
enableSentryLogProcessor();
|
|
528
|
+
}
|
|
529
|
+
this._tags.forEach((v, k) => {
|
|
530
|
+
if (ERROR_TAGS.includes(k)) {
|
|
531
|
+
setTag(k, v);
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
} else {
|
|
535
|
+
log2("sentry disabled", void 0, {
|
|
536
|
+
F: __dxlog_file2,
|
|
537
|
+
L: 428,
|
|
538
|
+
S: this,
|
|
539
|
+
C: (f, a) => f(...a)
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Manually capture an exception.
|
|
545
|
+
*
|
|
546
|
+
* The default implementation uses Sentry.
|
|
547
|
+
*/
|
|
548
|
+
captureException(err) {
|
|
549
|
+
if (this.enabled) {
|
|
550
|
+
captureException(err);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
};
|
|
18
554
|
export {
|
|
19
|
-
|
|
20
|
-
OBSERVABILITY_DISABLED_KEY,
|
|
21
|
-
OBSERVABILITY_GROUP_KEY,
|
|
22
|
-
Observability,
|
|
23
|
-
getObservabilityGroup,
|
|
24
|
-
getTelemetryIdentifier,
|
|
25
|
-
initializeAppObservability,
|
|
26
|
-
isObservabilityDisabled,
|
|
27
|
-
mapSpaces,
|
|
28
|
-
setupTelemetryListeners,
|
|
29
|
-
storeObservabilityDisabled,
|
|
30
|
-
storeObservabilityGroup
|
|
555
|
+
Observability
|
|
31
556
|
};
|
|
32
557
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
4
|
-
"sourcesContent": [],
|
|
5
|
-
"mappings": "",
|
|
6
|
-
"names": []
|
|
3
|
+
"sources": ["../../../src/observability.ts", "../../../src/cli-observability-secrets.json", "../../../src/segment/browser.ts", "../../../src/util.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Event, scheduleTaskInterval } from '@dxos/async';\nimport { type Client, type Config } from '@dxos/client';\nimport { type Space } from '@dxos/client-protocol';\nimport { Context } from '@dxos/context';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\nimport { ConnectionState } from '@dxos/network-manager';\nimport { DeviceKind, type NetworkStatus, Platform } from '@dxos/protocols/proto/dxos/client/services';\nimport { isNode } from '@dxos/util';\n\nimport buildSecrets from './cli-observability-secrets.json';\nimport { DatadogMetrics } from './datadog';\nimport { SegmentTelemetry, type EventOptions, type PageOptions } from './segment';\nimport {\n captureException as sentryCaptureException,\n enableSentryLogProcessor,\n configureTracing as sentryConfigureTracing,\n init as sentryInit,\n type InitOptions,\n setTag as sentrySetTag,\n} from './sentry';\nimport { mapSpaces } from './util';\n\nconst SPACE_METRICS_MIN_INTERVAL = 1000 * 60;\n// const DATADOG_IDLE_INTERVAL = 1000 * 60 * 5;\nconst DATADOG_IDLE_INTERVAL = 1000 * 60 * 1;\n\n// TODO(nf): add allowlist for telemetry tags?\nconst ERROR_TAGS = ['identityKey', 'username', 'deviceKey', 'group'];\n\n// Secrets? EnvironmentConfig?\n\nexport type ObservabilitySecrets = {\n DX_ENVIRONMENT: string | null;\n DX_RELEASE: string | null;\n SENTRY_DESTINATION: string | null;\n TELEMETRY_API_KEY: string | null;\n IPDATA_API_KEY: string | null;\n DATADOG_API_KEY: string | null;\n DATADOG_APP_KEY: string | null;\n};\n\nexport type Mode = 'basic' | 'full' | 'disabled';\n\nexport type ObservabilityOptions = {\n /// The webapp (e.g. 'composer.dxos.org'), 'cli', or 'agent'.\n namespace: string;\n // TODO(nf): make platform a required extension?\n // platform: Platform;\n config?: Config;\n secrets?: Record<string, string>;\n group?: string;\n mode?: Mode;\n\n telemetry?: {\n batchSize?: number;\n };\n\n errorLog?: {\n sentryInitOptions?: InitOptions;\n };\n logProcessor?: boolean;\n};\n\n/*\n * Observability provides a common interface for error logging, metrics, and telemetry.\n * It currently provides these capabilities using Sentry, Datadog, and Segment.\n */\nexport class Observability {\n // TODO(wittjosiah): Generic metrics interface.\n private _metrics?: DatadogMetrics;\n // TODO(wittjosiah): Generic telemetry interface.\n private _telemetryBatchSize: number;\n private _telemetry?: SegmentTelemetry;\n // TODO(wittjosiah): Generic error logging interface.\n private _errorReportingOptions?: InitOptions;\n private _errorLogProcessor: boolean;\n\n private _secrets: ObservabilitySecrets;\n private _namespace: string;\n private _config?: Config;\n private _mode: Mode = 'disabled';\n private _group?: string;\n // TODO(nf): accept upstream context?\n private _ctx = new Context();\n private _tags = new Map<string, string>();\n\n // TODO(nf): make platform a required extension?\n constructor({ namespace, config, secrets, group, mode, telemetry, errorLog, logProcessor }: ObservabilityOptions) {\n this._namespace = namespace;\n this._config = config;\n this._mode = mode ?? 'disabled';\n this._group = group;\n this._secrets = this._loadSecrets(config, secrets);\n this._telemetryBatchSize = telemetry?.batchSize ?? 30;\n this._errorReportingOptions = errorLog?.sentryInitOptions;\n this._errorLogProcessor = logProcessor ?? false;\n\n if (this._group) {\n this.setTag('group', this._group);\n }\n this.setTag('namespace', this._namespace);\n\n if (this._mode === 'full') {\n // TODO(nf): set group and hostname?\n }\n }\n\n private _loadSecrets(config: Config | undefined, secrets?: Record<string, string>) {\n if (isNode()) {\n return buildSecrets as ObservabilitySecrets;\n } else {\n invariant(config, 'runtime config is required');\n log('config', { rtc: this._secrets, config });\n return {\n DX_ENVIRONMENT: config.get('runtime.app.env.DX_ENVIRONMENT'),\n DX_RELEASE: config.get('runtime.app.env.DX_RELEASE'),\n SENTRY_DESTINATION: config.get('runtime.app.env.DX_SENTRY_DESTINATION'),\n TELEMETRY_API_KEY: config.get('runtime.app.env.DX_TELEMETRY_API_KEY'),\n IPDATA_API_KEY: config.get('runtime.app.env.DX_IPDATA_API_KEY'),\n DATADOG_API_KEY: config.get('runtime.app.env.DX_DATADOG_API_KEY'),\n DATADOG_APP_KEY: config.get('runtime.app.env.DX_DATADOG_APP_KEY'),\n ...secrets,\n };\n }\n }\n\n initialize() {\n this._initMetrics();\n this._initTelemetry();\n this._initErrorLogs();\n }\n\n async close() {\n await this._ctx.dispose();\n\n // TODO(wittjosiah): Remove telemetry, etc. scripts.\n }\n\n setMode(mode: Mode) {\n this._mode = mode;\n }\n\n get mode() {\n return this._mode;\n }\n\n get enabled() {\n return this._mode !== 'disabled';\n }\n\n //\n // Tags\n //\n\n /**\n * Set a tag for all observability services.\n */\n setTag(key: string, value: string) {\n if (this.enabled && ERROR_TAGS.includes(key)) {\n sentrySetTag(key, value);\n }\n\n this._tags.set(key, value);\n }\n\n // TODO(nf): Combine with setDeviceTags.\n async setIdentityTags(client: Client) {\n client.services.services.IdentityService!.queryIdentity().subscribe((idqr) => {\n if (!idqr?.identity?.identityKey) {\n log('empty response from identity service', { idqr });\n return;\n }\n\n // TODO(nf): check mode\n // TODO(nf): cardinality\n this.setTag('identityKey', idqr?.identity?.identityKey.truncate());\n if (idqr?.identity?.profile?.displayName) {\n this.setTag('username', idqr?.identity?.profile?.displayName);\n }\n });\n }\n\n async setDeviceTags(client: Client) {\n client.services.services.DevicesService!.queryDevices().subscribe((dqr) => {\n if (!dqr || !dqr.devices || dqr.devices.length === 0) {\n log('empty response from device service', { device: dqr });\n return;\n }\n invariant(dqr, 'empty response from device service');\n\n const thisDevice = dqr.devices.find((device) => device.kind === DeviceKind.CURRENT);\n if (!thisDevice) {\n log('no current device', { device: dqr });\n return;\n }\n this.setTag('deviceKey', thisDevice.deviceKey.truncate());\n if (thisDevice.profile?.label) {\n this.setTag('deviceProfile', thisDevice.profile.label);\n }\n });\n }\n\n //\n // Metrics\n //\n\n private _initMetrics() {\n if (this.enabled && this._secrets.DATADOG_API_KEY) {\n this._metrics = new DatadogMetrics({\n apiKey: this._secrets.DATADOG_API_KEY,\n getTags: () => this._tags,\n // TODO(nf): move/refactor from telementryContext, needed to read CORS proxy\n config: this._config!,\n });\n } else {\n log('datadog disabled');\n }\n }\n\n /**\n * Gauge metric.\n *\n * The default implementation uses Datadog.\n */\n gauge(name: string, value: number | any, extraTags?: any) {\n this._metrics?.gauge(name, value, extraTags);\n }\n\n // TODO(nf): Refactor into ObservabilityExtensions.\n\n startNetworkMetrics(client: Client) {\n const updateSignalMetrics = new Event<NetworkStatus>();\n\n // const lcsh = (csp as LocalClientServices).host;\n updateSignalMetrics.on(this._ctx, async (networkStatus) => {\n log('send signal metrics');\n (networkStatus.signaling as NetworkStatus.Signal[]).forEach(({ server, state }) => {\n this.gauge('dxos.client.network.signal.connectionState', state, { server });\n });\n\n let swarmCount = 0;\n const connectionStates = new Map<string, number>();\n for (const state in ConnectionState) {\n connectionStates.set(state, 0);\n }\n\n let totalReadBufferSize = 0;\n let totalWriteBufferSize = 0;\n let totalChannelBufferSize = 0;\n\n networkStatus.connectionInfo?.forEach((connectionInfo) => {\n swarmCount++;\n\n for (const conn of connectionInfo.connections ?? []) {\n connectionStates.set(conn.state, (connectionStates.get(conn.state) ?? 0) + 1);\n totalReadBufferSize += conn.readBufferSize ?? 0;\n totalWriteBufferSize += conn.writeBufferSize ?? 0;\n\n for (const stream of conn.streams ?? []) {\n totalChannelBufferSize += stream.writeBufferSize ?? 0;\n }\n }\n\n this.gauge('dxos.client.network.swarm.count', swarmCount);\n for (const state in ConnectionState) {\n this.gauge('dxos.client.network.connection.count', connectionStates.get(state) ?? 0, { state });\n }\n this.gauge('dxox.client.network.totalReadBufferSize', totalReadBufferSize);\n this.gauge('dxos.client.network.totalWriteBufferSize', totalWriteBufferSize);\n this.gauge('dxos.client.network.totalChannelBufferSize', totalChannelBufferSize);\n });\n });\n\n client.services.services.NetworkService?.queryStatus().subscribe((networkStatus) => {\n updateSignalMetrics.emit(networkStatus);\n });\n\n // scheduleTaskInterval(ctx, async () => updateSignalMetrics.emit(), DATADOG_IDLE_INTERVAL);\n }\n\n startSpacesMetrics(client: Client) {\n let spaces = client.spaces.get();\n const subscriptions = new Map<string, { unsubscribe: () => void }>();\n this._ctx.onDispose(() => subscriptions.forEach((subscription) => subscription.unsubscribe()));\n\n const updateSpaceMetrics = new Event<Space>().debounce(SPACE_METRICS_MIN_INTERVAL);\n updateSpaceMetrics.on(this._ctx, async (space) => {\n log('send space update');\n for (const sp of mapSpaces(spaces, { truncateKeys: true })) {\n this.gauge('dxos.client.space.members', sp.members, { key: sp.key });\n this.gauge('dxos.client.space.objects', sp.objects, { key: sp.key });\n this.gauge('dxos.client.space.epoch', sp.epoch, { key: sp.key });\n this.gauge('dxos.client.space.currentDataMutations', sp.currentDataMutations, { key: sp.key });\n }\n });\n\n const subscribeToSpaceUpdate = (space: Space) =>\n space.pipeline.subscribe({\n next: () => {\n updateSpaceMetrics.emit();\n },\n });\n\n spaces.forEach((space) => {\n subscriptions.set(space.key.toHex(), subscribeToSpaceUpdate(space));\n });\n\n client.spaces.subscribe({\n next: async () => {\n spaces = client.spaces.get();\n // spaces = await this.getSpaces(this._agent.client);\n spaces\n .filter((space) => !subscriptions.has(space.key.toHex()))\n .forEach((space) => {\n subscriptions.set(space.key.toHex(), subscribeToSpaceUpdate(space));\n });\n },\n });\n\n scheduleTaskInterval(this._ctx, async () => updateSpaceMetrics.emit(), DATADOG_IDLE_INTERVAL);\n }\n\n async startRuntimeMetrics(client: Client, frequency: number = DATADOG_IDLE_INTERVAL) {\n const platform = await client.services.services.SystemService?.getPlatform();\n invariant(platform, 'platform is required');\n\n this.setTag('platform_type', Platform.PLATFORM_TYPE[platform.type as number].toLowerCase());\n if (this._mode === 'full') {\n // platform[foo] does not work?\n if (platform.platform) {\n this.setTag('platform', platform.platform);\n }\n if (platform.arch) {\n this.setTag('arch', platform.arch);\n }\n if (platform.runtime) {\n this.setTag('runtime', platform.runtime);\n }\n }\n scheduleTaskInterval(\n this._ctx,\n async () => {\n log('platform');\n client.services.services.SystemService?.getPlatform()\n .then((platform) => {\n log('platform', { platform });\n if (platform.memory) {\n this.gauge('dxos.client.runtime.rss', platform.memory.rss);\n this.gauge('dxos.client.runtime.heapTotal', platform.memory.heapTotal);\n this.gauge('dxos.client.runtime.heapUsed', platform.memory.heapUsed);\n }\n })\n .catch((error) => log('platform error', { error }));\n },\n frequency,\n );\n }\n\n //\n // Telemetry\n //\n\n private _initTelemetry() {\n if (this._secrets.TELEMETRY_API_KEY && this._mode !== 'disabled') {\n this._telemetry = new SegmentTelemetry({\n apiKey: this._secrets.TELEMETRY_API_KEY,\n batchSize: this._telemetryBatchSize,\n getTags: () => this._tags,\n });\n } else {\n log('segment disabled');\n }\n }\n\n /**\n * A telemetry event.\n *\n * The default implementation uses Segment.\n */\n event(options: EventOptions) {\n this._telemetry?.event(options);\n }\n\n /**\n * A telemetry page view.\n *\n * The default implementation uses Segment.\n */\n page(options: PageOptions) {\n this._telemetry?.page(options);\n }\n\n //\n // Error Logs\n //\n\n private _initErrorLogs() {\n if (this._secrets.SENTRY_DESTINATION && this._mode !== 'disabled') {\n // TODO(nf): refactor package into this one?\n log.info('Initializing Sentry', {\n dest: this._secrets.SENTRY_DESTINATION,\n options: this._errorReportingOptions,\n });\n sentryInit({\n ...this._errorReportingOptions,\n destination: this._secrets.SENTRY_DESTINATION,\n scrubFilenames: this._mode !== 'full',\n });\n if (this._errorReportingOptions?.tracing) {\n sentryConfigureTracing();\n }\n // TODO(nf): set platform at instantiation? needed for node.\n if (this._errorLogProcessor) {\n enableSentryLogProcessor();\n }\n // TODO(nf): is this different than passing as properties in options?\n this._tags.forEach((v, k) => {\n if (ERROR_TAGS.includes(k)) {\n sentrySetTag(k, v);\n }\n });\n } else {\n log('sentry disabled');\n }\n }\n\n /**\n * Manually capture an exception.\n *\n * The default implementation uses Sentry.\n */\n captureException(err: any) {\n if (this.enabled) {\n sentryCaptureException(err);\n }\n }\n}\n", "{\n \"SENTRY_DESTINATION\": \"https://2647916221e643869965e78469479aa4@o4504012000067584.ingest.sentry.io/4504012027265029\",\n \"TELEMETRY_API_KEY\": \"B00QG6PtJJrJ0VVFe0H5a6bcUUShKyZM\",\n \"IPDATA_API_KEY\": \"73dfdecdf979c18f07d50cf841bbdd9e589f237256326ac8cca23786\",\n \"DATADOG_API_KEY\": null,\n \"DATADOG_APP_KEY\": null\n}", "//\n// Copyright 2022 DXOS.org\n//\n\nimport snippet from '@segment/snippet';\n\nimport { log } from '@dxos/log';\n\nimport type { EventOptions, SegmentTelemetryOptions, PageOptions } from './types';\nimport { captureException } from '../sentry';\n\nexport class SegmentTelemetry {\n private _getTags: () => Map<string, string>;\n\n constructor({ apiKey, batchSize, getTags }: SegmentTelemetryOptions) {\n this._getTags = getTags;\n try {\n const contents = snippet.min({\n apiKey,\n page: false,\n });\n\n const script = document.createElement('script');\n script.innerHTML = contents;\n document.body.append(script);\n } catch (err) {\n log.catch('Failed to initialize telemetry', err);\n }\n }\n\n page({ identityId: userId, ...options }: PageOptions = {}) {\n try {\n (window as any).analytics?.page({\n context: Object.fromEntries(this._getTags().entries()),\n ...options,\n userId,\n });\n } catch (err) {\n log.catch('Failed to track page', err);\n }\n }\n\n event({ identityId: userId, name: event, ...options }: EventOptions) {\n try {\n options.properties = {\n ...options.properties,\n ...Object.fromEntries(this._getTags().entries()),\n };\n (window as any).analytics?.track({\n ...options,\n event,\n });\n } catch (err) {\n log.catch('Failed to track event', err);\n }\n }\n\n async flush() {\n try {\n await (window as any).analytics?.flush((err: any) => {\n captureException(err);\n });\n } catch (err) {\n log.catch('Failed to flush telemetry', err);\n }\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Space } from '@dxos/client-protocol';\n\nexport type MapSpacesOptions = {\n verbose?: boolean;\n truncateKeys?: boolean;\n};\n\nexport const mapSpaces = (spaces: Space[], options: MapSpacesOptions = { verbose: false, truncateKeys: false }) => {\n return spaces.map((space) => {\n // TODO(burdon): Factor out.\n // TODO(burdon): Agent needs to restart before `ready` is available.\n const { open, ready } = space.internal.data.metrics ?? {};\n const startup = open && ready && ready.getTime() - open.getTime();\n\n // TODO(burdon): Get feeds from client-services if verbose (factor out from devtools/diagnostics).\n // const host = client.services.services.DevtoolsHost!;\n const pipeline = space.internal.data.pipeline;\n const startDataMutations = pipeline?.currentEpoch?.subject.assertion.timeframe.totalMessages() ?? 0;\n const epoch = pipeline?.currentEpoch?.subject.assertion.number;\n // const appliedEpoch = pipeline?.appliedEpoch?.subject.assertion.number;\n const currentDataMutations = pipeline?.currentDataTimeframe?.totalMessages() ?? 0;\n const totalDataMutations = pipeline?.targetDataTimeframe?.totalMessages() ?? 0;\n\n return {\n // TODO(nf): truncate keys for DD?\n key: space.key.truncate(),\n open: space.isOpen,\n name: space.properties.name,\n members: space.members.get().length,\n objects: space.db.query().objects.length,\n startup,\n epoch,\n // appliedEpoch,\n startDataMutations,\n currentDataMutations,\n totalDataMutations,\n\n // TODO(burdon): Negative?\n progress: (\n Math.min(Math.abs((currentDataMutations - startDataMutations) / (totalDataMutations - startDataMutations)), 1) *\n 100\n ).toFixed(0),\n };\n });\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AAIA,SAASA,OAAOC,4BAA4B;AAG5C,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,OAAAA,YAAW;AACpB,SAASC,uBAAuB;AAChC,SAASC,YAAgCC,gBAAgB;AACzD,SAASC,cAAc;;;ACZvB;AAAA,EACE,oBAAsB;AAAA,EACtB,mBAAqB;AAAA,EACrB,gBAAkB;AAAA,EAClB,iBAAmB;AAAA,EACnB,iBAAmB;AACrB;;;ACFA,OAAOC,aAAa;AAEpB,SAASC,WAAW;;AAKb,IAAMC,mBAAN,MAAMA;EAGXC,YAAY,EAAEC,QAAQC,WAAWC,QAAO,GAA6B;AACnE,SAAKC,WAAWD;AAChB,QAAI;AACF,YAAME,WAAWC,QAAQC,IAAI;QAC3BN;QACAO,MAAM;MACR,CAAA;AAEA,YAAMC,SAASC,SAASC,cAAc,QAAA;AACtCF,aAAOG,YAAYP;AACnBK,eAASG,KAAKC,OAAOL,MAAAA;IACvB,SAASM,KAAK;AACZC,UAAIC,MAAM,kCAAkCF,KAAAA;;;;;;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;QAChB6D,SAAS,MAAM,KAAKpE;MACtB,CAAA;IACF,OAAO;AACLgB,MAAAA,KAAI,oBAAA,QAAA;;;;;;IACN;EACF;;;;;;EAOA4H,MAAMC,SAAuB;AAC3B,SAAKH,YAAYE,MAAMC,OAAAA;EACzB;;;;;;EAOAC,KAAKD,SAAsB;AACzB,SAAKH,YAAYI,KAAKD,OAAAA;EACxB;;;;EAMQhH,iBAAiB;AACvB,QAAI,KAAKxB,SAASgB,sBAAsB,KAAKxB,UAAU,YAAY;AAEjEmB,MAAAA,KAAI+H,KAAK,uBAAuB;QAC9BC,MAAM,KAAK3I,SAASgB;QACpBwH,SAAS,KAAKpI;MAChB,GAAA;;;;;;AACAwI,WAAW;QACT,GAAG,KAAKxI;QACRyI,aAAa,KAAK7I,SAASgB;QAC3B8H,gBAAgB,KAAKtJ,UAAU;MACjC,CAAA;AACA,UAAI,KAAKY,wBAAwB2I,SAAS;AACxCC,yBAAAA;MACF;AAEA,UAAI,KAAK1I,oBAAoB;AAC3B2I,iCAAAA;MACF;AAEA,WAAKtJ,MAAM8E,QAAQ,CAACyE,GAAGC,MAAAA;AACrB,YAAItK,WAAWkD,SAASoH,CAAAA,GAAI;AAC1BnH,iBAAamH,GAAGD,CAAAA;QAClB;MACF,CAAA;IACF,OAAO;AACLvI,MAAAA,KAAI,mBAAA,QAAA;;;;;;IACN;EACF;;;;;;EAOAyI,iBAAiBC,KAAU;AACzB,QAAI,KAAKzH,SAAS;AAChB0H,uBAAuBD,GAAAA;IACzB;EACF;AACF;",
|
|
6
|
+
"names": ["Event", "scheduleTaskInterval", "Context", "invariant", "log", "ConnectionState", "DeviceKind", "Platform", "isNode", "snippet", "log", "SegmentTelemetry", "constructor", "apiKey", "batchSize", "getTags", "_getTags", "contents", "snippet", "min", "page", "script", "document", "createElement", "innerHTML", "body", "append", "err", "log", "catch", "identityId", "userId", "options", "window", "analytics", "context", "Object", "fromEntries", "entries", "event", "name", "properties", "track", "flush", "captureException", "mapSpaces", "spaces", "options", "verbose", "truncateKeys", "map", "space", "open", "ready", "internal", "data", "metrics", "startup", "getTime", "pipeline", "startDataMutations", "currentEpoch", "subject", "assertion", "timeframe", "totalMessages", "epoch", "number", "currentDataMutations", "currentDataTimeframe", "totalDataMutations", "targetDataTimeframe", "key", "truncate", "isOpen", "name", "properties", "members", "get", "length", "objects", "db", "query", "progress", "Math", "min", "abs", "toFixed", "SPACE_METRICS_MIN_INTERVAL", "DATADOG_IDLE_INTERVAL", "ERROR_TAGS", "Observability", "constructor", "namespace", "config", "secrets", "group", "mode", "telemetry", "errorLog", "logProcessor", "_mode", "_ctx", "Context", "_tags", "Map", "_namespace", "_config", "_group", "_secrets", "_loadSecrets", "_telemetryBatchSize", "batchSize", "_errorReportingOptions", "sentryInitOptions", "_errorLogProcessor", "setTag", "isNode", "buildSecrets", "invariant", "log", "rtc", "DX_ENVIRONMENT", "get", "DX_RELEASE", "SENTRY_DESTINATION", "TELEMETRY_API_KEY", "IPDATA_API_KEY", "DATADOG_API_KEY", "DATADOG_APP_KEY", "initialize", "_initMetrics", "_initTelemetry", "_initErrorLogs", "close", "dispose", "setMode", "enabled", "key", "value", "includes", "sentrySetTag", "set", "setIdentityTags", "client", "services", "IdentityService", "queryIdentity", "subscribe", "idqr", "identity", "identityKey", "truncate", "profile", "displayName", "setDeviceTags", "DevicesService", "queryDevices", "dqr", "devices", "length", "device", "thisDevice", "find", "kind", "DeviceKind", "CURRENT", "deviceKey", "label", "_metrics", "DatadogMetrics", "apiKey", "getTags", "gauge", "name", "extraTags", "startNetworkMetrics", "updateSignalMetrics", "Event", "on", "networkStatus", "signaling", "forEach", "server", "state", "swarmCount", "connectionStates", "ConnectionState", "totalReadBufferSize", "totalWriteBufferSize", "totalChannelBufferSize", "connectionInfo", "conn", "connections", "readBufferSize", "writeBufferSize", "stream", "streams", "NetworkService", "queryStatus", "emit", "startSpacesMetrics", "spaces", "subscriptions", "onDispose", "subscription", "unsubscribe", "updateSpaceMetrics", "debounce", "space", "sp", "mapSpaces", "truncateKeys", "members", "objects", "epoch", "currentDataMutations", "subscribeToSpaceUpdate", "pipeline", "next", "toHex", "filter", "has", "scheduleTaskInterval", "startRuntimeMetrics", "frequency", "platform", "SystemService", "getPlatform", "Platform", "PLATFORM_TYPE", "type", "toLowerCase", "arch", "runtime", "then", "memory", "rss", "heapTotal", "heapUsed", "catch", "error", "_telemetry", "SegmentTelemetry", "event", "options", "page", "info", "dest", "sentryInit", "destination", "scrubFilenames", "tracing", "sentryConfigureTracing", "enableSentryLogProcessor", "v", "k", "captureException", "err", "sentryCaptureException"]
|
|
7
7
|
}
|