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

lightstep-tracer

Package Overview
Dependencies
Maintainers
8
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lightstep-tracer - npm Package Compare versions

Comparing version 0.25.1 to 0.25.2

.envrc

5

CHANGELOG.md

@@ -7,2 +7,7 @@ # CHANGELOG

## 0.25.2
* Fix missing clock offsets over proto transport
* Fix timestamp conversion for protobuf transport
## 0.25.1

@@ -9,0 +14,0 @@ * No changes (minor bump to align with 0.25.1-no-protobuf release)

5

lib/imp/log_record_imp.js

@@ -133,5 +133,4 @@ 'use strict';

var ts = new googleProtobufTimestampPB.Timestamp();
var millis = Math.floor(this._timestampMicros / 1000);
var secs = Math.floor(millis / 1000);
var nanos = millis % 1000 * 1000000;
var secs = Math.floor(this._timestampMicros / 1000000);
var nanos = this._timestampMicros % 1000000 * 1000;
ts.setSeconds(secs);

@@ -138,0 +137,0 @@ ts.setNanos(nanos);

2

lib/imp/report_imp.js

@@ -118,3 +118,3 @@ 'use strict';

reportProto.setSpansList(spansList);
reportProto.setTimestampOffsetMicros(this._timestampOffsetMicros);
reportProto.setTimestampOffsetMicros(this._timestampOffsetMicros.toString(10));
reportProto.setInternalMetrics(internalMetrics);

@@ -121,0 +121,0 @@ return reportProto;

@@ -308,5 +308,4 @@ 'use strict';

var startTimestamp = new googleProtobufTimestampPB.Timestamp();
var startMillis = Math.floor(this._beginMicros / 1000);
var startSeconds = Math.floor(startMillis / 1000);
var startNanos = startMillis % 1000 * 1000000;
var startSeconds = Math.floor(this._beginMicros / 1000000);
var startNanos = this._beginMicros % 1000000 * 1000;
startTimestamp.setSeconds(startSeconds);

@@ -313,0 +312,0 @@ startTimestamp.setNanos(startNanos);

@@ -193,6 +193,5 @@ 'use strict';

