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

opentracing

Package Overview
Dependencies
Maintainers
5
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opentracing - npm Package Compare versions

Comparing version 0.14.1 to 0.14.2

lib/test/mocktracer_implemenation.d.ts

2

lib/binary_carrier.js

@@ -9,3 +9,3 @@ "use strict";

*/
var BinaryCarrier = (function () {
var BinaryCarrier = /** @class */ (function () {
function BinaryCarrier(buffer) {

@@ -12,0 +12,0 @@ this.buffer = buffer;

@@ -50,3 +50,3 @@ /**

*
* See more about reference types at http://opentracing.io/spec/
* See more about reference types at https://github.com/opentracing/specification
*/

@@ -59,4 +59,4 @@ export declare const REFERENCE_CHILD_OF = "child_of";

*
* See more about reference types at http://opentracing.io/spec/
* See more about reference types at https://github.com/opentracing/specification
*/
export declare const REFERENCE_FOLLOWS_FROM = "follows_from";

@@ -52,3 +52,3 @@ "use strict";

*
* See more about reference types at http://opentracing.io/spec/
* See more about reference types at https://github.com/opentracing/specification
*/

@@ -61,5 +61,5 @@ exports.REFERENCE_CHILD_OF = 'child_of';

*
* See more about reference types at http://opentracing.io/spec/
* See more about reference types at https://github.com/opentracing/specification
*/
exports.REFERENCE_FOLLOWS_FROM = 'follows_from';
//# sourceMappingURL=constants.js.map

@@ -1,1 +0,1 @@

import '../../index';
export {};

@@ -0,8 +1,7 @@

"use strict";
/* eslint-disable */
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("../../index");
var mock_tracer_1 = require("../../mock_tracer");
var index_1 = require("../../index");
console.log('\nRunning demo...\n');
var tracer = new mock_tracer_1.MockTracer();
var tracer = new index_1.MockTracer();
console.log('Starting parent.');

@@ -9,0 +8,0 @@ var parent = tracer.startSpan('parent_span');

@@ -27,3 +27,3 @@ "use strict";

// case where
var GlobalTracerDelegate = (function (_super) {
var GlobalTracerDelegate = /** @class */ (function (_super) {
__extends(GlobalTracerDelegate, _super);

@@ -30,0 +30,0 @@ function GlobalTracerDelegate() {

@@ -6,6 +6,7 @@ import BinaryCarrier from './binary_carrier';

import SpanContext from './span_context';
import Tracer from './tracer';
export { BinaryCarrier, Reference, SpanContext, Span, Tracer, Tags };
import { SpanOptions, Tracer } from './tracer';
import { MockTracer } from './mock_tracer';
export { BinaryCarrier, Reference, SpanContext, Span, Tracer, SpanOptions, Tags, MockTracer };
export * from './global_tracer';
export * from './constants';
export * from './functions';

@@ -18,3 +18,5 @@ "use strict";

var tracer_1 = require("./tracer");
exports.Tracer = tracer_1.default;
exports.Tracer = tracer_1.Tracer;
var mock_tracer_1 = require("./mock_tracer");
exports.MockTracer = mock_tracer_1.MockTracer;
__export(require("./global_tracer"));

@@ -21,0 +23,0 @@ __export(require("./constants"));

import * as opentracing from '../index';
import MockSpan from './mock_span';
/**

@@ -8,4 +9,5 @@ * OpenTracing Context implementation designed for use in

private _span;
constructor(span: opentracing.Span);
constructor(span: MockSpan);
span(): MockSpan;
}
export default MockContext;

@@ -18,3 +18,3 @@ "use strict";

*/
var MockContext = (function (_super) {
var MockContext = /** @class */ (function (_super) {
__extends(MockContext, _super);

@@ -28,2 +28,5 @@ function MockContext(span) {

}
MockContext.prototype.span = function () {
return this._span;
};
return MockContext;

@@ -30,0 +33,0 @@ }(opentracing.SpanContext));

@@ -9,3 +9,3 @@ "use strict";

*/
var MockReport = (function () {
var MockReport = /** @class */ (function () {
function MockReport(spans) {

@@ -12,0 +12,0 @@ var _this = this;

@@ -41,2 +41,3 @@ import * as opentracing from '../index';

};
tracer(): opentracing.Tracer;
private _generateUUID();

@@ -43,0 +44,0 @@ addReference(ref: Reference): void;

@@ -0,3 +1,3 @@

"use strict";
/* eslint-disable import/no-extraneous-dependencies */
"use strict";
var __extends = (this && this.__extends) || (function () {

@@ -20,3 +20,3 @@ var extendStatics = Object.setPrototypeOf ||

*/
var MockSpan = (function (_super) {
var MockSpan = /** @class */ (function (_super) {
__extends(MockSpan, _super);

@@ -74,2 +74,5 @@ //------------------------------------------------------------------------//

};
MockSpan.prototype.tracer = function () {
return this._mockTracer;
};
MockSpan.prototype._generateUUID = function () {

@@ -76,0 +79,0 @@ var p0 = ("00000000" + Math.abs((Math.random() * 0xFFFFFFFF) | 0).toString(16)).substr(-8);

@@ -9,5 +9,3 @@ import * as opentracing from '../index';

private _spans;
protected _startSpan(name: string, fields: {
[key: string]: any;
}): MockSpan;
protected _startSpan(name: string, fields: opentracing.SpanOptions): MockSpan;
protected _inject(span: MockSpan, format: any, carrier: any): never;

@@ -14,0 +12,0 @@ protected _extract(format: any, carrier: any): never;

@@ -20,3 +20,3 @@ "use strict";

*/
var MockTracer = (function (_super) {
var MockTracer = /** @class */ (function (_super) {
__extends(MockTracer, _super);

@@ -42,4 +42,5 @@ //------------------------------------------------------------------------//

if (fields.references) {
for (var i = 0; i < fields.references; i++) {
span.addReference(fields.references[i]);
for (var _i = 0, _a = fields.references; _i < _a.length; _i++) {
var ref = _a[_i];
span.addReference(ref);
}

@@ -46,0 +47,0 @@ }

@@ -10,3 +10,3 @@ "use strict";

*/
var Reference = (function () {
var Reference = /** @class */ (function () {
/**

@@ -13,0 +13,0 @@ * Initialize a new Reference instance.

@@ -13,3 +13,3 @@ "use strict";

*/
var SpanContext = (function () {
var SpanContext = /** @class */ (function () {
function SpanContext() {

@@ -16,0 +16,0 @@ }

@@ -10,3 +10,3 @@ "use strict";

*/
var Span = (function () {
var Span = /** @class */ (function () {
function Span() {

@@ -13,0 +13,0 @@ }

import { Tracer } from '../index';
export interface ApiCompatibilityChecksOptions {
/** a boolean that controls whether or not to verify baggage values */
checkBaggageValues?: boolean;
/** a boolean that controls whether or not to verify certain API functionality */
skipBaggageChecks?: boolean;
skipInjectExtractChecks?: boolean;
}

@@ -13,3 +14,3 @@ /**

*/
export declare function apiCompatibilityChecks(createTracer?: () => Tracer, options?: ApiCompatibilityChecksOptions): void;
declare function apiCompatibilityChecks(createTracer?: () => Tracer, options?: ApiCompatibilityChecksOptions): void;
export default apiCompatibilityChecks;

@@ -14,3 +14,3 @@ "use strict";

if (createTracer === void 0) { createTracer = function () { return new index_1.Tracer(); }; }
if (options === void 0) { options = {}; }
if (options === void 0) { options = { skipBaggageChecks: false, skipInjectExtractChecks: false }; }
describe('OpenTracing API Compatibility', function () {

@@ -31,3 +31,3 @@ var tracer;

describe('inject', function () {
it('should not throw exception on required carrier types', function () {
(options.skipInjectExtractChecks ? it.skip : it)('should not throw exception on required carrier types', function () {
var spanContext = span.context();

@@ -40,3 +40,3 @@ var textCarrier = {};

});
it('should handle Spans and SpanContexts', function () {
(options.skipInjectExtractChecks ? it.skip : it)('should handle Spans and SpanContexts', function () {
var textCarrier = {};

@@ -48,3 +48,3 @@ chai_1.expect(function () { tracer.inject(span, index_1.FORMAT_TEXT_MAP, textCarrier); }).to.not.throw(Error);

describe('extract', function () {
it('should not throw exception on required carrier types', function () {
(options.skipInjectExtractChecks ? it.skip : it)('should not throw exception on required carrier types', function () {
var textCarrier = {};

@@ -60,8 +60,6 @@ var binCarrier = new index_1.BinaryCarrier([1, 2, 3]);

describe('Span', function () {
it('should set baggage and retrieve baggage', function () {
(options.skipBaggageChecks ? it.skip : it)('should set baggage and retrieve baggage', function () {
span.setBaggageItem('some-key', 'some-value');
var val = span.getBaggageItem('some-key');
if (options.checkBaggageValues) {
chai_1.assert.equal('some-value', val);
}
chai_1.assert.equal('some-value', val);
});

@@ -83,4 +81,3 @@ describe('finish', function () {

}
exports.apiCompatibilityChecks = apiCompatibilityChecks;
exports.default = apiCompatibilityChecks;
//# sourceMappingURL=api_compatibility.js.map

@@ -15,4 +15,2 @@ "use strict";

var opentracing = require("../index");
var span_1 = require("../span");
var tracer_1 = require("../tracer");
function opentracingAPITests() {

@@ -61,5 +59,5 @@ describe('Opentracing API', function () {

describe('global tracer', function () {
var dummySpan = new span_1.default();
var dummySpan = new opentracing.Span();
afterEach(function () {
opentracing.initGlobalTracer(new tracer_1.Tracer());
opentracing.initGlobalTracer(new opentracing.Tracer());
});

@@ -72,3 +70,3 @@ it('should use the global tracer', function () {

});
var TestTracer = (function (_super) {
var TestTracer = /** @class */ (function (_super) {
__extends(TestTracer, _super);

@@ -82,3 +80,3 @@ function TestTracer() {

return TestTracer;
}(tracer_1.Tracer));
}(opentracing.Tracer));
});

@@ -85,0 +83,0 @@ });

@@ -6,10 +6,14 @@ "use strict";

var api_compatibility_1 = require("./api_compatibility");
var mocktracer_implemenation_1 = require("./mocktracer_implemenation");
var noop_implementation_1 = require("./noop_implementation");
var opentracing_api_1 = require("./opentracing_api");
var index_js_1 = require("../index.js");
mocktracer_implemenation_1.default();
api_compatibility_1.default(function () { return new index_js_1.MockTracer(); }, { skipInjectExtractChecks: true, skipBaggageChecks: true });
// Run the tests on the default OpenTracing no-op Tracer.
noop_implementation_1.default();
// Run the api conformance tests on the default Opentracing no-op Tracer.
api_compatibility_1.default();
api_compatibility_1.default(function () { return new index_js_1.Tracer(); }, { skipBaggageChecks: true });
// Basic unittests for opentracing
opentracing_api_1.default();
//# sourceMappingURL=unittest.js.map

@@ -17,3 +17,3 @@ "use strict";

*/
var Tracer = (function () {
var Tracer = /** @class */ (function () {
function Tracer() {

@@ -20,0 +20,0 @@ }

{
"name": "opentracing",
"version": "0.14.1",
"version": "0.14.2",
"engines": {
"node": ">=0.10"
},
"licence": "MIT",
"license": "MIT",
"licenses": [

@@ -54,5 +54,5 @@ {

"typedoc": "^0.5.10",
"typescript": "^2.2.2",
"typescript": "~2.7.1",
"webpack": "^2.3.3"
}
}

@@ -22,3 +22,3 @@ [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![NPM Published Version][npm-img]][npm] ![Node Version][node-img]

The package contains a example using a naive `MockTracer` implementation. To run the example:
The package contains an example using a naive `MockTracer` implementation. To run the example:

@@ -71,3 +71,3 @@ ```bash

});
res.on('end', () {
res.on('end', () => {
span.log({'event': 'request_end'});

@@ -96,3 +96,3 @@ span.finish();

Since the source is written in TypeScript, if you are using TypeScript, you can just `npm install` the package and it will work out of the box.
This is especially useful for implementators who want to typecheck their implementation with the base interface.
This is especially useful for implementors who want to type check their implementation with the base interface.

@@ -109,3 +109,3 @@ ### Global tracer

Note: `globalTracer()` returns a wrapper on the actual tracer object. This is done for convenience of use as it ensures that the function will always return a non-null object. This can be helpful in cases where it is difficult or impossible to know precisely when `initGlobalTracer` is called (for example, when writing a utility library that does not control the initialization process). For more precise control, individual `Tracer` objects can be used instead of the global tracer.
Note: `globalTracer()` returns a wrapper on the actual tracer object. This is done for the convenience of use as it ensures that the function will always return a non-null object. This can be helpful in cases where it is difficult or impossible to know precisely when `initGlobalTracer` is called (for example, when writing a utility library that does not control the initialization process). For more precise control, individual `Tracer` objects can be used instead of the global tracer.

@@ -134,3 +134,3 @@ ## API Documentation

Implementations can subclass `opentracing.Trace`, `opentracing.Span`, and the other API classes to build a OpenTracing tracer and implement the underscore prefixed methods such as `_addTag` to pick up a bit of common code implemented in the base classes.
Implementations can subclass `opentracing.Trace`, `opentracing.Span`, and the other API classes to build an OpenTracing tracer and implement the underscore prefixed methods such as `_addTag` to pick up a bit of common code implemented in the base classes.

@@ -142,9 +142,12 @@ ### API compatibility testing

```javascript
const { apiCompatibilityChecks } = require('opentracing/lib/test/api_compatibility.js');
const apiCompatibilityChecks = require('opentracing/lib/test/api_compatibility.js').default;
apiCompatibilityChecks(() => new CustomTracer());
```
## LICENSE
Apache License 2.0
### MockTracer
An minimal example tracer is provided in the `src/mock_tracer` directory of the source code.
A minimal example tracer is provided in the `src/mock_tracer` directory of the source code.

@@ -159,1 +162,2 @@ [ci-img]: https://travis-ci.org/opentracing/opentracing-javascript.svg?branch=master

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

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

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