Skip to content

Commit

Permalink
Merge branch 'main' into eslint-indent
Browse files Browse the repository at this point in the history
  • Loading branch information
legendecas authored Apr 26, 2022
2 parents 4f08217 + 6710cdd commit 2c6d78f
Show file tree
Hide file tree
Showing 36 changed files with 57 additions and 46 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ All notable changes to this project will be documented in this file.

### :rocket: (Enhancement)

* feat(ConsoleSpanExporter): export span links [#2917](https://github.com/open-telemetry/opentelemetry-js/pull/2917) @trentm

### :bug: (Bug Fix)

### :books: (Refine Doc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"webpack": "4.46.0",
"webpack-cli": "4.9.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"mocha": "7.2.0",
"nyc": "15.1.0",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"webpack": "4.46.0"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"webpack": "4.46.0",
"webpack-cli": "4.9.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"nyc": "15.1.0",
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"webpack": "4.46.0",
"webpack-cli": "4.9.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"rimraf": "3.0.2",
"semver": "7.3.5",
"sinon": "12.0.1",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"superagent": "6.1.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"webpack": "4.46.0",
"webpack-cli": "4.9.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"webpack": "4.46.0",
"webpack-cli": "4.9.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"nyc": "15.1.0",
"rimraf": "3.0.2",
"sinon": "11.1.2",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/opentelemetry-sdk-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"semver": "7.3.5",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4"
}
}
2 changes: 1 addition & 1 deletion experimental/packages/otlp-exporter-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"nyc": "15.1.0",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/otlp-grpc-exporter-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"@opentelemetry/sdk-trace-base": "1.2.0",
"@opentelemetry/resources": "1.2.0",
Expand Down
5 changes: 1 addition & 4 deletions experimental/packages/otlp-proto-exporter-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
"prepublishOnly": "npm run compile",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../",
"compile": "tsc --build",
"clean": "tsc --build --clean",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"postcompile": "npm run submodule && npm run protos:copy",
"protos:copy": "cpx protos/opentelemetry/**/*.* build/protos/opentelemetry",
"submodule": "git submodule sync --recursive && git submodule update --init --recursive",
"tdd": "npm run test -- --watch-extensions ts --watch",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"version": "node ../../../scripts/version-update.js",
"watch": "npm run protos:copy && tsc -w",
"precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies",
Expand Down Expand Up @@ -61,7 +58,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/otlp-transformer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"protobufjs": "6.11.2",
"rimraf": "3.0.2",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"webpack": "4.46.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 @@ -51,7 +51,7 @@
"mocha": "7.2.0",
"nyc": "15.1.0",
"rimraf": "3.0.2",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4"
},
"peerDependencies": {
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 @@ -74,7 +74,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"webpack": "4.46.0",
"webpack-cli": "4.9.1",
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 @@ -67,7 +67,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"webpack": "4.46.0",
"webpack-cli": "4.9.1",
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 @@ -83,7 +83,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"webpack": "4.46.0"
},
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 @@ -55,7 +55,7 @@
"nyc": "15.1.0",
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4"
},
"peerDependencies": {
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 @@ -81,7 +81,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"webpack": "4.46.0",
"webpack-cli": "4.9.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-propagator-b3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"nyc": "15.1.0",
"rimraf": "3.0.2",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4"
}
}
2 changes: 1 addition & 1 deletion packages/opentelemetry-propagator-jaeger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"webpack": "4.46.0"
},
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 @@ -77,7 +77,7 @@
"nyc": "15.1.0",
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"webpack": "4.46.0",
"webpack-cli": "4.9.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-sdk-trace-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"webpack": "4.46.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class ConsoleSpanExporter implements SpanExporter {
attributes: span.attributes,
status: span.status,
events: span.events,
links: span.links
};
}

Expand All @@ -78,7 +79,7 @@ export class ConsoleSpanExporter implements SpanExporter {
done?: (result: ExportResult) => void
): void {
for (const span of spans) {
console.log(this._exportInfo(span));
console.dir(this._exportInfo(span), { depth: 3 });
}
if (done) {
return done({ code: ExportResultCode.SUCCESS });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
* limitations under the License.
*/

import {
SpanContext,
TraceFlags,
} from '@opentelemetry/api';
import { AlwaysOnSampler } from '@opentelemetry/core';
import * as assert from 'assert';
import * as sinon from 'sinon';
Expand All @@ -26,16 +30,16 @@ import {
/* eslint-disable no-console */
describe('ConsoleSpanExporter', () => {
let consoleExporter: ConsoleSpanExporter;
let previousConsoleLog: any;
let previousConsoleDir: any;

beforeEach(() => {
previousConsoleLog = console.log;
console.log = () => {};
previousConsoleDir = console.dir;
console.dir = () => {};
consoleExporter = new ConsoleSpanExporter();
});

afterEach(() => {
console.log = previousConsoleLog;
console.dir = previousConsoleDir;
});

describe('.export()', () => {
Expand All @@ -46,14 +50,22 @@ describe('ConsoleSpanExporter', () => {
});
consoleExporter = new ConsoleSpanExporter();

const spyConsole = sinon.spy(console, 'log');
const spyConsole = sinon.spy(console, 'dir');
const spyExport = sinon.spy(consoleExporter, 'export');

basicTracerProvider.addSpanProcessor(
new SimpleSpanProcessor(consoleExporter)
);

const span = basicTracerProvider.getTracer('default').startSpan('foo');
const tracer = basicTracerProvider.getTracer('default');
const context: SpanContext = {
traceId: 'a3cda95b652f4a1592b449d5929fda1b',
spanId: '5e0c63257de34c92',
traceFlags: TraceFlags.SAMPLED,
};
const span = tracer.startSpan('foo', {
links: [ { context, attributes: { anAttr: 'aValue' } } ]
});
span.addEvent('foobar');
span.end();

Expand All @@ -70,6 +82,7 @@ describe('ConsoleSpanExporter', () => {
'events',
'id',
'kind',
'links',
'name',
'parentId',
'status',
Expand All @@ -80,7 +93,7 @@ describe('ConsoleSpanExporter', () => {
assert.ok(firstSpan.name === 'foo');
assert.ok(firstEvent.name === 'foobar');
assert.ok(consoleSpan.id === firstSpan.spanContext().spanId);
assert.ok(keys === expectedKeys);
assert.ok(keys === expectedKeys, 'expectedKeys');

assert.ok(spyExport.calledOnce);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-sdk-trace-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"nyc": "15.1.0",
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-sdk-trace-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"rimraf": "3.0.2",
"sinon": "12.0.1",
"ts-loader": "8.3.0",
"ts-mocha": "8.0.0",
"ts-mocha": "9.0.2",
"typescript": "4.4.4",
"webpack": "4.46.0",
"webpack-cli": "4.9.1",
Expand Down
Loading

0 comments on commit 2c6d78f

Please sign in to comment.