request = new Request(request, options);
var url = request.url;
var opts = tracer.options();
if (!self._shouldTrace(tracer, url)) {
if (!self._shouldTrace(tracer, request.url)) {
return proxiedFetch.apply(null, arguments);

@@ -204,14 +203,21 @@ }

var parsed = new URL(request.url);
var tags = {
method: options && options.method ? options.method : 'GET',
url: url
method: request.method,
url: request.url,
// NOTE: Purposefully excluding username:password from tags.
// TODO: consider sanitizing URL to mask / remove that information from the trace in general
hash: parsed.hash,
href: parsed.href,
protocol: parsed.protocol,
origin: parsed.origin,
host: parsed.host,
hostname: parsed.hostname,
port: parsed.port,
pathname: parsed.pathname,
search: parsed.search
};
if (url) {
tags.url_pathname = url.split('?')[0];
}
var fetchPayload = Object.assign({}, tags);
if (opts.include_cookies) {
fetchPayload.cookies = getCookies();
tags.cookies = getCookies();
}

@@ -222,4 +228,3 @@

tracer.inject(span.context(), opentracing.FORMAT_HTTP_HEADERS, headersCarrier);
var keys = Object.keys(headersCarrier);
keys.forEach(function (key) {
Object.keys(headersCarrier).forEach(function (key) {
if (!request.headers.get(key)) request.headers.set(key, headersCarrier[key]);

@@ -229,5 +234,5 @@ });

event: 'sending',
method: options.method || 'GET',
url: url,
openPayload: fetchPayload
method: request.method,
url: request.url,
openPayload: tags
});

@@ -241,3 +246,3 @@ span.addTags(tags);

span.log({
method: options.method || 'GET',
method: request.method,
headers: getResponseHeaders(response),

@@ -268,3 +273,3 @@ status: response.status,

// This shouldn't be possible, but let's be paranoid
if (!tracer) {
if (!tracer || !url) {
return false;

@@ -277,38 +282,21 @@ }

}
if (!url) {
if (this._internalExclusions.some(function (ex) {
return ex.test(url);
})) {
return false;
}
for (var key in this._internalExclusions) {
if (!this._internalExclusions.hasOwnProperty(key)) {
continue;
}
var ex = this._internalExclusions[key];
if (ex.test(url)) {
return false;
}
}
var include = false;
for (var _key in opts.fetch_url_inclusion_patterns) {
if (!opts.fetch_url_inclusion_patterns.hasOwnProperty(_key)) {
continue;
}
var inc = opts.fetch_url_inclusion_patterns[_key];
if (inc.test(url)) {
include = true;
break;
}
if (opts.fetch_url_inclusion_patterns.some(function (inc) {
return inc.test(url);
})) {
include = true;
}
if (!include) {
return false;
if (opts.fetch_url_exclusion_patterns.some(function (ex) {
return ex.test(url);
})) {
include = false;
}
for (var _key2 in opts.fetch_url_exclusion_patterns) {
if (!opts.fetch_url_exclusion_patterns.hasOwnProperty(_key2)) {
continue;
}
var _ex = opts.fetch_url_exclusion_patterns[_key2];
if (_ex.test(url)) {
return false;
}
}
return true;
return include;
}

@@ -315,0 +303,0 @@ }]);

{
"name": "lightstep-tracer",
"version": "0.25.1",
"version": "0.25.2",
"main": "index.js",

@@ -5,0 +5,0 @@ "types": "index.d.ts",

@@ -96,5 +96,4 @@ import { crouton_thrift } from '../platform_abstraction_layer'; // eslint-disable-line camelcase

let ts = new googleProtobufTimestampPB.Timestamp();
let millis = Math.floor(this._timestampMicros / 1000);
let secs = Math.floor(millis / 1000);
let nanos = (millis % 1000) * 1000000;
let secs = Math.floor(this._timestampMicros / 1000000);
let nanos = (this._timestampMicros % 1000000) * 1000;
ts.setSeconds(secs);

@@ -101,0 +100,0 @@ ts.setNanos(nanos);

@@ -85,3 +85,3 @@ import { crouton_thrift } from '../platform_abstraction_layer'; // eslint-disable-line camelcase

reportProto.setSpansList(spansList);
reportProto.setTimestampOffsetMicros(this._timestampOffsetMicros);
reportProto.setTimestampOffsetMicros(this._timestampOffsetMicros.toString(10));
reportProto.setInternalMetrics(internalMetrics);

@@ -88,0 +88,0 @@ return reportProto;

@@ -233,5 +233,4 @@ import * as coerce from './coerce.js';

let startTimestamp = new googleProtobufTimestampPB.Timestamp();
let startMillis = Math.floor(this._beginMicros / 1000);
let startSeconds = Math.floor(startMillis / 1000);
let startNanos = (startMillis % 1000) * 1000000;
let startSeconds = Math.floor(this._beginMicros / 1000000);
let startNanos = (this._beginMicros % 1000000) * 1000;
startTimestamp.setSeconds(startSeconds);

@@ -238,0 +237,0 @@ startTimestamp.setNanos(startNanos);

@@ -161,6 +161,5 @@ import * as opentracing from 'opentracing';

request = new Request(request, options);
const url = request.url;
const opts = tracer.options();
if (!self._shouldTrace(tracer, url)) {
if (!self._shouldTrace(tracer, request.url)) {
return proxiedFetch.apply(null, arguments);

@@ -172,14 +171,21 @@ }

const parsed = new URL(request.url);
let tags = {
method : options && options.method ? options.method : 'GET',
url : url,
method : request.method,
url : request.url,
// NOTE: Purposefully excluding username:password from tags.
// TODO: consider sanitizing URL to mask / remove that information from the trace in general
hash : parsed.hash,
href : parsed.href,
protocol : parsed.protocol,
origin : parsed.origin,
host : parsed.host,
hostname : parsed.hostname,
port : parsed.port,
pathname : parsed.pathname,
search : parsed.search,
};
if (url) {
tags.url_pathname = url.split('?')[0];
}
const fetchPayload = Object.assign({}, tags);
if (opts.include_cookies) {
fetchPayload.cookies = getCookies();
tags.cookies = getCookies();
}

@@ -190,4 +196,3 @@

tracer.inject(span.context(), opentracing.FORMAT_HTTP_HEADERS, headersCarrier);
const keys = Object.keys(headersCarrier);
keys.forEach((key) => {
Object.keys(headersCarrier).forEach((key) => {
if (!request.headers.get(key)) request.headers.set(key, headersCarrier[key]);

@@ -197,5 +202,5 @@ });

event : 'sending',
method : options.method || 'GET',
url : url,
openPayload : fetchPayload,
method : request.method,
url : request.url,
openPayload : tags,
});

@@ -209,3 +214,3 @@ span.addTags(tags);

span.log({
method : options.method || 'GET',
method : request.method,
headers : getResponseHeaders(response),

@@ -235,3 +240,3 @@ status : response.status,

// This shouldn't be possible, but let's be paranoid
if (!tracer) {
if (!tracer || !url) {
return false;

@@ -244,38 +249,15 @@ }

}
if (!url) {
if (this._internalExclusions.some(ex => ex.test(url))) {
return false;
}
for (let key in this._internalExclusions) {
if (!this._internalExclusions.hasOwnProperty(key)) {
continue;
}
const ex = this._internalExclusions[key];
if (ex.test(url)) {
return false;
}
}
let include = false;
for (let key in opts.fetch_url_inclusion_patterns) {
if (!opts.fetch_url_inclusion_patterns.hasOwnProperty(key)) {
continue;
}
const inc = opts.fetch_url_inclusion_patterns[key];
if (inc.test(url)) {
include = true;
break;
}
if (opts.fetch_url_inclusion_patterns.some(inc => inc.test(url))) {
include = true;
}
if (!include) {
return false;
if (opts.fetch_url_exclusion_patterns.some(ex => ex.test(url))) {
include = false;
}
for (let key in opts.fetch_url_exclusion_patterns) {
if (!opts.fetch_url_exclusion_patterns.hasOwnProperty(key)) {
continue;
}
const ex = opts.fetch_url_exclusion_patterns[key];
if (ex.test(url)) {
return false;
}
}
return true;
return include;
}

@@ -282,0 +264,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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