miniflare 0.0.0-e1d2fd668 → 0.0.0-e2e6912bc
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.
|
@@ -8668,18 +8668,22 @@ function setupSentry(request, context, dsn, clientId, clientSecret) {
|
|
|
8668
8668
|
// ../workers-shared/router-worker/src/analytics.ts
|
|
8669
8669
|
var Analytics = class {
|
|
8670
8670
|
data = {};
|
|
8671
|
+
readyAnalytics;
|
|
8672
|
+
constructor(readyAnalytics) {
|
|
8673
|
+
this.readyAnalytics = readyAnalytics;
|
|
8674
|
+
}
|
|
8671
8675
|
setData(newData) {
|
|
8672
8676
|
this.data = { ...this.data, ...newData };
|
|
8673
8677
|
}
|
|
8674
8678
|
getData(key) {
|
|
8675
8679
|
return this.data[key];
|
|
8676
8680
|
}
|
|
8677
|
-
write(
|
|
8678
|
-
readyAnalytics && readyAnalytics.logEvent({
|
|
8681
|
+
write() {
|
|
8682
|
+
this.readyAnalytics && this.readyAnalytics.logEvent({
|
|
8679
8683
|
version: 1,
|
|
8680
8684
|
accountId: 0,
|
|
8681
8685
|
// TODO: need to plumb through
|
|
8682
|
-
indexId: hostname,
|
|
8686
|
+
indexId: this.data.hostname?.substring(0, 96),
|
|
8683
8687
|
doubles: [
|
|
8684
8688
|
this.data.requestTime ?? -1,
|
|
8685
8689
|
// double1
|
|
@@ -8709,7 +8713,7 @@ var Analytics = class {
|
|
|
8709
8713
|
// ../workers-shared/router-worker/src/index.ts
|
|
8710
8714
|
var src_default = {
|
|
8711
8715
|
async fetch(request, env, ctx) {
|
|
8712
|
-
let sentry, analytics = new Analytics(), performance = new PerformanceTimer(env.UNSAFE_PERFORMANCE), startTimeMs = performance.now();
|
|
8716
|
+
let sentry, analytics = new Analytics(env.ANALYTICS), performance = new PerformanceTimer(env.UNSAFE_PERFORMANCE), startTimeMs = performance.now();
|
|
8713
8717
|
try {
|
|
8714
8718
|
sentry = setupSentry(
|
|
8715
8719
|
request,
|
|
@@ -8732,7 +8736,7 @@ var src_default = {
|
|
|
8732
8736
|
} catch (err) {
|
|
8733
8737
|
throw err instanceof Error && analytics.setData({ error: err.message }), sentry && sentry.captureException(err), err;
|
|
8734
8738
|
} finally {
|
|
8735
|
-
analytics.setData({ requestTime: performance.now() - startTimeMs }), analytics.write(
|
|
8739
|
+
analytics.setData({ requestTime: performance.now() - startTimeMs }), analytics.write();
|
|
8736
8740
|
}
|
|
8737
8741
|
}
|
|
8738
8742
|
};
|