@syntrologie/runtime-sdk 2.8.0-canary.194 → 2.8.0-canary.196
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/index.js +52 -2
- package/dist/index.js.map +4 -4
- package/dist/observability/index.d.ts +1 -0
- package/dist/observability/types.d.ts +17 -2
- package/dist/observability/webVitalsAdapter.d.ts +16 -0
- package/dist/smart-canvas.esm.js +175 -175
- package/dist/smart-canvas.esm.js.map +4 -4
- package/dist/smart-canvas.js +5118 -4834
- package/dist/smart-canvas.js.map +4 -4
- package/dist/smart-canvas.min.js +175 -175
- package/dist/smart-canvas.min.js.map +4 -4
- package/dist/version.d.ts +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -9801,8 +9801,55 @@ function createOtlpEmitter(cfg) {
|
|
|
9801
9801
|
};
|
|
9802
9802
|
}
|
|
9803
9803
|
|
|
9804
|
+
// src/observability/webVitalsAdapter.ts
|
|
9805
|
+
import { onCLS, onFCP, onINP, onLCP, onTTFB } from "web-vitals";
|
|
9806
|
+
function bindWebVitals(reporter, options) {
|
|
9807
|
+
if (typeof window === "undefined") return () => {
|
|
9808
|
+
};
|
|
9809
|
+
const recordMs = (signal) => {
|
|
9810
|
+
return (metric) => {
|
|
9811
|
+
reporter.recordHistogram(signal, metric.value);
|
|
9812
|
+
};
|
|
9813
|
+
};
|
|
9814
|
+
const recordCls = (metric) => {
|
|
9815
|
+
reporter.recordHistogram("cls_score", metric.value);
|
|
9816
|
+
};
|
|
9817
|
+
onLCP(recordMs("lcp_ms"));
|
|
9818
|
+
onINP(recordMs("inp_ms"));
|
|
9819
|
+
onFCP(recordMs("fcp_ms"));
|
|
9820
|
+
onTTFB(recordMs("ttfb_ms"));
|
|
9821
|
+
onCLS(recordCls);
|
|
9822
|
+
let longTaskObserver = null;
|
|
9823
|
+
const prefix = options == null ? void 0 : options.attributedScriptUrlPrefix;
|
|
9824
|
+
if (prefix && "PerformanceObserver" in window) {
|
|
9825
|
+
try {
|
|
9826
|
+
longTaskObserver = new PerformanceObserver((list) => {
|
|
9827
|
+
for (const entry of list.getEntries()) {
|
|
9828
|
+
const attribution = entry.attribution;
|
|
9829
|
+
if (!attribution) continue;
|
|
9830
|
+
const matched = attribution.some((a) => {
|
|
9831
|
+
var _a3, _b;
|
|
9832
|
+
const src = (_b = (_a3 = a.containerSrc) != null ? _a3 : a.name) != null ? _b : "";
|
|
9833
|
+
return src.startsWith(prefix);
|
|
9834
|
+
});
|
|
9835
|
+
if (matched) {
|
|
9836
|
+
reporter.increment("longtasks_self_count");
|
|
9837
|
+
reporter.increment("longtasks_self_blocking_ms", Math.round(entry.duration));
|
|
9838
|
+
}
|
|
9839
|
+
}
|
|
9840
|
+
});
|
|
9841
|
+
longTaskObserver.observe({ type: "longtask", buffered: true });
|
|
9842
|
+
} catch {
|
|
9843
|
+
longTaskObserver = null;
|
|
9844
|
+
}
|
|
9845
|
+
}
|
|
9846
|
+
return () => {
|
|
9847
|
+
longTaskObserver == null ? void 0 : longTaskObserver.disconnect();
|
|
9848
|
+
};
|
|
9849
|
+
}
|
|
9850
|
+
|
|
9804
9851
|
// src/version.ts
|
|
9805
|
-
var SDK_VERSION = "2.8.0-canary.
|
|
9852
|
+
var SDK_VERSION = "2.8.0-canary.196";
|
|
9806
9853
|
|
|
9807
9854
|
// src/types.ts
|
|
9808
9855
|
var SDK_SCHEMA_VERSION = "2.0";
|
|
@@ -18267,7 +18314,7 @@ async function _initCore(options) {
|
|
|
18267
18314
|
if (payload != null && payload.obd !== true && telemetryHost) {
|
|
18268
18315
|
try {
|
|
18269
18316
|
const otlpEndpoint = `${telemetryHost.replace(/\/$/, "")}/sdk-otel/v1/logs`;
|
|
18270
|
-
initHealthReporter({
|
|
18317
|
+
const reporter = initHealthReporter({
|
|
18271
18318
|
resource: {
|
|
18272
18319
|
serviceName: "syntro-runtime-sdk",
|
|
18273
18320
|
serviceVersion: SDK_VERSION,
|
|
@@ -18278,6 +18325,9 @@ async function _initCore(options) {
|
|
|
18278
18325
|
},
|
|
18279
18326
|
emit: createOtlpEmitter({ endpoint: otlpEndpoint })
|
|
18280
18327
|
});
|
|
18328
|
+
bindWebVitals(reporter, {
|
|
18329
|
+
attributedScriptUrlPrefix: "https://cdn.syntrologie.com/runtime-sdk/"
|
|
18330
|
+
});
|
|
18281
18331
|
} catch {
|
|
18282
18332
|
}
|
|
18283
18333
|
}
|