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

Commit

Permalink
Merge remote-tracking branch 'origin/main' into no-leak-singletons
Browse files Browse the repository at this point in the history
  • Loading branch information
dyladan committed May 26, 2021
2 parents b9e2dcc + 4cda9bd commit 40e151f
Show file tree
Hide file tree
Showing 38 changed files with 718 additions and 382 deletions.
8 changes: 7 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ module.exports = {
],
parser: "@typescript-eslint/parser",
parserOptions: {
"project": "./tsconfig.json"
"project": [
"./tsconfig.json",
"backwards-compatability/*/tsconfig.json"
]
},
ignorePatterns: [
'build',
],
rules: {
"@typescript-eslint/no-this-alias": "off",
"eqeqeq": [
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "CodeQL"

on:
workflow_dispatch:
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *
- cron: '30 1 * * *'

jobs:
CodeQL-Build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: javascript

- name: Autobuild
uses: github/codeql-action/autobuild@v1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,52 @@

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

## 0.20.0

### :rocket: Enhancement

* [#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))
* [#71](https://github.com/open-telemetry/opentelemetry-js-api/pull/71) chore: export baggage ([@dyladan](https://github.com/dyladan))

### Committers: 2

* Daniel Dyla ([@dyladan](https://github.com/dyladan))
* Valentin Marchaud ([@vmarchaud](https://github.com/vmarchaud))

## 0.19.0

### :boom: Breaking Change

* [#55](https://github.com/open-telemetry/opentelemetry-js-api/pull/55) chore: move baggage methods in propagation namespace ([@vmarchaud](https://github.com/vmarchaud))
* [#65](https://github.com/open-telemetry/opentelemetry-js-api/pull/65) chore: remove suppress instrumentation ([@dyladan](https://github.com/dyladan))
* [#60](https://github.com/open-telemetry/opentelemetry-js-api/pull/60) chore: removing timed event ([@obecny](https://github.com/obecny))
* [#58](https://github.com/open-telemetry/opentelemetry-js-api/pull/58) chore: use spancontext for link ([@dyladan](https://github.com/dyladan))
* [#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))
* [#45](https://github.com/open-telemetry/opentelemetry-js-api/pull/45) chore: rename `span#context()` to `span#spanContext` ([@dyladan](https://github.com/dyladan))
* [#43](https://github.com/open-telemetry/opentelemetry-js-api/pull/43) chore: renaming noop span to non recording span ([@obecny](https://github.com/obecny))
* [#32](https://github.com/open-telemetry/opentelemetry-js-api/pull/32) feat!: return boolean success value from setGlobalXXX methods ([@dyladan](https://github.com/dyladan))

### :rocket: Enhancement

* [#62](https://github.com/open-telemetry/opentelemetry-js-api/pull/62) chore: adding component logger ([@obecny](https://github.com/obecny))
* [#54](https://github.com/open-telemetry/opentelemetry-js-api/pull/54) feat: add tracer.startActiveSpan() ([@naseemkullah](https://github.com/naseemkullah))
* [#58](https://github.com/open-telemetry/opentelemetry-js-api/pull/58) chore: use spancontext for link ([@dyladan](https://github.com/dyladan))
* [#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))

### :memo: Documentation

* [#64](https://github.com/open-telemetry/opentelemetry-js-api/pull/64) chore: document the reason for symbol.for ([@dyladan](https://github.com/dyladan))
* [#44](https://github.com/open-telemetry/opentelemetry-js-api/pull/44) chore: updating readme headline and fixing links ([@obecny](https://github.com/obecny))

### Committers: 6

* Bartlomiej Obecny ([@obecny](https://github.com/obecny))
* Daniel Dyla ([@dyladan](https://github.com/dyladan))
* Gerhard Stöbich ([@Flarna](https://github.com/Flarna))
* Naseem ([@naseemkullah](https://github.com/naseemkullah))
* Valentin Marchaud ([@vmarchaud](https://github.com/vmarchaud))
* t2t2 ([@t2t2](https://github.com/t2t2))

## 1.0.0-rc.0

### :memo: Documentation
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,15 @@ Because the npm installer and node module resolution algorithm could potentially

## Upgrade Guidelines

### 1.0.0-rc.0 to x
### 1.0.0-rc.1 to x

### 1.0.0-rc.0 to 1.0.0-rc.1

- Removing `TimedEvent` which was not part of spec
- `HttpBaggage` renamed to `HttpBaggagePropagator`
- [#45](https://github.com/open-telemetry/opentelemetry-js-api/pull/45) `Span#context` renamed to `Span#spanContext`
- [#47](https://github.com/open-telemetry/opentelemetry-js-api/pull/47) `getSpan`/`setSpan`/`getSpanContext`/`setSpanContext` moved to `trace` namespace
- [#55](https://github.com/open-telemetry/opentelemetry-js-api/pull/55) `getBaggage`/`setBaggage`/`createBaggage` moved to `propagation` namespace

## Useful links

Expand Down
19 changes: 17 additions & 2 deletions backwards-compatability/node10/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
import {NodeSDK, api} from '@opentelemetry/sdk-node';
import {ConsoleSpanExporter} from '@opentelemetry/tracing';
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NodeSDK, api } from '@opentelemetry/sdk-node';
import { ConsoleSpanExporter } from '@opentelemetry/tracing';

const sdk = new NodeSDK({
traceExporter: new ConsoleSpanExporter(),
Expand Down
10 changes: 1 addition & 9 deletions backwards-compatability/node10/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
{
"extends": "../../tsconfig.es5.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
},
"include": [
"index.ts"
],
"references": [
{
"path": "../../packages/opentelemetry-sdk-node"
},
{
"path": "../../packages/opentelemetry-tracing"
}
]
}
19 changes: 17 additions & 2 deletions backwards-compatability/node12/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
import {NodeSDK, api} from '@opentelemetry/sdk-node';
import {ConsoleSpanExporter} from '@opentelemetry/tracing';
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NodeSDK, api } from '@opentelemetry/sdk-node';
import { ConsoleSpanExporter } from '@opentelemetry/tracing';

const sdk = new NodeSDK({
traceExporter: new ConsoleSpanExporter(),
Expand Down
10 changes: 1 addition & 9 deletions backwards-compatability/node12/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
{
"extends": "../../tsconfig.es5.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
},
"include": [
"index.ts"
],
"references": [
{
"path": "../../packages/opentelemetry-sdk-node"
},
{
"path": "../../packages/opentelemetry-tracing"
}
]
}
19 changes: 17 additions & 2 deletions backwards-compatability/node8/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
import {NodeSDK, api} from '@opentelemetry/sdk-node';
import {ConsoleSpanExporter} from '@opentelemetry/tracing';
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NodeSDK, api } from '@opentelemetry/sdk-node';
import { ConsoleSpanExporter } from '@opentelemetry/tracing';

const sdk = new NodeSDK({
traceExporter: new ConsoleSpanExporter(),
Expand Down
10 changes: 1 addition & 9 deletions backwards-compatability/node8/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
{
"extends": "../../tsconfig.es5.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
},
"include": [
"index.ts"
],
"references": [
{
"path": "../../packages/opentelemetry-sdk-node"
},
{
"path": "../../packages/opentelemetry-tracing"
}
]
}
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentelemetry/api",
"version": "1.0.0-rc.0",
"version": "0.20.0",
"description": "Public API for OpenTelemetry",
"main": "build/src/index.js",
"module": "build/esm/index.js",
Expand Down Expand Up @@ -55,14 +55,14 @@
"access": "public"
},
"devDependencies": {
"@types/mocha": "8.2.1",
"@types/node": "14.14.28",
"@types/sinon": "9.0.10",
"@types/mocha": "8.2.2",
"@types/node": "14.14.42",
"@types/sinon": "10.0.0",
"@types/webpack-env": "1.16.0",
"@typescript-eslint/eslint-plugin": "4.15.1",
"@typescript-eslint/parser": "4.15.1",
"@typescript-eslint/eslint-plugin": "4.22.0",
"@typescript-eslint/parser": "4.22.0",
"codecov": "3.8.1",
"eslint": "7.20.0",
"eslint": "7.25.0",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-import": "2.22.1",
"gh-pages": "3.1.0",
Expand All @@ -74,15 +74,15 @@
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.32",
"karma-webpack": "4.0.2",
"lerna-changelog": "^1.0.1",
"linkinator": "2.13.5",
"lerna-changelog": "1.0.1",
"linkinator": "2.13.6",
"mocha": "7.2.0",
"nyc": "15.1.0",
"sinon": "9.2.4",
"ts-loader": "8.0.17",
"sinon": "10.0.0",
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"typedoc": "0.20.25",
"typescript": "4.1.5",
"typedoc": "0.20.36",
"typescript": "4.2.4",
"webpack": "4.46.0"
}
}
18 changes: 17 additions & 1 deletion src/api/diag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@
* limitations under the License.
*/

import { DiagComponentLogger } from '../diag/ComponentLogger';
import { createLogLevelDiagLogger } from '../diag/internal/logLevelLogger';
import { DiagLogFunction, DiagLogger, DiagLogLevel } from '../diag/types';
import {
ComponentLoggerOptions,
DiagLogFunction,
DiagLogger,
DiagLogLevel,
} from '../diag/types';
import {
getGlobal,
registerGlobal,
Expand Down Expand Up @@ -90,6 +96,10 @@ export class DiagAPI implements DiagLogger {
unregisterGlobal(API_NAME);
};

self.createComponentLogger = (options: ComponentLoggerOptions) => {
return new DiagComponentLogger(options);
};

self.verbose = _logProxy('verbose');
self.debug = _logProxy('debug');
self.info = _logProxy('info');
Expand All @@ -106,6 +116,12 @@ export class DiagAPI implements DiagLogger {
* @returns true if the logger was successfully registered, else false
*/
public setLogger!: (logger: DiagLogger, logLevel?: DiagLogLevel) => boolean;
/**
*
*/
public createComponentLogger!: (
options: ComponentLoggerOptions
) => DiagLogger;

// DiagLogger implementation
public verbose!: DiagLogFunction;
Expand Down
14 changes: 14 additions & 0 deletions src/api/propagation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ import {
TextMapPropagator,
TextMapSetter,
} from '../propagation/TextMapPropagator';
import {
getBaggage,
setBaggage,
deleteBaggage,
} from '../baggage/context-helpers';
import { createBaggage } from '../baggage/utils';

const API_NAME = 'propagation';
const NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();
Expand Down Expand Up @@ -101,6 +107,14 @@ export class PropagationAPI {
unregisterGlobal(API_NAME);
}

public createBaggage = createBaggage;

public getBaggage = getBaggage;

public setBaggage = setBaggage;

public deleteBaggage = deleteBaggage;

private _getGlobalPropagator(): TextMapPropagator {
return getGlobal(API_NAME) || NOOP_TEXT_MAP_PROPAGATOR;
}
Expand Down
17 changes: 17 additions & 0 deletions src/api/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ import {
} from '../trace/spancontext-utils';
import { Tracer } from '../trace/tracer';
import { TracerProvider } from '../trace/tracer_provider';
import {
deleteSpan,
getSpan,
getSpanContext,
setSpan,
setSpanContext,
} from '../trace/context-utils';

const API_NAME = 'trace';

Expand Down Expand Up @@ -82,4 +89,14 @@ export class TraceAPI {
public wrapSpanContext = wrapSpanContext;

public isSpanContextValid = isSpanContextValid;

public deleteSpan = deleteSpan;

public getSpan = getSpan;

public getSpanContext = getSpanContext;

public setSpan = setSpan;

public setSpanContext = setSpanContext;
}
Loading

0 comments on commit 40e151f

Please sign in to comment.