Skip to content

Commit

Permalink
Merge branch 'master' into change_default_propagator
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahrosenblum committed Jun 18, 2020
2 parents 4fe8ea8 + 2486c3d commit e2984f6
Show file tree
Hide file tree
Showing 388 changed files with 4,266 additions and 1,090 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# https://help.github.com/en/articles/about-code-owners
#

* @dyladan @mayurkale22 @rochdev @bg451 @OlivierAlbertini @vmarchaud @markwolff @obecny @mwear @naseemkullah
* @dyladan @mayurkale22 @rochdev @bg451 @OlivierAlbertini @vmarchaud @markwolff @obecny @mwear @naseemkullah @legendecas
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ Approvers ([@open-telemetry/js-approvers](https://github.com/orgs/open-telemetry
- [Bartlomiej Obecny](https://github.com/obecny), LightStep
- [Matthew Wear](https://github.com/mwear), LightStep
- [Naseem K. Ullah](https://github.com/naseemkullah), Transit
- [Chengzhong Wu](https://github.com/legendecas), Alibaba

*Find more about the approver role in [community repository](https://github.com/open-telemetry/community/blob/master/community-membership.md#approver).*

Expand Down Expand Up @@ -205,6 +206,7 @@ These plugins are hosted at <https://github.com/open-telemetry/opentelemetry-js-
##### Core

- [@opentelemetry/plugin-xml-http-request][otel-plugin-xml-http-request]
- [@opentelemetry/plugin-fetch][otel-plugin-fetch]

##### Contrib

Expand Down Expand Up @@ -240,6 +242,7 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
[otel-metrics]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-metrics
[otel-node]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-node

[otel-plugin-fetch]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-fetch
[otel-plugin-grpc]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-grpc
[otel-plugin-http]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-http
[otel-plugin-https]: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-plugin-https
Expand Down
10 changes: 5 additions & 5 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ module.exports = {
"arrow-parens": ["error", "as-needed"],
"prettier/prettier": ["error", { "singleQuote": true, "arrowParens": "avoid" }],
"node/no-deprecated-api": ["warn"],
"header/header": [2, "block", [{
pattern: / \* Copyright \d{4}, OpenTelemetry Authors[\r\n]+ \*[\r\n]+ \* Licensed under the Apache License, Version 2\.0 \(the \"License\"\);[\r\n]+ \* you may not use this file except in compliance with the License\.[\r\n]+ \* You may obtain a copy of the License at[\r\n]+ \*[\r\n]+ \* https:\/\/www\.apache\.org\/licenses\/LICENSE-2\.0[\r\n]+ \*[\r\n]+ \* Unless required by applicable law or agreed to in writing, software[\r\n]+ \* distributed under the License is distributed on an \"AS IS\" BASIS,[\r\n]+ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.[\r\n]+ \* See the License for the specific language governing permissions and[\r\n]+ \* limitations under the License\./gm,
template:
`\n * Copyright ${new Date().getFullYear()}, OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n `
"header/header": [2, "block", [{
pattern: / \* Copyright The OpenTelemetry Authors[\r\n]+ \*[\r\n]+ \* Licensed under the Apache License, Version 2\.0 \(the \"License\"\);[\r\n]+ \* you may not use this file except in compliance with the License\.[\r\n]+ \* You may obtain a copy of the License at[\r\n]+ \*[\r\n]+ \* https:\/\/www\.apache\.org\/licenses\/LICENSE-2\.0[\r\n]+ \*[\r\n]+ \* Unless required by applicable law or agreed to in writing, software[\r\n]+ \* distributed under the License is distributed on an \"AS IS\" BASIS,[\r\n]+ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.[\r\n]+ \* See the License for the specific language governing permissions and[\r\n]+ \* limitations under the License\./gm,
template:
`\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n `
}]]
},
overrides: [
Expand All @@ -39,7 +39,7 @@ module.exports = {
"rules": {
"no-empty": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off"
Expand Down
5 changes: 5 additions & 0 deletions examples/tracer-web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ The screen will look as follows:

![Screenshot of the running example](images/xml-http-request.png)


### Fetch

To see the results, open the browser at <http://localhost:8090/fetch/> and make sure you have the browser console open. The application is using the `ConsoleSpanExporter` and will post the created spans to the browser console.

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
Expand Down
20 changes: 20 additions & 0 deletions examples/tracer-web/examples/fetch/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<title>Fetch Plugin Example</title>
<base href="/">

<meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>
Example of using Web Tracer with Fetch plugin with console exporter and collector exporter
<script type="text/javascript" src="fetch.js"></script>
<br/>
<button id="button1">Test</button>

</body>

</html>
71 changes: 71 additions & 0 deletions examples/tracer-web/examples/fetch/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
'use strict';

import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
import { CollectorExporter } from '@opentelemetry/exporter-collector';
import { WebTracerProvider } from '@opentelemetry/web';
import { FetchPlugin } from '@opentelemetry/plugin-fetch';
import { ZoneContextManager } from '@opentelemetry/context-zone';
import { B3Propagator } from '@opentelemetry/core';

const provider = new WebTracerProvider({
plugins: [
new FetchPlugin({
ignoreUrls: [/localhost:8090\/sockjs-node/],
propagateTraceHeaderCorsUrls: [
'https://cors-test.appspot.com/test',
'https://httpbin.org/get',
],
clearTimingResources: true
}),
],
});

provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
provider.addSpanProcessor(new SimpleSpanProcessor(new CollectorExporter()));
provider.register({
contextManager: new ZoneContextManager(),
propagator: new B3Propagator(),
});

const webTracerWithZone = provider.getTracer('example-tracer-web');

const getData = (url) => fetch(url, {
method: 'GET',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
});

// example of keeping track of context between async operations
const prepareClickEvent = () => {
const url1 = 'https://httpbin.org/get';

const element = document.getElementById('button1');

const onClick = () => {
const span1 = webTracerWithZone.startSpan(`files-series-info`, {
parent: webTracerWithZone.getCurrentSpan(),
});
webTracerWithZone.withSpan(span1, () => {
getData(url1).then((_data) => {
webTracerWithZone.getCurrentSpan().addEvent('fetching-span1-completed');
span1.end();
});
});
for (let i = 0, j = 5; i < j; i += 1) {
const span1 = webTracerWithZone.startSpan(`files-series-info-${i}`, {
parent: webTracerWithZone.getCurrentSpan(),
});
webTracerWithZone.withSpan(span1, () => {
getData(url1).then((_data) => {
webTracerWithZone.getCurrentSpan().addEvent('fetching-span1-completed');
span1.end();
});
});
}
};
element.addEventListener('click', onClick);
};

window.addEventListener('load', prepareClickEvent);
1 change: 1 addition & 0 deletions examples/tracer-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@opentelemetry/core": "^0.8.3",
"@opentelemetry/exporter-collector": "^0.8.3",
"@opentelemetry/plugin-document-load": "^0.6.1",
"@opentelemetry/plugin-fetch": "^0.8.3",
"@opentelemetry/plugin-user-interaction": "^0.6.1",
"@opentelemetry/plugin-xml-http-request": "^0.8.3",
"@opentelemetry/tracing": "^0.8.3",
Expand Down
1 change: 1 addition & 0 deletions examples/tracer-web/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const common = {
mode: 'development',
entry: {
'document-load': 'examples/document-load/index.js',
fetch: 'examples/fetch/index.js',
'xml-http-request': 'examples/xml-http-request/index.js',
'user-interaction': 'examples/user-interaction/index.js',
},
Expand Down
4 changes: 2 additions & 2 deletions karma.base.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2019, OpenTelemetry Authors
* 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.
Expand All @@ -20,7 +20,7 @@ module.exports = {
browsers: ['ChromeHeadless'],
frameworks: ['mocha'],
coverageIstanbulReporter: {
reports: ['json'],
reports: ['html', 'json'],
dir: '.nyc_output',
fixWebpackSourcePaths: true
},
Expand Down
2 changes: 1 addition & 1 deletion karma.webpack.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2019, OpenTelemetry Authors
* 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.
Expand Down
51 changes: 51 additions & 0 deletions metapackages/plugins-node-all/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# OpenTelemetry Plugins Node Core
[![Gitter chat][gitter-image]][gitter-url]
[![NPM Published Version][npm-img]][npm-url]
[![dependencies][dependencies-image]][dependencies-url]
[![Apache License][license-image]][license-image]

This package depends on all node plugins maintained by OpenTelemetry authors.
Installing it will also install all plugins.

## Plugins

In addition to all [node core plugins][otel-plugins-node-core], the following plugins will be installed by this package:

- [@opentelemetry/plugin-express][otel-plugin-express]
- [@opentelemetry/plugin-ioredis][otel-plugin-ioredis]
- [@opentelemetry/plugin-mongodb][otel-plugin-mongodb]
- [@opentelemetry/plugin-mysql][otel-plugin-mysql]
- [@opentelemetry/plugin-pg-pool][otel-plugin-pg-pool]
- [@opentelemetry/plugin-pg][otel-plugin-pg]
- [@opentelemetry/plugin-redis][otel-plugin-redis]

Note: [@opentelemetry/plugin-dns][otel-plugin-dns] is excluded by default because it requires some manual configuration to prevent infinite loops with exporters.

## Useful links
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us on [gitter][gitter-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[gitter-image]: https://badges.gitter.im/open-telemetry/opentelemetry-js.svg
[gitter-url]: https://gitter.im/open-telemetry/opentelemetry-node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/master/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=metapackages/plugins-node-core
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetryplugins-node-core
[npm-url]: https://www.npmjs.com/package/@opentelemetry/plugins-node-core
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fplugins-node-core.svg

[otel-plugins-node-core]: https://www.npmjs.com/package/@opentelemetry/plugins-node-core

[otel-plugin-dns]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/node/opentelemetry-plugin-dns
[otel-plugin-express]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/node/opentelemetry-plugin-express
[otel-plugin-ioredis]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/node/opentelemetry-plugin-ioredis
[otel-plugin-mongodb]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/node/opentelemetry-plugin-mongodb
[otel-plugin-mysql]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/node/opentelemetry-plugin-mysql
[otel-plugin-pg-pool]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/node/opentelemetry-plugin-pg-pool
[otel-plugin-pg]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/node/opentelemetry-plugin-pg
[otel-plugin-redis]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/node/opentelemetry-plugin-redis
28 changes: 28 additions & 0 deletions metapackages/plugins-node-all/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@opentelemetry/plugins-node-all",
"version": "0.8.3",
"description": "Metapackage which bundles opentelemetry node core and contrib plugins",
"author": "OpenTelemetry Authors",
"homepage": "https://github.com/open-telemetry/opentelemetry-js#readme",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/open-telemetry/opentelemetry-js.git"
},
"bugs": {
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
"@opentelemetry/plugins-node-core": "^0.8.3",
"@opentelemetry/plugin-express": "0.8.0",
"@opentelemetry/plugin-ioredis": "0.8.0",
"@opentelemetry/plugin-mongodb": "0.8.0",
"@opentelemetry/plugin-mysql": "0.8.0",
"@opentelemetry/plugin-pg-pool": "0.8.0",
"@opentelemetry/plugin-pg": "0.8.0",
"@opentelemetry/plugin-redis": "0.8.0"
}
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
"@commitlint/config-conventional": "8.3.4",
"beautify-benchmark": "0.2.4",
"benchmark": "2.1.4",
"eslint": "6.8.0",
"eslint-config-airbnb-base": "14.1.0",
"eslint": "7.2.0",
"eslint-config-airbnb-base": "14.2.0",
"eslint-plugin-import": "2.21.2",
"eslint-plugin-header": "3.0.0",
"@typescript-eslint/eslint-plugin": "3.2.0",
"@typescript-eslint/parser": "3.2.0",
"@typescript-eslint/eslint-plugin": "3.3.0",
"@typescript-eslint/parser": "3.3.0",
"gh-pages": "3.0.0",
"gts": "2.0.2",
"husky": "4.2.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-api/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2019, OpenTelemetry Authors
* 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.
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"codecov": "3.7.0",
"gts": "2.0.2",
"istanbul-instrumenter-loader": "3.0.1",
"karma": "5.0.9",
"karma": "5.1.0",
"karma-chrome-launcher": "3.1.0",
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-mocha": "2.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-api/src/api/context.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2020, OpenTelemetry Authors
/*
* 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.
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-api/src/api/global-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2020, OpenTelemetry Authors
/*
* 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.
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-api/src/api/metrics.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2020, OpenTelemetry Authors
/*
* 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.
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-api/src/api/propagation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2020, OpenTelemetry Authors
/*
* 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.
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-api/src/api/trace.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2020, OpenTelemetry Authors
/*
* 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.
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-api/src/common/Logger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2019, OpenTelemetry Authors
/*
* 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.
Expand Down
6 changes: 2 additions & 4 deletions packages/opentelemetry-api/src/common/Time.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2019, OpenTelemetry Authors
/*
* 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.
Expand All @@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/** High resolution HrTime: [seconds: number, nanoseconds: number] */
export type HrTime = [number, number];

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2019, OpenTelemetry Authors
/*
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2019, OpenTelemetry Authors
/*
* 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.
Expand Down
Loading

0 comments on commit e2984f6

Please sign in to comment.