Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@instana/core

Package Overview
Dependencies
Maintainers
3
Versions
258
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@instana/core - npm Package Compare versions

Comparing version 1.67.0 to 1.67.1

src/tracing/instrumentation/frameworks/.koa.js.swp

4

package.json
{
"name": "@instana/core",
"version": "1.67.0",
"version": "1.67.1",
"description": "Core library for Instana's Node.js packages",

@@ -129,3 +129,3 @@ "main": "src/index.js",

},
"gitHead": "addf78a182e2859b43a629ba8b444ae9f244b72d"
"gitHead": "90bf48ae5e18b9ffa22004819e485a90c8a3eb04"
}

@@ -38,6 +38,6 @@ 'use strict';

// Actually, we could just use ctx._matchedRoute, which would be the path template we are looging for and which gets
// Actually, we could just use ctx._matchedRoute, which would be the path template we are looking for and which gets
// set by koa-router. Unfortunately, this is broken, see
// https://github.com/alexmingoia/koa-router/issues/478 and
// https://github.com/alexmingoia/koa-router/issues/444.
// https://github.com/ZijianHe/koa-router/issues/478 and
// https://github.com/ZijianHe/koa-router/issues/444.

@@ -51,4 +51,5 @@ // eslint-disable-next-line no-unused-vars

var matchedRouteLayers = ctx.matched.slice();
matchedRouteLayers.sort(byMostSpecificLayer);
annotateHttpEntrySpanWithPathTemplate(matchedRouteLayers[matchedRouteLayers.length - 1].path);
matchedRouteLayers.sort(byLeastSpecificLayer);
var mostSpecificPath = normalizeLayerPath(matchedRouteLayers[matchedRouteLayers.length - 1].path);
annotateHttpEntrySpanWithPathTemplate(mostSpecificPath);
}

@@ -70,3 +71,3 @@ return resolvedValue;

* Copied from
* https://github.com/alexmingoia/koa-router/pull/475, which would fix the mentioned issues with ctx._matchedRoute (if
* https://github.com/ZijianHe/koa-router/pull/475, which would fix the mentioned issues with ctx._matchedRoute (if
* it got merged).

@@ -80,8 +81,12 @@ *

*/
function byMostSpecificLayer(a, b) {
var wildA = a.path.endsWith('(.*)');
var wildB = b.path.endsWith('(.*)');
if (wildA && wildB) return a.path.length - b.path.length;
var pathA = wildA ? a.path.slice(0, -4) : a.path;
var pathB = wildB ? b.path.slice(0, -4) : b.path;
function byLeastSpecificLayer(a, b) {
var regexpA = a.path && typeof a.path === 'object';
var regexpB = b.path && typeof b.path === 'object';
var pathA = normalizeLayerPath(a.path);
var pathB = normalizeLayerPath(b.path);
var wildA = pathA.endsWith('(.*)');
var wildB = pathB.endsWith('(.*)');
if (wildA && wildB) return pathA.length - pathB.length;
pathA = wildA ? pathA.slice(0, -4) : pathA;
pathB = wildB ? pathB.slice(0, -4) : pathB;
if (pathA !== pathB) {

@@ -93,5 +98,21 @@ if (pathA.startsWith(pathB)) return 1;

if (wildB) return 1;
if (regexpA && !regexpB) {
return -1;
}
if (!regexpA && regexpB) {
return 1;
}
return 0;
}
function normalizeLayerPath(p) {
if (p == null) {
return '';
}
if (typeof p === 'object') {
return p.toString();
}
return p;
}
function annotateHttpEntrySpanWithPathTemplate(pathTemplate) {

@@ -98,0 +119,0 @@ var span = cls.getCurrentRootSpan();

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc