Socket
Socket
Sign inDemoInstall

zipkin

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zipkin - npm Package Compare versions

Comparing version 0.2.2 to 0.2.4

test/internalRepresentations.test.js

2

package.json
{
"name": "zipkin",
"version": "0.2.2",
"version": "0.2.4",
"description": "The core tracer for zipkin.js",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -9,2 +9,6 @@ const thriftTypes = require('./gen-nodejs/zipkinCore_types');

}
function formatIPv4(host) {
return host ?
`${host >> 24 & 255}.${(host >> 16) & 255}.${(host >> 8) & 255}.${host & 255}` : 0;
}
Endpoint.prototype.isUnknown = function isUnknown() {

@@ -19,2 +23,8 @@ return this.host === 0 && this.port === 0;

};
Endpoint.prototype.toJSON = function toJSON() {
return {
ipv4: formatIPv4(this.host),
port: this.port
};
};

@@ -41,2 +51,15 @@ function ZipkinAnnotation({timestamp, value, endpoint, duration}) {

};
ZipkinAnnotation.prototype.toJSON = function toJSON() {
const res = {
value: this.value,
timestamp: this.timestamp
};
if (this.endpoint) {
res.endpoint = this.endpoint.toJSON();
}
if (this.duration) {
res.duration = this.duration;
}
return res;
};
ZipkinAnnotation.prototype.toString = function toString() {

@@ -62,2 +85,12 @@ return `Annotation(value="${this.value}")`;

};
BinaryAnnotation.prototype.toJSON = function toJSON() {
const res = {
key: this.key,
value: this.value
};
if (this.endpoint) {
res.endpoint = this.endpoint.toJSON();
}
return res;
};

@@ -106,2 +139,7 @@ function MutableSpan(traceId) {

};
MutableSpan.prototype.overrideEndpointJSON = function overrideEndpointJSON(ann) {
if (!ann.endpoint) {
ann.endpoint = this.endpoint.toJSON();
}
};
MutableSpan.prototype.toThrift = function toThrift() {

@@ -133,2 +171,27 @@ const span = new thriftTypes.Span();

};
MutableSpan.prototype.toJSON = function toJSON() {
const trace = this.traceId;
const spanJson = {
traceId: trace.traceId,
name: this.name.getOrElse('Unknown'),
id: trace.spanId,
timestamp: this.started
};
trace._parentId.ifPresent(id => {
spanJson.parentId = id;
});
spanJson.annotations = this.annotations.map(ann => {
const annotationJson = ann.toJSON();
this.overrideEndpointJSON(annotationJson);
annotationJson.endpoint.serviceName = this.service.getOrElse('Unknown');
return annotationJson;
});
spanJson.binaryAnnotations = this.binaryAnnotations.map(ann => {
const annotationJson = ann.toJSON();
this.overrideEndpointJSON(annotationJson);
annotationJson.endpoint.serviceName = this.service.getOrElse('Unknown');
return annotationJson;
});
return spanJson;
};
MutableSpan.prototype.toString = function toString() {

@@ -135,0 +198,0 @@ const annotations = this.annotations.map(a => a.toString()).join(', ');

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