Skip to content

Commit

Permalink
feat: add mongodb plugin (open-telemetry#205)
Browse files Browse the repository at this point in the history
* feat: add mongodb plugin

* test(plugin-mongodb): add tests for mongodb plugin

* chore(review): address PRs comments / add attributes on each span

* chore: rename mongodb plugin to mongodb-core

* chore(review): fix CI tests + use enum for attributes names

* chore: address PR comments
  • Loading branch information
vmarchaud authored and mayurkale22 committed Nov 15, 2019
1 parent 0c1ff8d commit d80cf56
Show file tree
Hide file tree
Showing 11 changed files with 628 additions and 18 deletions.
12 changes: 11 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,24 @@ version: 2

test_env: &test_env
RUN_POSTGRES_TESTS: 1
RUN_MONGODB_TESTS: 1
POSTGRES_USER: postgres
POSTGRES_DB: circle_database
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
MONGODB_HOST: localhost
MONGODB_PORT: 27017
MONGODB_DB: opentelemetry-tests

postgres_service: &postgres_service
image: circleci/postgres:9.6-alpine
environment: # env to pass to CircleCI, specified values must match test_env
POSTGRES_USER: postgres
POSTGRES_DB: circle_database

mongo_service: &mongo_service
image: mongo

cache_1: &cache_1
key: npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-1
paths:
Expand All @@ -39,7 +46,7 @@ cache_2: &cache_2
- packages/opentelemetry-plugin-grpc/node_modules
- packages/opentelemetry-plugin-http/node_modules
- packages/opentelemetry-plugin-http2/node_modules
- packages/opentelemetry-plugin-mongodb/node_modules
- packages/opentelemetry-plugin-mongodb-core/node_modules
- packages/opentelemetry-plugin-redis/node_modules
- packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/node_modules
- packages/opentelemetry-plugin-document-load/node_modules
Expand Down Expand Up @@ -145,18 +152,21 @@ jobs:
- image: node:8
environment: *test_env
- *postgres_service
- *mongo_service
<<: *node_unit_tests
node10:
docker:
- image: node:10
environment: *test_env
- *postgres_service
- *mongo_service
<<: *node_unit_tests
node12:
docker:
- image: node:12
environment: *test_env
- *postgres_service
- *mongo_service
<<: *node_unit_tests
node12-browsers:
docker:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# OpenTelemetry mongodb Instrumentation for Node.js
# OpenTelemetry mongodb-core Instrumentation for Node.js
[![Gitter chat][gitter-image]][gitter-url]
[![dependencies][dependencies-image]][dependencies-url]
[![devDependencies][devDependencies-image]][devDependencies-url]
[![Apache License][license-image]][license-image]

This module provides automatic instrumentation for [`mongodb`](https://github.com/mongodb/node-mongodb-native).
This module provides automatic instrumentation for [`mongodb-core`](https://github.com/mongodb-js/mongodb-core).

For automatic instrumentation see the
[@opentelemetry/node](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-node) package.

## Installation

```bash
npm install --save @opentelemetry/plugin-mongodb
npm install --save @opentelemetry/plugin-mongodb-core
```

## Usage

```js
const opentelemetry = require('@opentelemetry/plugin-mongodb');
const opentelemetry = require('@opentelemetry/plugin-mongodb-core');

// TODO: DEMONSTRATE API
```
Expand All @@ -36,7 +36,7 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
[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=packages/opentelemetry-plugin-mongodb
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-plugin-mongodb
[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-plugin-mongodb
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-plugin-mongodb&type=dev
[dependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/status.svg?path=packages/opentelemetry-plugin-mongodb-core
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-plugin-mongodb-core
[devDependencies-image]: https://david-dm.org/open-telemetry/opentelemetry-js/dev-status.svg?path=packages/opentelemetry-plugin-mongodb-core
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-plugin-mongodb-core&type=dev
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@opentelemetry/plugin-mongodb",
"name": "@opentelemetry/plugin-mongodb-core",
"version": "0.2.0",
"description": "OpenTelemetry mongodb automatic instrumentation package.",
"description": "OpenTelemetry mongodb-core automatic instrumentation package.",
"private": true,
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
Expand All @@ -18,7 +18,7 @@
},
"keywords": [
"opentelemetry",
"mongodb",
"mongodb-core",
"nodejs",
"tracing",
"profiling",
Expand All @@ -40,22 +40,27 @@
"access": "public"
},
"devDependencies": {
"@opentelemetry/node": "^0.1.1",
"@opentelemetry/tracing": "^0.1.1",
"@types/mocha": "^5.2.7",
"@types/node": "^12.6.9",
"@types/mongodb": "^3.2.3",
"@types/node": "^12.7.2",
"@types/shimmer": "^1.0.1",
"codecov": "^3.6.1",
"gts": "^1.1.0",
"mocha": "^6.2.0",
"mongodb": "^3.3.0",
"nyc": "^14.1.1",
"rimraf": "^3.0.0",
"ts-mocha": "^6.0.0",
"ts-node": "^8.3.0",
"tslint-consistent-codestyle": "^1.15.1",
"tslint-consistent-codestyle": "^1.16.0",
"tslint-microsoft-contrib": "^6.2.0",
"typescript": "3.7.2"
},
"dependencies": {
"@opentelemetry/core": "^0.2.0",
"@opentelemetry/node": "^0.2.0",
"@opentelemetry/types": "^0.2.0"
"@opentelemetry/types": "^0.2.0",
"shimmer": "^1.2.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export * from './mongodb';
Loading

0 comments on commit d80cf56

Please sign in to comment.