@inference-net/otel-cf-workers 2.1.0 → 2.1.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/index.js +17 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -96,7 +96,7 @@ function passthroughGet(target, prop, thisArg) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
const PACKAGE_VERSION = "2.1.
|
|
99
|
+
const PACKAGE_VERSION = "2.1.1";
|
|
100
100
|
const PACKAGE_NAME = "@inference-net/otel-cf-workers";
|
|
101
101
|
const ATTR_CLOUDFLARE_COLO = "cloudflare.colo";
|
|
102
102
|
const ATTR_CLOUDFLARE_RAY_ID = "cloudflare.ray_id";
|
|
@@ -1443,9 +1443,10 @@ function getParentContextFromRequest(request) {
|
|
|
1443
1443
|
}
|
|
1444
1444
|
function updateSpanNameOnRoute(span, request, result) {
|
|
1445
1445
|
const readable = span;
|
|
1446
|
-
|
|
1446
|
+
const route = readable.attributes?.["http.route"];
|
|
1447
|
+
if (route) {
|
|
1447
1448
|
const method = request.method.toUpperCase();
|
|
1448
|
-
span.updateName(`${method} ${
|
|
1449
|
+
span.updateName(`${method} ${route}`);
|
|
1449
1450
|
}
|
|
1450
1451
|
if (result) {
|
|
1451
1452
|
if (result.status >= 400) {
|
|
@@ -3540,12 +3541,19 @@ function createHandlerFlowFn(instrumentation) {
|
|
|
3540
3541
|
const result = tracer.startActiveSpan(name, options, parentContext, async (span) => {
|
|
3541
3542
|
try {
|
|
3542
3543
|
const result2 = await handlerFn(instrumentedTrigger, proxiedEnv, proxiedCtx);
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3544
|
+
const isWebSocketUpgrade = isRequest(trigger) && trigger.headers.get("upgrade")?.toLowerCase() === "websocket" && trigger.headers.has("sec-websocket-key");
|
|
3545
|
+
if (isWebSocketUpgrade) {
|
|
3546
|
+
const logger = getLogger("handler");
|
|
3547
|
+
logger.trace("WebSocket upgrade detected, closing span without reading response");
|
|
3548
|
+
span.setStatus({ code: SpanStatusCode.OK });
|
|
3549
|
+
} else {
|
|
3550
|
+
if (instrumentation.getAttributesFromResult) {
|
|
3551
|
+
const attributes = instrumentation.getAttributesFromResult(result2);
|
|
3552
|
+
span.setAttributes(attributes);
|
|
3553
|
+
}
|
|
3554
|
+
if (instrumentation.executionSucces) {
|
|
3555
|
+
instrumentation.executionSucces(span, trigger, result2);
|
|
3556
|
+
}
|
|
3549
3557
|
}
|
|
3550
3558
|
return result2;
|
|
3551
3559
|
} catch (error) {
|