Skip to content

Commit 03f530e

Browse files
committed
feat: Add inject method for tracer
meta: Remove firefox from integration tests meta: Watch esm builds
1 parent d2c9600 commit 03f530e

File tree

9 files changed

+70
-12
lines changed

9 files changed

+70
-12
lines changed

packages/browser/test/karma/karma.integration.config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ module.exports = config => {
1515
'karma-firefox-launcher',
1616
],
1717
reporters: ['mocha'],
18-
browsers: ['ChromeHeadlessNoSandbox', 'FirefoxHeadless'],
18+
browsers: ['ChromeHeadlessNoSandbox'],
1919
customLaunchers: {
2020
ChromeHeadlessNoSandbox: {
2121
base: 'ChromeHeadless',
2222
flags: ['--no-sandbox', '--disable-setuid-sandbox'],
2323
},
24-
FirefoxHeadless: {
25-
base: 'Firefox',
26-
flags: ['-headless'],
27-
},
24+
// FirefoxHeadless: {
25+
// base: 'Firefox',
26+
// flags: ['-headless'],
27+
// },
2828
},
2929
browserNoActivityTimeout: 30000,
30-
concurrency: 2,
30+
concurrency: 1,
3131
client: {
3232
mocha: {
3333
reporter: 'html',

packages/core/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
"build": "run-p build:es5 build:esm",
3636
"build:es5": "tsc -p tsconfig.build.json",
3737
"build:esm": "tsc -p tsconfig.esm.json",
38-
"build:watch": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
38+
"build:watch": "run-p build:watch:es5 build:watch:esm",
39+
"build:watch:es5": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
40+
"build:watch:esm": "tsc -p tsconfig.esm.json -w --preserveWatchOutput",
3941
"clean": "rimraf dist coverage",
4042
"link:yarn": "yarn link",
4143
"lint": "run-s lint:prettier lint:tslint",

packages/hub/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
"build": "run-p build:es5 build:esm",
3434
"build:es5": "tsc -p tsconfig.build.json",
3535
"build:esm": "tsc -p tsconfig.esm.json",
36-
"build:watch": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
36+
"build:watch": "run-p build:watch:es5 build:watch:esm",
37+
"build:watch:es5": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
38+
"build:watch:esm": "tsc -p tsconfig.esm.json -w --preserveWatchOutput",
3739
"clean": "rimraf dist coverage",
3840
"link:yarn": "yarn link",
3941
"lint": "run-s lint:prettier lint:tslint",

packages/integrations/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
"scripts": {
3636
"build": "run-p build:es5 build:bundle",
3737
"build:es5": "tsc -p tsconfig.build.json",
38-
"build:watch": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
38+
"build:esm": "tsc -p tsconfig.esm.json",
39+
"build:watch": "run-p build:watch:es5 build:watch:esm",
40+
"build:watch:es5": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
41+
"build:watch:esm": "tsc -p tsconfig.esm.json -w --preserveWatchOutput",
3942
"build:bundle": "rollup --config",
4043
"clean": "rimraf dist coverage *.js *.js.map *.d.ts",
4144
"lint": "run-s lint:prettier lint:tslint",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../../tsconfig.esm.json",
3+
"compilerOptions": {
4+
"baseUrl": ".",
5+
"outDir": "esm",
6+
"types": ["node", "angular"]
7+
},
8+
"include": ["src/**/*"]
9+
}

packages/minimal/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
"build": "run-p build:es5 build:esm",
3434
"build:es5": "tsc -p tsconfig.build.json",
3535
"build:esm": "tsc -p tsconfig.esm.json",
36-
"build:watch": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
36+
"build:watch": "run-p build:watch:es5 build:watch:esm",
37+
"build:watch:es5": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
38+
"build:watch:esm": "tsc -p tsconfig.esm.json -w --preserveWatchOutput",
3739
"clean": "rimraf dist coverage",
3840
"link:yarn": "yarn link",
3941
"lint": "run-s lint:prettier lint:tslint",

packages/opentracing/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
"build": "run-p build:es5 build:esm",
3535
"build:es5": "tsc -p tsconfig.build.json",
3636
"build:esm": "tsc -p tsconfig.esm.json",
37-
"build:watch": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
37+
"build:watch": "run-p build:watch:es5 build:watch:esm",
38+
"build:watch:es5": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
39+
"build:watch:esm": "tsc -p tsconfig.esm.json -w --preserveWatchOutput",
3840
"clean": "rimraf dist coverage",
3941
"link:yarn": "yarn link",
4042
"lint": "run-s lint:prettier lint:tslint",

packages/opentracing/src/tracer.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,49 @@ export class Tracer extends opentracing.Tracer {
3030
return span;
3131
}
3232

33+
/**
34+
* @hidden
35+
*/
36+
protected _inject(context: SpanContext, format: string, carrier: any): void {
37+
// tslint:disable: no-unsafe-any
38+
switch (format) {
39+
case opentracing.FORMAT_TEXT_MAP:
40+
case opentracing.FORMAT_HTTP_HEADERS:
41+
const headerName = 'traceparent';
42+
const headerValue: string = `00-${context.traceId}-${context.spanId}-00`;
43+
44+
if (typeof carrier.setRequestHeader === 'function') {
45+
carrier.setRequestHeader(headerName, headerValue);
46+
} else if (carrier.headers && typeof carrier.headers.append === 'function') {
47+
carrier.headers.append(headerName, headerValue);
48+
} else {
49+
carrier[headerName] = headerValue;
50+
}
51+
52+
break;
53+
case opentracing.FORMAT_BINARY:
54+
break;
55+
default:
56+
// We do nothing
57+
}
58+
// tslint:enable: no-unsafe-any
59+
}
60+
3361
/**
3462
* @inheritDoc
3563
*/
3664
public startSpan(name: string, options: opentracing.SpanOptions = {}): Span {
3765
return (super.startSpan(name, options) as unknown) as Span;
3866
}
3967

68+
/**
69+
* @inheritDoc
70+
*/
71+
public inject(spanContext: SpanContext | Span, format: string, carrier: any): void {
72+
const context = spanContext instanceof Span ? spanContext.context() : spanContext;
73+
this._inject(context as SpanContext, format, carrier);
74+
}
75+
4076
/**
4177
* Sets the current traceId, all new created spans will receive the traceId.
4278
*

packages/types/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
"build": "run-p build:es5 build:esm",
2727
"build:es5": "tsc -p tsconfig.build.json",
2828
"build:esm": "tsc -p tsconfig.esm.json",
29-
"build:watch": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
29+
"build:watch": "run-p build:watch:es5 build:watch:esm",
30+
"build:watch:es5": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
31+
"build:watch:esm": "tsc -p tsconfig.esm.json -w --preserveWatchOutput",
3032
"link:yarn": "yarn link",
3133
"lint": "run-s lint:prettier lint:tslint",
3234
"lint:prettier": "prettier-check \"{src,test}/**/*.ts\"",

0 commit comments

Comments
 (0)