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

zipkin-javascript-opentracing

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zipkin-javascript-opentracing - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

3

__mocks__/zipkin.js

@@ -127,3 +127,6 @@ const None = {

alwaysSampler: jest.fn(() => true)
},
jsonEncoder: {
JSON_V1: jest.fn()
}
};

45

lib/index.js

@@ -1,15 +0,26 @@

const {
Annotation,
BatchRecorder,
ExplicitContext,
Request,
TraceId,
option: { Some, None },
Tracer,
InetAddress,
sampler
} = require("zipkin");
const { HttpLogger } = require("zipkin-transport-http");
"use strict";
var _require = require("zipkin");
const Annotation = _require.Annotation,
BatchRecorder = _require.BatchRecorder,
ExplicitContext = _require.ExplicitContext,
Request = _require.Request,
TraceId = _require.TraceId;
var _require$option = _require.option;
const Some = _require$option.Some,
None = _require$option.None,
Tracer = _require.Tracer,
InetAddress = _require.InetAddress,
sampler = _require.sampler,
jsonEncoder = _require.jsonEncoder;
var _require2 = require("zipkin-transport-http");
const HttpLogger = _require2.HttpLogger;
const availableTags = require("opentracing").Tags;
const JSON_V2 = jsonEncoder.JSON_V2;
const HttpHeaders = {

@@ -54,3 +65,8 @@ TraceId: "x-b3-traceid",

if (this._constructedFromOutside(options)) {
const { traceId, parentId, spanId, sampled } = options.traceId;
var _options$traceId = options.traceId;
const traceId = _options$traceId.traceId,
parentId = _options$traceId.parentId,
spanId = _options$traceId.spanId,
sampled = _options$traceId.sampled;
return new TraceId({

@@ -180,3 +196,4 @@ traceId: makeOptional(traceId),

logger: new HttpLogger({
endpoint: options.endpoint + "/api/v1/spans"
endpoint: options.endpoint + "/api/v2/spans",
jsonEncoder: JSON_V2
})

@@ -183,0 +200,0 @@ });

{
"name": "zipkin-javascript-opentracing",
"version": "1.3.0",
"version": "1.3.1",
"description": "An opentracing implementation for zipkin",

@@ -28,2 +28,14 @@ "main": "lib/index.js",

},
"babel": {
"presets": [
[
"env",
{
"targets": {
"node": "6"
}
}
]
]
},
"repository": {

@@ -57,2 +69,3 @@ "type": "git",

"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"coveralls": "^3.0.0",

@@ -59,0 +72,0 @@ "express": "^4.16.2",

@@ -41,3 +41,3 @@ jest.disableAutomock();

logger: new HttpLogger({
endpoint: "http://localhost:9411/api/v1/spans"
endpoint: "http://localhost:9411/api/v2/spans"
})

@@ -63,3 +63,3 @@ })

expect(endpoint).toBe("http://localhost:9411/api/v1/spans");
expect(endpoint).toBe("http://localhost:9411/api/v2/spans");
expect(method).toBe("POST");

@@ -71,13 +71,15 @@ expect(Object.keys(headers)).toEqual(

expect(json.length).toBe(1);
expect(Object.keys(json[0])).toEqual([
"traceId",
"name",
"id",
"annotations",
"binaryAnnotations",
"timestamp",
"duration"
]);
expect(json[0].annotations.length).toBe(1);
expect(json[0].annotations[0].endpoint.serviceName).toBe("My Service");
expect(Object.keys(json[0])).toEqual(
expect.arrayContaining([
"traceId",
"name",
"id",
"annotations",
"binaryAnnotations",
"timestamp",
"duration"
])
);
expect(json[0].annotations.length).toBe(2);
expect(json[0].annotations[0].endpoint.serviceName).toBe("my service");
expect(json[0].binaryAnnotations.length).toBe(1);

@@ -102,3 +104,3 @@ expect(json[0].binaryAnnotations[0].value).toBe("My Span");

expect(endpoint).toBe("http://localhost:9411/api/v1/spans");
expect(endpoint).toBe("http://localhost:9411/api/v2/spans");
expect(method).toBe("POST");

@@ -110,13 +112,15 @@ expect(Object.keys(headers)).toEqual(

expect(json.length).toBe(1);
expect(Object.keys(json[0])).toEqual([
"traceId",
"name",
"id",
"annotations",
"binaryAnnotations",
"timestamp",
"duration"
]);
expect(json[0].annotations.length).toBe(1);
expect(json[0].annotations[0].endpoint.serviceName).toBe("My Service");
expect(Object.keys(json[0])).toEqual(
expect.arrayContaining([
"traceId",
"name",
"id",
"annotations",
"binaryAnnotations",
"timestamp",
"duration"
])
);
expect(json[0].annotations.length).toBe(2);
expect(json[0].annotations[0].endpoint.serviceName).toBe("my service");
expect(json[0].binaryAnnotations.length).toBe(3);

@@ -142,3 +146,3 @@ expect(json[0].binaryAnnotations[0].key).toBe("spanName");

logger: new HttpLogger({
endpoint: "http://localhost:9411/api/v1/spans"
endpoint: "http://localhost:9411/api/v2/spans"
})

@@ -161,3 +165,3 @@ }),

expect(endpoint).toBe("http://localhost:9411/api/v1/spans");
expect(endpoint).toBe("http://localhost:9411/api/v2/spans");
expect(method).toBe("POST");

@@ -169,14 +173,15 @@ expect(Object.keys(headers)).toEqual(

expect(json.length).toBe(1);
expect(Object.keys(json[0])).toEqual([
"traceId",
"name",
"id",
"annotations",
"binaryAnnotations"
]);
expect(Object.keys(json[0])).toEqual(
expect.arrayContaining([
"traceId",
"name",
"id",
"annotations",
"timestamp",
"duration"
])
);
expect(json[0].annotations.length).toBe(2);
expect(json[0].annotations[0].endpoint.serviceName).toBe("My Service");
expect(json[0].binaryAnnotations.length).toBe(0);
expect(json[0].name).toBe("My Span");
expect(json[0].annotations[0].endpoint.serviceName).toBe("my service");
expect(json[0].name).toBe("my span");
});

