-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(node-experimental): MVP for POTEL
- Loading branch information
Showing
43 changed files
with
1,751 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
env: { | ||
node: true, | ||
}, | ||
extends: ['../../.eslintrc.js'], | ||
rules: { | ||
'@sentry-internal/sdk/no-optional-chaining': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Copyright (c) 2022 Sentry (https://sentry.io) and individual contributors. All rights reserved. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit | ||
persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the | ||
Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | ||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<p align="center"> | ||
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank"> | ||
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84"> | ||
</a> | ||
</p> | ||
|
||
# Official Sentry SDK for Node (Preview) | ||
|
||
[![npm version](https://img.shields.io/npm/v/@sentry/node-experimental.svg)](https://www.npmjs.com/package/@sentry/node-experimental) | ||
[![npm dm](https://img.shields.io/npm/dm/@sentry/node-experimental.svg)](https://www.npmjs.com/package/@sentry/node-experimental) | ||
[![npm dt](https://img.shields.io/npm/dt/@sentry/node-experimental.svg)](https://www.npmjs.com/package/@sentry/node-experimental) | ||
|
||
This is a WIP, proof of concept implementation of a Node SDK that uses OpenTelemetry for performance instrumentation under the hood. | ||
|
||
THIS MAY/WILL BREAK IN MANY UNEXPECTED WAYS. We may remove, add, change any of the integrations, add/remove any exports, etc. | ||
This package is **NOT READY TO USE IN ANY FORM OF PRODUCTION ENVIRONMENT**! | ||
|
||
This SDK is **considered experimental and in an alpha state**. It may experience breaking changes, and may be discontinued at any time. Please reach out on | ||
[GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose) if you have any feedback/concerns. | ||
|
||
## Installation | ||
|
||
```bash | ||
npm install @sentry/node-experimental | ||
|
||
# Or yarn | ||
yarn add @sentry/node-experimental | ||
``` | ||
|
||
## Usage | ||
|
||
```js | ||
// ES5 Syntax | ||
const Sentry = require('@sentry/node-experimental'); | ||
// ES6 Syntax | ||
import * as Sentry from '@sentry/node-experimental'; | ||
|
||
Sentry.init({ | ||
dsn: '__DSN__', | ||
// ... | ||
}); | ||
``` | ||
|
||
Note that it is necessary to initialize Sentry **before you import any package that may be instrumented by us**. | ||
|
||
## Available (Performance) Integrations | ||
|
||
* Http | ||
* Express | ||
* Fastify | ||
* Nest | ||
* Mysql | ||
* Mysql2 | ||
* GraphQL | ||
* Mongo | ||
* Mongoose | ||
* Postgres | ||
* Prisma | ||
|
||
All of these are auto-discovered, you don't need to configure anything for performance. | ||
You still need to register middlewares etc. for error capturing. | ||
Other, non-performance integrations from `@sentry/node` are also available (except for Undici). | ||
|
||
## Links | ||
|
||
- [Official SDK Docs](https://docs.sentry.io/quickstart/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('../../jest/jest.config.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
"name": "@sentry/node-experimental", | ||
"version": "7.60.0", | ||
"description": "Experimental version of a Node SDK using OpenTelemetry for performance instrumentation", | ||
"repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/node-experimental", | ||
"author": "Sentry", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"main": "build/cjs/index.js", | ||
"module": "build/esm/index.js", | ||
"types": "build/types/index.d.ts", | ||
"typesVersions": { | ||
"<4.9": { | ||
"build/types/index.d.ts": [ | ||
"build/types-ts3.8/index.d.ts" | ||
] | ||
} | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@opentelemetry/api": "~1.4.1", | ||
"@opentelemetry/instrumentation": "~0.41.0", | ||
"@opentelemetry/instrumentation-fastify": "~0.32.0", | ||
"@opentelemetry/instrumentation-http": "~0.41.0", | ||
"@opentelemetry/instrumentation-express": "~0.33.0", | ||
"@opentelemetry/instrumentation-graphql": "~0.35.0", | ||
"@opentelemetry/instrumentation-mongodb": "~0.36.0", | ||
"@opentelemetry/instrumentation-mongoose": "~0.33.0", | ||
"@opentelemetry/instrumentation-mysql": "~0.34.0", | ||
"@opentelemetry/instrumentation-mysql2": "~0.34.0", | ||
"@opentelemetry/instrumentation-pg": "~0.36.0", | ||
"@opentelemetry/instrumentation-nestjs-core": "~0.33.0", | ||
"@opentelemetry/semantic-conventions": "~1.15.0", | ||
"@opentelemetry/sdk-trace-node": "~1.15.0", | ||
"@prisma/instrumentation": "~5.0.0", | ||
"@sentry/core": "7.60.0", | ||
"@sentry/node": "7.60.0", | ||
"@sentry/opentelemetry-node": "7.60.0", | ||
"@sentry/types": "7.60.0", | ||
"@sentry/utils": "7.60.0" | ||
}, | ||
"scripts": { | ||
"build": "run-p build:transpile build:types", | ||
"build:dev": "yarn build", | ||
"build:transpile": "rollup -c rollup.npm.config.js", | ||
"build:types": "run-s build:types:core build:types:downlevel", | ||
"build:types:core": "tsc -p tsconfig.types.json", | ||
"build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", | ||
"build:watch": "run-p build:transpile:watch build:types:watch", | ||
"build:dev:watch": "yarn build:watch", | ||
"build:transpile:watch": "rollup -c rollup.npm.config.js --watch", | ||
"build:types:watch": "tsc -p tsconfig.types.json --watch", | ||
"build:tarball": "ts-node ../../scripts/prepack.ts && npm pack ./build", | ||
"circularDepCheck": "madge --circular src/index.ts", | ||
"clean": "rimraf build coverage sentry-node-experimental-*.tgz", | ||
"fix": "run-s fix:eslint fix:prettier", | ||
"fix:eslint": "eslint . --format stylish --fix", | ||
"fix:prettier": "prettier --write \"{src,test,scripts}/**/**.ts\"", | ||
"lint": "run-s lint:prettier lint:eslint", | ||
"lint:eslint": "eslint . --format stylish", | ||
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"", | ||
"test": "yarn test:jest", | ||
"test:jest": "jest", | ||
"test:watch": "jest --watch", | ||
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push" | ||
}, | ||
"volta": { | ||
"extends": "../../package.json" | ||
}, | ||
"sideEffects": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { makeBaseNPMConfig, makeNPMConfigVariants } from '../../rollup/index.js'; | ||
|
||
export default makeNPMConfigVariants(makeBaseNPMConfig()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Integrations as CoreIntegrations } from '@sentry/core'; | ||
|
||
import * as NodePreviewIntegrations from './integrations'; | ||
|
||
const INTEGRATIONS = { | ||
...CoreIntegrations, | ||
...NodePreviewIntegrations, | ||
}; | ||
|
||
export { init } from './sdk/init'; | ||
export { INTEGRATIONS as Integrations }; | ||
export { getAutoPerformanceIntegrations } from './integrations/getAutoPerformanceIntegrations'; | ||
export * as Handlers from './sdk/handlers'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { Instrumentation } from '@opentelemetry/instrumentation'; | ||
import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express'; | ||
import type { Integration } from '@sentry/types'; | ||
|
||
import { NodePerformanceIntegration } from './lazy'; | ||
|
||
/** | ||
* Express integration | ||
* | ||
* Capture tracing data for express. | ||
*/ | ||
export class Express extends NodePerformanceIntegration<void> implements Integration { | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public static id: string = 'Express'; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public name: string = Express.id; | ||
|
||
/** @inheritDoc */ | ||
public setupInstrumentation(): void | Instrumentation[] { | ||
return [new ExpressInstrumentation()]; | ||
} | ||
} |
Oops, something went wrong.