Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into fix_flow_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
oibe committed Oct 16, 2016
2 parents 594a528 + d09c598 commit 6d93c38
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,6 +1,7 @@
coverage/
node_modules/
npm-debug.log
dist/

.idea/
*.iml
7 changes: 7 additions & 0 deletions .istanbul.yml
@@ -0,0 +1,7 @@
instrumentation:
root: src
include-all-sources: true
verbose: true
excludes: ["./dist"]
reporting:
dir: "coverage"
27 changes: 27 additions & 0 deletions entrypoint.js
@@ -0,0 +1,27 @@
var initTracer = require('./dist/src/index.js').initTracer;
var ConstSampler = require('./dist/src/samplers/const_sampler.js').default;
var ProbabilisticSampler = require('./dist/src/samplers/probabilistic_sampler.js').default;
var RateLimitingSampler = require('./dist/src/samplers/ratelimiting_sampler.js').default;
var RemoteSampler = require('./dist/src/samplers/remote_sampler.js').default;
var CompositeReporter = require('./dist/src/reporters/composite_reporter.js').default;
var InMemoryReporter = require('./dist/src/reporters/in_memory_reporter.js').default;
var LoggingReporter = require('./dist/src/reporters/logging_reporter.js').default;
var NoopReporter = require('./dist/src/reporters/noop_reporter.js').default;
var RemoteReporter = require('./dist/src/reporters/remote_reporter.js').default;
var SpanContext = require('./dist/src/span_context.js').default;
var TestUtils = require('./dist/src/test_util.js').default

module.exports = {
initTracer: initTracer,
ConstSampler: ConstSampler,
ProbabilisticSampler: ProbabilisticSampler,
RateLimitingSampler: RateLimitingSampler,
RemoteSampler: RemoteSampler,
CompositeReporter: CompositeReporter,
InMemoryReporter: InMemoryReporter,
LoggingReporter: LoggingReporter,
NoopReporter: NoopReporter,
RemoteReporter: RemoteReporter,
TestUtils: TestUtils,
SpanContext: SpanContext
};
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -5,7 +5,7 @@
"licence": "MIT",
"keywords": [],
"author": "oibe <oibe@uber.com>",
"main": "./dist/src/index.js",
"main": "./entrypoint.js",
"repository": {
"type": "git",
"url": "git://github.com/uber/jaeger-client-node.git"
Expand Down Expand Up @@ -48,7 +48,7 @@
"lodash": "^4.15.0",
"minimist": "1.2.0",
"mocha": "^3.0.1",
"opentracing": "git://github.com/opentracing/opentracing-javascript.git#575e8149aadba97d27e9cadff3b8e47a15c2db09",
"opentracing": "^0.13.0",
"rsvp": "^3.3.1",
"sinon": "^1.17.5",
"uber-licence": "^2.0.2",
Expand All @@ -64,7 +64,7 @@
"flow": "flow; test $? -eq 0 -o $? -eq 2",
"lint": "eslint $(ls src/ | grep '.js$') && echo '# linter passed'",
"lint-ci": "npm run lint && echo '# TODO: ADD npm run check-license'",
"test": "npm run flow & npm run lint && ./node_modules/mocha/bin/mocha --compilers js:babel-core/register",
"test": "make build-node; npm run flow & npm run lint && ./node_modules/mocha/bin/mocha --compilers js:babel-core/register",
"test-ci": "npm run test && npm run lint-ci && npm run cover",
"show-cover": "open coverage/lcov-report/index.html"
}
Expand Down
12 changes: 6 additions & 6 deletions src/configuration.js
Expand Up @@ -139,14 +139,14 @@ export default class Configuration {
if (config.disable) {
return new opentracing.Tracer();
} else {
if (config.sampler) {
sampler = Configuration._getSampler(config);
} else {
sampler = new RemoteSampler(config.serviceName);
}

if (!options.reporter) {
reporter = Configuration._getReporter(config, options);

if (config.sampler) {
sampler = Configuration._getSampler(config);
} else {
sampler = new RemoteSampler(config.serviceName);
}
} else {
reporter = options.reporter;
}
Expand Down
39 changes: 39 additions & 0 deletions test/entrypoint.js
@@ -0,0 +1,39 @@
// Copyright (c) 2016 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import {expect} from 'chai';
import entrypoint from '../entrypoint';

describe('entrypoint', () => {
it ('should import and create objects without error', () => {
expect(entrypoint.initTracer).to.be.a('function');
expect(entrypoint.ConstSampler).to.be.a('function');
expect(entrypoint.ProbabilisticSampler).to.be.a('function');
expect(entrypoint.RateLimitingSampler).to.be.a('function');
expect(entrypoint.RemoteSampler).to.be.a('function');
expect(entrypoint.CompositeReporter).to.be.a('function');
expect(entrypoint.InMemoryReporter).to.be.a('function');
expect(entrypoint.LoggingReporter).to.be.a('function');
expect(entrypoint.NoopReporter).to.be.a('function');
expect(entrypoint.RemoteReporter).to.be.a('function');
expect(entrypoint.TestUtils).to.be.a('function');
expect(entrypoint.SpanContext).to.be.a('function');
});
});

0 comments on commit 6d93c38

Please sign in to comment.