Skip to content

Commit

Permalink
Merge branch 'master' into global-api
Browse files Browse the repository at this point in the history
  • Loading branch information
dyladan authored Apr 8, 2020
2 parents 94d557b + 4a5717c commit c16c9dd
Show file tree
Hide file tree
Showing 36 changed files with 73 additions and 37 deletions.
2 changes: 1 addition & 1 deletion packages/opentelemetry-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@opentelemetry/context-base": "^0.6.0"
},
"devDependencies": {
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"@types/webpack-env": "1.13.9",
"codecov": "^3.6.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"access": "public"
},
"devDependencies": {
"@types/mocha": "^5.2.5",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"codecov": "^3.6.1",
"gts": "^1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-context-async-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"access": "public"
},
"devDependencies": {
"@types/mocha": "^5.2.5",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"@types/shimmer": "^1.0.1",
"codecov": "^3.6.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-context-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"access": "public"
},
"devDependencies": {
"@types/mocha": "^5.2.5",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"codecov": "^3.6.1",
"gts": "^1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-context-zone-peer-dep/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"devDependencies": {
"@babel/core": "^7.6.0",
"@types/mocha": "^5.2.5",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"@types/sinon": "^7.0.13",
"@types/webpack-env": "1.13.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-context-zone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"devDependencies": {
"@babel/core": "^7.6.0",
"@types/mocha": "^5.2.5",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"@types/sinon": "^7.0.13",
"@types/webpack-env": "1.13.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"access": "public"
},
"devDependencies": {
"@types/mocha": "^5.2.5",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"@types/semver": "^6.2.0",
"@types/sinon": "^7.0.13",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-exporter-collector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
"devDependencies": {
"@babel/core": "^7.6.0",
"@types/mocha": "^5.2.5",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"@types/sinon": "^7.0.13",
"@types/webpack-env": "1.13.9",
Expand Down
7 changes: 6 additions & 1 deletion packages/opentelemetry-exporter-jaeger/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# OpenTelemetry Jaeger Trace Exporter

[![Gitter chat][gitter-image]][gitter-url]
[![NPM Published Version][npm-img]][npm-url]
[![dependencies][dependencies-image]][dependencies-url]
Expand Down Expand Up @@ -54,6 +55,10 @@ npm install --save @opentelemetry/exporter-jaeger

Install the exporter on your application and pass the options, it must contain a service name.

Furthermore, the `host` option (which defaults to `localhost`), can instead be set by the
`JAEGER_AGENT_HOST` environment variable to reduce in-code config. If both are
set, the value set by the option in code is authoritative.

```js
import { JaegerExporter } from '@opentelemetry/exporter-jaeger';

Expand All @@ -78,8 +83,8 @@ You can use built-in `SimpleSpanProcessor` or `BatchSpanProcessor` or write your
- [SimpleSpanProcessor](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/sdk-tracing.md#simple-processor): The implementation of `SpanProcessor` that passes ended span directly to the configured `SpanExporter`.
- [BatchSpanProcessor](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/sdk-tracing.md#batching-processor): The implementation of the `SpanProcessor` that batches ended spans and pushes them to the configured `SpanExporter`. It is recommended to use this `SpanProcessor` for better performance and optimization.


## Useful links

- To know more about Jaeger, visit: https://www.jaegertracing.io/docs/latest/getting-started/
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-exporter-jaeger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"devDependencies": {
"@opentelemetry/resources": "^0.6.0",
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.9",
"codecov": "^3.6.1",
"gts": "^1.1.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/opentelemetry-exporter-jaeger/src/jaeger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export class JaegerExporter implements SpanExporter {
this._onShutdownFlushTimeout =
typeof config.flushTimeout === 'number' ? config.flushTimeout : 2000;

config.host = config.host || process.env.JAEGER_AGENT_HOST;

this._sender = new jaegerTypes.UDPSender(config);
if (this._sender._client instanceof Socket) {
// unref socket to prevent it from keeping the process running
Expand Down
31 changes: 30 additions & 1 deletion packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ import { Resource } from '@opentelemetry/resources';

describe('JaegerExporter', () => {
describe('constructor', () => {
afterEach(() => {
delete process.env.JAEGER_AGENT_HOST;
});

it('should construct an exporter', () => {
const exporter = new JaegerExporter({ serviceName: 'opentelemetry' });
assert.ok(typeof exporter.export === 'function');
Expand All @@ -38,7 +42,7 @@ describe('JaegerExporter', () => {
it('should construct an exporter with host, port, logger and tags', () => {
const exporter = new JaegerExporter({
serviceName: 'opentelemetry',
host: 'localhost',
host: 'remotehost',
port: 8080,
logger: new NoopLogger(),
tags: [{ key: 'opentelemetry-exporter-jaeger', value: '0.1.0' }],
Expand All @@ -47,13 +51,38 @@ describe('JaegerExporter', () => {
assert.ok(typeof exporter.shutdown === 'function');

const process: ThriftProcess = exporter['_sender']._process;
assert.strictEqual(exporter['_sender']._host, 'remotehost');
assert.strictEqual(process.serviceName, 'opentelemetry');
assert.strictEqual(process.tags.length, 1);
assert.strictEqual(process.tags[0].key, 'opentelemetry-exporter-jaeger');
assert.strictEqual(process.tags[0].vType, 'STRING');
assert.strictEqual(process.tags[0].vStr, '0.1.0');
});

it('should default to localhost if no host is configured', () => {
const exporter = new JaegerExporter({
serviceName: 'opentelemetry',
});
assert.strictEqual(exporter['_sender']._host, 'localhost');
});

it('should respect jaeger host env variable', () => {
process.env.JAEGER_AGENT_HOST = 'env-set-host';
const exporter = new JaegerExporter({
serviceName: 'test-service',
});
assert.strictEqual(exporter['_sender']._host, 'env-set-host');
});

it('should prioritize host option over env variable', () => {
process.env.JAEGER_AGENT_HOST = 'env-set-host';
const exporter = new JaegerExporter({
serviceName: 'test-service',
host: 'option-set-host',
});
assert.strictEqual(exporter['_sender']._host, 'option-set-host');
});

it('should construct an exporter with flushTimeout', () => {
const exporter = new JaegerExporter({
serviceName: 'opentelemetry',
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-exporter-prometheus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"access": "public"
},
"devDependencies": {
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.9",
"codecov": "^3.6.1",
"gts": "^1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-exporter-zipkin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"access": "public"
},
"devDependencies": {
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/nock": "^10.0.3",
"@types/node": "^12.6.9",
"codecov": "^3.6.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"access": "public"
},
"devDependencies": {
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.9",
"@types/sinon": "^7.0.13",
"codecov": "^3.6.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"devDependencies": {
"@opentelemetry/context-base": "^0.6.0",
"@opentelemetry/resources": "^0.6.0",
"@types/mocha": "^5.2.5",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"@types/semver": "^6.0.1",
"@types/shimmer": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-dns/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"devDependencies": {
"@opentelemetry/node": "^0.6.0",
"@opentelemetry/tracing": "^0.6.0",
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/node": "^12.7.12",
"@types/semver": "^6.2.0",
"@types/shimmer": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-document-load/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"devDependencies": {
"@babel/core": "^7.6.0",
"@types/mocha": "^5.2.5",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"@types/sinon": "^7.0.13",
"@types/webpack-env": "1.13.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@opentelemetry/node": "^0.6.0",
"@opentelemetry/tracing": "^0.6.0",
"@types/express": "^4.17.2",
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/node": "^12.7.2",
"@types/shimmer": "^1.0.1",
"codecov": "^3.6.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-grpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@opentelemetry/context-base": "^0.6.0",
"@opentelemetry/node": "^0.6.0",
"@opentelemetry/tracing": "^0.6.0",
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.9",
"@types/semver": "^6.2.0",
"@types/shimmer": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@opentelemetry/node": "^0.6.0",
"@opentelemetry/tracing": "^0.6.0",
"@types/got": "^9.6.7",
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/nock": "^11.1.0",
"@types/node": "^12.12.9",
"@types/request-promise-native": "^1.0.17",
Expand Down
6 changes: 3 additions & 3 deletions packages/opentelemetry-plugin-http/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ export const parseResponseStatus = (
* Returns whether the Expect header is on the given options object.
* @param options Options for http.request.
*/
export const hasExpectHeader = (options: RequestOptions | url.URL): boolean => {
if (typeof (options as RequestOptions).headers !== 'object') {
export const hasExpectHeader = (options: RequestOptions): boolean => {
if (!options.headers) {
return false;
}

const keys = Object.keys((options as RequestOptions).headers!);
const keys = Object.keys(options.headers);
return !!keys.find(key => key.toLowerCase() === 'expect');
};

Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-https/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@opentelemetry/node": "^0.6.0",
"@opentelemetry/tracing": "^0.6.0",
"@types/got": "^9.6.7",
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/nock": "^11.1.0",
"@types/node": "^12.12.9",
"@types/request-promise-native": "^1.0.17",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-ioredis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@opentelemetry/test-utils": "^0.6.0",
"@opentelemetry/tracing": "^0.6.0",
"@types/ioredis": "^4.14.3",
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/node": "^13.1.0",
"@types/shimmer": "^1.0.1",
"codecov": "^3.6.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-mongodb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@opentelemetry/context-async-hooks": "^0.6.0",
"@opentelemetry/node": "^0.6.0",
"@opentelemetry/tracing": "^0.6.0",
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/mongodb": "^3.2.3",
"@types/node": "^12.7.2",
"@types/shimmer": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-mysql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@opentelemetry/node": "^0.6.0",
"@opentelemetry/test-utils": "^0.6.0",
"@opentelemetry/tracing": "^0.6.0",
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/mysql": "^2.15.4",
"@types/node": "^12.6.9",
"@types/shimmer": "^1.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@opentelemetry/context-async-hooks": "^0.6.0",
"@opentelemetry/plugin-pg": "^0.6.0",
"@opentelemetry/test-utils": "^0.6.0",
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.9",
"@types/pg": "^7.11.2",
"@types/pg-pool": "^2.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@opentelemetry/node": "^0.6.0",
"@opentelemetry/test-utils": "^0.6.0",
"@opentelemetry/tracing": "^0.6.0",
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.9",
"@types/pg": "^7.11.2",
"@types/shimmer": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-redis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@opentelemetry/node": "^0.6.0",
"@opentelemetry/test-utils": "^0.6.0",
"@opentelemetry/tracing": "^0.6.0",
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.9",
"@types/redis": "^2.8.14",
"@types/shimmer": "^1.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@opentelemetry/plugin-xml-http-request": "^0.6.0",
"@opentelemetry/tracing": "^0.6.0",
"@types/jquery": "^3.3.31",
"@types/mocha": "^5.2.5",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"@types/shimmer": "^1.0.1",
"@types/sinon": "^7.0.13",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@babel/core": "^7.6.0",
"@opentelemetry/context-zone": "^0.6.0",
"@opentelemetry/tracing": "^0.6.0",
"@types/mocha": "^5.2.5",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"@types/shimmer": "^1.0.1",
"@types/sinon": "^7.0.13",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-propagator-jaeger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"access": "public"
},
"devDependencies": {
"@types/mocha": "^5.2.5",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"@types/sinon": "^7.0.13",
"@types/webpack-env": "1.13.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"access": "public"
},
"devDependencies": {
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.9",
"codecov": "^3.6.1",
"gts": "^1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-shim-opentracing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"devDependencies": {
"@opentelemetry/tracing": "^0.6.0",
"@types/mocha": "^5.2.7",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.9",
"codecov": "^3.6.1",
"gts": "^1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-tracing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"access": "public"
},
"devDependencies": {
"@types/mocha": "^5.2.5",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"@types/sinon": "^7.0.13",
"@types/webpack-env": "1.13.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@opentelemetry/context-zone": "^0.6.0",
"@opentelemetry/resources": "^0.6.0",
"@types/jquery": "^3.3.31",
"@types/mocha": "^5.2.5",
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"@types/sinon": "^7.0.13",
"@types/webpack-env": "1.13.9",
Expand Down

0 comments on commit c16c9dd

Please sign in to comment.