Skip to content
This repository was archived by the owner on Nov 10, 2022. It is now read-only.

Commit 40e151f

Browse files
committed
Merge remote-tracking branch 'origin/main' into no-leak-singletons
2 parents b9e2dcc + 4cda9bd commit 40e151f

38 files changed

+718
-382
lines changed

.eslintrc.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ module.exports = {
1313
],
1414
parser: "@typescript-eslint/parser",
1515
parserOptions: {
16-
"project": "./tsconfig.json"
16+
"project": [
17+
"./tsconfig.json",
18+
"backwards-compatability/*/tsconfig.json"
19+
]
1720
},
21+
ignorePatterns: [
22+
'build',
23+
],
1824
rules: {
1925
"@typescript-eslint/no-this-alias": "off",
2026
"eqeqeq": [

.github/workflows/codeql-analysis.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "CodeQL"
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# ┌───────────── minute (0 - 59)
7+
# │ ┌───────────── hour (0 - 23)
8+
# │ │ ┌───────────── day of the month (1 - 31)
9+
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
10+
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
11+
# │ │ │ │ │
12+
# │ │ │ │ │
13+
# │ │ │ │ │
14+
# * * * * *
15+
- cron: '30 1 * * *'
16+
17+
jobs:
18+
CodeQL-Build:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v2
24+
25+
- name: Initialize CodeQL
26+
uses: github/codeql-action/init@v1
27+
with:
28+
languages: javascript
29+
30+
- name: Autobuild
31+
uses: github/codeql-action/autobuild@v1
32+
33+
- name: Perform CodeQL Analysis
34+
uses: github/codeql-action/analyze@v1

CHANGELOG.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,52 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## 0.20.0
6+
7+
### :rocket: Enhancement
8+
9+
* [#69](https://github.com/open-telemetry/opentelemetry-js-api/pull/69) feat(context): add utils method to remove keys from context ([@vmarchaud](https://github.com/vmarchaud))
10+
* [#71](https://github.com/open-telemetry/opentelemetry-js-api/pull/71) chore: export baggage ([@dyladan](https://github.com/dyladan))
11+
12+
### Committers: 2
13+
14+
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
15+
* Valentin Marchaud ([@vmarchaud](https://github.com/vmarchaud))
16+
17+
## 0.19.0
18+
19+
### :boom: Breaking Change
20+
21+
* [#55](https://github.com/open-telemetry/opentelemetry-js-api/pull/55) chore: move baggage methods in propagation namespace ([@vmarchaud](https://github.com/vmarchaud))
22+
* [#65](https://github.com/open-telemetry/opentelemetry-js-api/pull/65) chore: remove suppress instrumentation ([@dyladan](https://github.com/dyladan))
23+
* [#60](https://github.com/open-telemetry/opentelemetry-js-api/pull/60) chore: removing timed event ([@obecny](https://github.com/obecny))
24+
* [#58](https://github.com/open-telemetry/opentelemetry-js-api/pull/58) chore: use spancontext for link ([@dyladan](https://github.com/dyladan))
25+
* [#47](https://github.com/open-telemetry/opentelemetry-js-api/pull/47) chore: move span method for context in trace API #40 ([@vmarchaud](https://github.com/vmarchaud))
26+
* [#45](https://github.com/open-telemetry/opentelemetry-js-api/pull/45) chore: rename `span#context()` to `span#spanContext` ([@dyladan](https://github.com/dyladan))
27+
* [#43](https://github.com/open-telemetry/opentelemetry-js-api/pull/43) chore: renaming noop span to non recording span ([@obecny](https://github.com/obecny))
28+
* [#32](https://github.com/open-telemetry/opentelemetry-js-api/pull/32) feat!: return boolean success value from setGlobalXXX methods ([@dyladan](https://github.com/dyladan))
29+
30+
### :rocket: Enhancement
31+
32+
* [#62](https://github.com/open-telemetry/opentelemetry-js-api/pull/62) chore: adding component logger ([@obecny](https://github.com/obecny))
33+
* [#54](https://github.com/open-telemetry/opentelemetry-js-api/pull/54) feat: add tracer.startActiveSpan() ([@naseemkullah](https://github.com/naseemkullah))
34+
* [#58](https://github.com/open-telemetry/opentelemetry-js-api/pull/58) chore: use spancontext for link ([@dyladan](https://github.com/dyladan))
35+
* [#51](https://github.com/open-telemetry/opentelemetry-js-api/pull/51) feat: add function to wrap SpanContext in NonRecordingSpan #49 ([@dyladan](https://github.com/dyladan))
36+
37+
### :memo: Documentation
38+
39+
* [#64](https://github.com/open-telemetry/opentelemetry-js-api/pull/64) chore: document the reason for symbol.for ([@dyladan](https://github.com/dyladan))
40+
* [#44](https://github.com/open-telemetry/opentelemetry-js-api/pull/44) chore: updating readme headline and fixing links ([@obecny](https://github.com/obecny))
41+
42+
### Committers: 6
43+
44+
* Bartlomiej Obecny ([@obecny](https://github.com/obecny))
45+
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
46+
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna))
47+
* Naseem ([@naseemkullah](https://github.com/naseemkullah))
48+
* Valentin Marchaud ([@vmarchaud](https://github.com/vmarchaud))
49+
* t2t2 ([@t2t2](https://github.com/t2t2))
50+
551
## 1.0.0-rc.0
652

753
### :memo: Documentation

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,15 @@ Because the npm installer and node module resolution algorithm could potentially
105105

106106
## Upgrade Guidelines
107107

108-
### 1.0.0-rc.0 to x
108+
### 1.0.0-rc.1 to x
109109

110+
### 1.0.0-rc.0 to 1.0.0-rc.1
111+
112+
- Removing `TimedEvent` which was not part of spec
110113
- `HttpBaggage` renamed to `HttpBaggagePropagator`
111114
- [#45](https://github.com/open-telemetry/opentelemetry-js-api/pull/45) `Span#context` renamed to `Span#spanContext`
115+
- [#47](https://github.com/open-telemetry/opentelemetry-js-api/pull/47) `getSpan`/`setSpan`/`getSpanContext`/`setSpanContext` moved to `trace` namespace
116+
- [#55](https://github.com/open-telemetry/opentelemetry-js-api/pull/55) `getBaggage`/`setBaggage`/`createBaggage` moved to `propagation` namespace
112117

113118
## Useful links
114119

backwards-compatability/node10/index.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
1-
import {NodeSDK, api} from '@opentelemetry/sdk-node';
2-
import {ConsoleSpanExporter} from '@opentelemetry/tracing';
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import { NodeSDK, api } from '@opentelemetry/sdk-node';
17+
import { ConsoleSpanExporter } from '@opentelemetry/tracing';
318

419
const sdk = new NodeSDK({
520
traceExporter: new ConsoleSpanExporter(),
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
{
2-
"extends": "../../tsconfig.es5.json",
2+
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"rootDir": ".",
55
"outDir": "build"
66
},
77
"include": [
88
"index.ts"
9-
],
10-
"references": [
11-
{
12-
"path": "../../packages/opentelemetry-sdk-node"
13-
},
14-
{
15-
"path": "../../packages/opentelemetry-tracing"
16-
}
179
]
1810
}

backwards-compatability/node12/index.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
1-
import {NodeSDK, api} from '@opentelemetry/sdk-node';
2-
import {ConsoleSpanExporter} from '@opentelemetry/tracing';
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import { NodeSDK, api } from '@opentelemetry/sdk-node';
17+
import { ConsoleSpanExporter } from '@opentelemetry/tracing';
318

419
const sdk = new NodeSDK({
520
traceExporter: new ConsoleSpanExporter(),
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
{
2-
"extends": "../../tsconfig.es5.json",
2+
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"rootDir": ".",
55
"outDir": "build"
66
},
77
"include": [
88
"index.ts"
9-
],
10-
"references": [
11-
{
12-
"path": "../../packages/opentelemetry-sdk-node"
13-
},
14-
{
15-
"path": "../../packages/opentelemetry-tracing"
16-
}
179
]
1810
}

backwards-compatability/node8/index.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
1-
import {NodeSDK, api} from '@opentelemetry/sdk-node';
2-
import {ConsoleSpanExporter} from '@opentelemetry/tracing';
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import { NodeSDK, api } from '@opentelemetry/sdk-node';
17+
import { ConsoleSpanExporter } from '@opentelemetry/tracing';
318

419
const sdk = new NodeSDK({
520
traceExporter: new ConsoleSpanExporter(),
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
{
2-
"extends": "../../tsconfig.es5.json",
2+
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"rootDir": ".",
55
"outDir": "build"
66
},
77
"include": [
88
"index.ts"
9-
],
10-
"references": [
11-
{
12-
"path": "../../packages/opentelemetry-sdk-node"
13-
},
14-
{
15-
"path": "../../packages/opentelemetry-tracing"
16-
}
179
]
1810
}

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opentelemetry/api",
3-
"version": "1.0.0-rc.0",
3+
"version": "0.20.0",
44
"description": "Public API for OpenTelemetry",
55
"main": "build/src/index.js",
66
"module": "build/esm/index.js",
@@ -55,14 +55,14 @@
5555
"access": "public"
5656
},
5757
"devDependencies": {
58-
"@types/mocha": "8.2.1",
59-
"@types/node": "14.14.28",
60-
"@types/sinon": "9.0.10",
58+
"@types/mocha": "8.2.2",
59+
"@types/node": "14.14.42",
60+
"@types/sinon": "10.0.0",
6161
"@types/webpack-env": "1.16.0",
62-
"@typescript-eslint/eslint-plugin": "4.15.1",
63-
"@typescript-eslint/parser": "4.15.1",
62+
"@typescript-eslint/eslint-plugin": "4.22.0",
63+
"@typescript-eslint/parser": "4.22.0",
6464
"codecov": "3.8.1",
65-
"eslint": "7.20.0",
65+
"eslint": "7.25.0",
6666
"eslint-plugin-header": "3.1.1",
6767
"eslint-plugin-import": "2.22.1",
6868
"gh-pages": "3.1.0",
@@ -74,15 +74,15 @@
7474
"karma-mocha": "2.0.1",
7575
"karma-spec-reporter": "0.0.32",
7676
"karma-webpack": "4.0.2",
77-
"lerna-changelog": "^1.0.1",
78-
"linkinator": "2.13.5",
77+
"lerna-changelog": "1.0.1",
78+
"linkinator": "2.13.6",
7979
"mocha": "7.2.0",
8080
"nyc": "15.1.0",
81-
"sinon": "9.2.4",
82-
"ts-loader": "8.0.17",
81+
"sinon": "10.0.0",
82+
"ts-loader": "8.2.0",
8383
"ts-mocha": "8.0.0",
84-
"typedoc": "0.20.25",
85-
"typescript": "4.1.5",
84+
"typedoc": "0.20.36",
85+
"typescript": "4.2.4",
8686
"webpack": "4.46.0"
8787
}
8888
}

src/api/diag.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { DiagComponentLogger } from '../diag/ComponentLogger';
1718
import { createLogLevelDiagLogger } from '../diag/internal/logLevelLogger';
18-
import { DiagLogFunction, DiagLogger, DiagLogLevel } from '../diag/types';
19+
import {
20+
ComponentLoggerOptions,
21+
DiagLogFunction,
22+
DiagLogger,
23+
DiagLogLevel,
24+
} from '../diag/types';
1925
import {
2026
getGlobal,
2127
registerGlobal,
@@ -90,6 +96,10 @@ export class DiagAPI implements DiagLogger {
9096
unregisterGlobal(API_NAME);
9197
};
9298

99+
self.createComponentLogger = (options: ComponentLoggerOptions) => {
100+
return new DiagComponentLogger(options);
101+
};
102+
93103
self.verbose = _logProxy('verbose');
94104
self.debug = _logProxy('debug');
95105
self.info = _logProxy('info');
@@ -106,6 +116,12 @@ export class DiagAPI implements DiagLogger {
106116
* @returns true if the logger was successfully registered, else false
107117
*/
108118
public setLogger!: (logger: DiagLogger, logLevel?: DiagLogLevel) => boolean;
119+
/**
120+
*
121+
*/
122+
public createComponentLogger!: (
123+
options: ComponentLoggerOptions
124+
) => DiagLogger;
109125

110126
// DiagLogger implementation
111127
public verbose!: DiagLogFunction;

src/api/propagation.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ import {
2828
TextMapPropagator,
2929
TextMapSetter,
3030
} from '../propagation/TextMapPropagator';
31+
import {
32+
getBaggage,
33+
setBaggage,
34+
deleteBaggage,
35+
} from '../baggage/context-helpers';
36+
import { createBaggage } from '../baggage/utils';
3137

3238
const API_NAME = 'propagation';
3339
const NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();
@@ -101,6 +107,14 @@ export class PropagationAPI {
101107
unregisterGlobal(API_NAME);
102108
}
103109

110+
public createBaggage = createBaggage;
111+
112+
public getBaggage = getBaggage;
113+
114+
public setBaggage = setBaggage;
115+
116+
public deleteBaggage = deleteBaggage;
117+
104118
private _getGlobalPropagator(): TextMapPropagator {
105119
return getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;
106120
}

src/api/trace.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ import {
2626
} from '../trace/spancontext-utils';
2727
import { Tracer } from '../trace/tracer';
2828
import { TracerProvider } from '../trace/tracer_provider';
29+
import {
30+
deleteSpan,
31+
getSpan,
32+
getSpanContext,
33+
setSpan,
34+
setSpanContext,
35+
} from '../trace/context-utils';
2936

3037
const API_NAME = 'trace';
3138

@@ -82,4 +89,14 @@ export class TraceAPI {
8289
public wrapSpanContext = wrapSpanContext;
8390

8491
public isSpanContextValid = isSpanContextValid;
92+
93+
public deleteSpan = deleteSpan;
94+
95+
public getSpan = getSpan;
96+
97+
public getSpanContext = getSpanContext;
98+
99+
public setSpan = setSpan;
100+
101+
public setSpanContext = setSpanContext;
85102
}

0 commit comments

Comments
 (0)