@@ -198,3 +203,3 @@

expect(endpoint).toBe("http://localhost:9411/api/v1/spans");
expect(endpoint).toBe("http://localhost:9411/api/v2/spans");
expect(method).toBe("POST");

@@ -206,11 +211,13 @@ expect(Object.keys(headers)).toEqual(

expect(json.length).toBe(1);
expect(Object.keys(json[0])).toEqual([
"traceId",
"name",
"id",
"annotations",
"binaryAnnotations"
]);
expect(Object.keys(json[0])).toEqual(
expect.arrayContaining([
"traceId",
"name",
"id",
"annotations",
"duration"
])
);
expect(json[0].annotations.length).toBe(2);
expect(json[0].annotations[0].endpoint.serviceName).toBe("My Service");
expect(json[0].annotations[0].endpoint.serviceName).toBe("my service");
expect(json[0].binaryAnnotations.length).toBe(2);

@@ -221,3 +228,3 @@ expect(json[0].binaryAnnotations[0].key).toBe("statusCode");

expect(json[0].binaryAnnotations[1].value).toBe("42");
expect(json[0].name).toBe("My Span");
expect(json[0].name).toBe("my span");
});

@@ -281,3 +288,3 @@ });

expect(endpoint).toBe("http://localhost:9411/api/v1/spans");
expect(endpoint).toBe("http://localhost:9411/api/v2/spans");
expect(method).toBe("POST");

@@ -310,3 +317,3 @@ expect(Object.keys(headers)).toEqual(

expect(endpoint).toBe("http://localhost:9411/api/v1/spans");
expect(endpoint).toBe("http://localhost:9411/api/v2/spans");
expect(method).toBe("POST");

@@ -331,3 +338,3 @@ expect(Object.keys(headers)).toEqual(

logger: new HttpLogger({
endpoint: "http://localhost:9411/api/v1/spans"
endpoint: "http://localhost:9411/api/v2/spans"
})

@@ -413,3 +420,3 @@ }),

expect(endpoint).toBe("http://localhost:9411/api/v1/spans");
expect(endpoint).toBe("http://localhost:9411/api/v2/spans");
expect(method).toBe("POST");

@@ -421,16 +428,18 @@ expect(Object.keys(headers)).toEqual(

expect(json.length).toBe(1);
expect(Object.keys(json[0])).toEqual([
"traceId",
"name",
"id",
"annotations",
"binaryAnnotations"
]);
expect(json[0].annotations.length).toBe(2);
expect(json[0].annotations[0].endpoint.serviceName).toBe("My Service");
expect(Object.keys(json[0])).toEqual(
expect.arrayContaining([
"traceId",
"id",
"name",
"kind",
"timestamp",
"duration",
"localEndpoint"
])
);
expect(json[0].localEndpoint.serviceName).toBe("my service");
expect(json[0].binaryAnnotations.length).toBe(0);
expect(json[0].name).toBe("My Span");
expect(json[0].name).toBe("my span");
});
});
});

@@ -10,6 +10,8 @@ const {

InetAddress,
sampler
sampler,
jsonEncoder
} = require("zipkin");
const { HttpLogger } = require("zipkin-transport-http");
const availableTags = require("opentracing").Tags;
const { JSON_V2 } = jsonEncoder;

@@ -194,3 +196,4 @@ const HttpHeaders = {

logger: new HttpLogger({
endpoint: options.endpoint + "/api/v1/spans"
endpoint: options.endpoint + "/api/v2/spans",
jsonEncoder: JSON_V2
})

@@ -197,0 +200,0 @@ });

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