@miniaxolotl/grove-server 1.7.0 → 1.7.1
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/server.js +37 -2
- package/dist/server.js.map +2 -2
- package/dist/telemetry-build.json +1 -1
- package/dist/worker.js +37 -2
- package/dist/worker.js.map +3 -3
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -13,7 +13,7 @@ var __export = (target, all) => {
|
|
|
13
13
|
var define_GROVE_TELEMETRY_default;
|
|
14
14
|
var init_define_GROVE_TELEMETRY = __esm({
|
|
15
15
|
"<define:__GROVE_TELEMETRY__>"() {
|
|
16
|
-
define_GROVE_TELEMETRY_default = { enabled: true, revision: "
|
|
16
|
+
define_GROVE_TELEMETRY_default = { enabled: true, revision: "d22d90bc2b2968ed3c296249297f732e7e17d358", version: "1.7.1", component: "api", key: "phc_AqVrjhk7W2X2pFjyngY7uWxcSSRREfJhgr8mBmKbXYEh", cliDsn: "https://3f6d0711b5890dea4ce8e6ccf2a1a7fd@o4511632209346560.ingest.us.sentry.io/4512290791620608", apiDsn: "https://4524e8910e318110277babdfe818999b@o4511632209346560.ingest.us.sentry.io/4512290791489536" };
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
|
|
@@ -18161,6 +18161,31 @@ var dataCollection = {
|
|
|
18161
18161
|
stackFrameVariables: false,
|
|
18162
18162
|
frameContextLines: 0
|
|
18163
18163
|
};
|
|
18164
|
+
function safeSpanEnvelope(envelope, identity, dsn, sampleRate) {
|
|
18165
|
+
const spanItems = envelope[1].filter(([header]) => header.type === "span");
|
|
18166
|
+
if (!spanItems.length) return envelope;
|
|
18167
|
+
const payload = spanItems[0][1];
|
|
18168
|
+
const traceId = payload.items?.[0]?.trace_id;
|
|
18169
|
+
const publicKey = dsnFromString(dsn)?.publicKey;
|
|
18170
|
+
if (spanItems.length !== 1 || !traceId || !/^[a-f0-9]{32}$/.test(traceId) || !payload.items.every((span) => span.trace_id === traceId) || !publicKey || !Number.isFinite(sampleRate) || sampleRate <= 0 || sampleRate > 1)
|
|
18171
|
+
return null;
|
|
18172
|
+
const operation = payload.items[0].name;
|
|
18173
|
+
return [
|
|
18174
|
+
{
|
|
18175
|
+
...envelope[0],
|
|
18176
|
+
trace: {
|
|
18177
|
+
trace_id: traceId,
|
|
18178
|
+
public_key: publicKey,
|
|
18179
|
+
release: identity.release,
|
|
18180
|
+
environment: "production",
|
|
18181
|
+
sampled: "true",
|
|
18182
|
+
sample_rate: String(sampleRate),
|
|
18183
|
+
transaction: operations.includes(operation) ? operation : "command_run"
|
|
18184
|
+
}
|
|
18185
|
+
},
|
|
18186
|
+
envelope[1]
|
|
18187
|
+
];
|
|
18188
|
+
}
|
|
18164
18189
|
var attributes = (identity, raw = {}) => ({
|
|
18165
18190
|
...projectProperties(raw),
|
|
18166
18191
|
product: "grove",
|
|
@@ -18464,7 +18489,17 @@ var Reporter = class {
|
|
|
18464
18489
|
);
|
|
18465
18490
|
return {
|
|
18466
18491
|
...transport,
|
|
18467
|
-
send: (envelope) =>
|
|
18492
|
+
send: (envelope) => {
|
|
18493
|
+
if (!this.allowed())
|
|
18494
|
+
return Promise.resolve({ statusCode: 200 });
|
|
18495
|
+
const projected = safeSpanEnvelope(
|
|
18496
|
+
envelope,
|
|
18497
|
+
this.identity,
|
|
18498
|
+
config.dsn,
|
|
18499
|
+
config.sampleRate ?? 0.1
|
|
18500
|
+
);
|
|
18501
|
+
return projected ? transport.send(projected) : Promise.resolve({ statusCode: 200 });
|
|
18502
|
+
}
|
|
18468
18503
|
};
|
|
18469
18504
|
}
|
|
18470
18505
|
});
|