Skip to content

Commit ce68f87

Browse files
authored
feat(otel): Add initial package for otel (#6002)
Add boilerplate package for OpenTelemetry Node. I would like to make this a separate package because we are dependent on the https://github.com/open-telemetry/opentelemetry-js-api, and I don't want to include that as a dependency for everyone else. The nice thing is that we can require the usage of `@sentry/tracing`, so users only have to install `@sentry/opentelemetry-node`! Aka either use `@sentry/tracing` OR use `@sentry/opentelemetry-node`. As such, installation looks like so: ```ts yarn add @sentry/node @sentry/opentelemetry-node ```
1 parent 21c64ac commit ce68f87

File tree

15 files changed

+194
-0
lines changed

15 files changed

+194
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"packages/nextjs",
4747
"packages/node",
4848
"packages/node-integration-tests",
49+
"packages/opentelemetry-node",
4950
"packages/react",
5051
"packages/remix",
5152
"packages/serverless",

packages/e2e-tests/publish-packages.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ const packageTarballPaths = glob.sync('packages/*/sentry-*.tgz', {
1616

1717
// Publish built packages to the fake registry
1818
packageTarballPaths.forEach(tarballPath => {
19+
// Don't run publish opentelemetry-node package because it is private.
20+
if (tarballPath.includes('sentry-opentelemetry-node')) {
21+
return;
22+
}
23+
1924
// `--userconfig` flag needs to be before `publish`
2025
childProcess.execSync(`npm --userconfig ${__dirname}/test-registry.npmrc publish ${tarballPath}`, {
2126
cwd: repositoryRoot, // Can't use __dirname here because npm would try to publish `@sentry-internal/e2e-tests`

packages/e2e-tests/verdaccio-config/config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ packages:
8686
unpublish: $all
8787
# proxy: npmjs # Don't proxy for E2E tests!
8888

89+
'@sentry/opentelemetry-node':
90+
access: $all
91+
publish: $all
92+
unpublish: $all
93+
# proxy: npmjs # Don't proxy for E2E tests!
94+
8995
'@sentry/react':
9096
access: $all
9197
publish: $all
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
env: {
3+
node: true,
4+
},
5+
extends: ['../../.eslintrc.js'],
6+
rules: {
7+
'@sentry-internal/sdk/no-async-await': 'off',
8+
},
9+
};

packages/opentelemetry-node/LICENSE

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Copyright (c) 2022 Sentry (https://sentry.io) and individual contributors. All rights reserved.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
4+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
5+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
6+
persons to whom the Software is furnished to do so, subject to the following conditions:
7+
8+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
9+
Software.
10+
11+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
12+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
13+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

packages/opentelemetry-node/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<p align="center">
2+
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
3+
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
4+
</a>
5+
</p>
6+
7+
# Official Sentry SDK for OpenTelemetry Node
8+
9+
[![npm version](https://img.shields.io/npm/v/@sentry/opentelemetry-node.svg)](https://www.npmjs.com/package/@sentry/opentelemetry-node)
10+
[![npm dm](https://img.shields.io/npm/dm/@sentry/opentelemetry-node.svg)](https://www.npmjs.com/package/@sentry/opentelemetry-node)
11+
[![npm dt](https://img.shields.io/npm/dt/@sentry/opentelemetry-node.svg)](https://www.npmjs.com/package/@sentry/opentelemetry-node)
12+
13+
## Links
14+
15+
- [Official SDK Docs](https://docs.sentry.io/quickstart/)
16+
17+
## Usage
18+
19+
TODO
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('../../jest/jest.config.js');
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"name": "@sentry/opentelemetry-node",
3+
"version": "7.16.0",
4+
"description": "Official Sentry SDK for OpenTelemetry Node.js",
5+
"private": true,
6+
"repository": "git://github.com/getsentry/sentry-javascript.git",
7+
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/opentelemetry-node",
8+
"author": "Sentry",
9+
"license": "MIT",
10+
"engines": {
11+
"node": ">=8"
12+
},
13+
"main": "build/cjs/index.js",
14+
"module": "build/esm/index.js",
15+
"types": "build/types/index.d.ts",
16+
"publishConfig": {
17+
"access": "public"
18+
},
19+
"dependencies": {
20+
"@sentry/core": "7.16.0",
21+
"@sentry/tracing": "7.16.0",
22+
"@sentry/types": "7.16.0",
23+
"@sentry/utils": "7.16.0"
24+
},
25+
"peerDependencies": {
26+
"@opentelemetry/api": "1.x",
27+
"@opentelemetry/sdk-trace-base": "1.x"
28+
},
29+
"devDependencies": {
30+
"@opentelemetry/api": "^1.2.0",
31+
"@opentelemetry/sdk-trace-base": "^1.7.0"
32+
},
33+
"scripts": {
34+
"build": "run-p build:rollup build:types",
35+
"build:dev": "run-s build",
36+
"build:rollup": "rollup -c rollup.npm.config.js",
37+
"build:types": "tsc -p tsconfig.types.json",
38+
"build:watch": "run-p build:rollup:watch build:types:watch",
39+
"build:dev:watch": "run-s build:watch",
40+
"build:rollup:watch": "rollup -c rollup.npm.config.js --watch",
41+
"build:types:watch": "tsc -p tsconfig.types.json --watch",
42+
"build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build",
43+
"circularDepCheck": "madge --circular src/index.ts",
44+
"clean": "rimraf build coverage sentry-node-*.tgz",
45+
"fix": "run-s fix:eslint fix:prettier",
46+
"fix:eslint": "eslint . --format stylish --fix",
47+
"fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"",
48+
"lint": "run-s lint:prettier lint:eslint",
49+
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
50+
"lint:prettier": "prettier --check \"{src,test,scripts}/**/*.ts\"",
51+
"test": "run-s test:jest",
52+
"test:jest": "jest",
53+
"test:watch": "jest --watch"
54+
},
55+
"volta": {
56+
"extends": "../../package.json"
57+
}
58+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { makeBaseNPMConfig, makeNPMConfigVariants } from '../../rollup/index.js';
2+
3+
export default makeNPMConfigVariants(makeBaseNPMConfig());
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* Test function
3+
*/
4+
export function test(): void {
5+
// no-op
6+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { test } from '../src';
2+
3+
describe('index', () => {
4+
it('runs', () => {
5+
test();
6+
});
7+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
4+
"include": ["src/**/*"],
5+
6+
"compilerOptions": {
7+
// package-specific options
8+
}
9+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
4+
"include": ["test/**/*"],
5+
6+
"compilerOptions": {
7+
// should include all types from `./tsconfig.json` plus types for all test frameworks used
8+
"types": ["node", "jest"]
9+
10+
// other package-specific, test-specific options
11+
}
12+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
4+
"compilerOptions": {
5+
"declaration": true,
6+
"declarationMap": true,
7+
"emitDeclarationOnly": true,
8+
"outDir": "build/types"
9+
}
10+
}

yarn.lock

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3013,6 +3013,11 @@
30133013
dependencies:
30143014
"@opentelemetry/context-base" "^0.12.0"
30153015

3016+
"@opentelemetry/api@^1.2.0":
3017+
version "1.2.0"
3018+
resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.2.0.tgz#89ef99401cde6208cff98760b67663726ef26686"
3019+
integrity sha512-0nBr+VZNKm9tvNDZFstI3Pq1fCTEDK5OZTnVKNvBNAKgd0yIvmwsP4m61rEv7ZP+tOUjWJhROpxK5MsnlF911g==
3020+
30163021
"@opentelemetry/context-base@^0.12.0":
30173022
version "0.12.0"
30183023
resolved "https://registry.yarnpkg.com/@opentelemetry/context-base/-/context-base-0.12.0.tgz#4906ae27359d3311e3dea1b63770a16f60848550"
@@ -3023,6 +3028,13 @@
30233028
resolved "https://registry.yarnpkg.com/@opentelemetry/context-base/-/context-base-0.14.0.tgz#c67fc20a4d891447ca1a855d7d70fa79a3533001"
30243029
integrity sha512-sDOAZcYwynHFTbLo6n8kIbLiVF3a3BLkrmehJUyEbT9F+Smbi47kLGS2gG2g0fjBLR/Lr1InPD7kXL7FaTqEkw==
30253030

3031+
"@opentelemetry/core@1.7.0":
3032+
version "1.7.0"
3033+
resolved "https://registry.yarnpkg.com/@opentelemetry/core/-/core-1.7.0.tgz#83bdd1b7a4ceafcdffd6590420657caec5f7b34c"
3034+
integrity sha512-AVqAi5uc8DrKJBimCTFUT4iFI+5eXpo4sYmGbQ0CypG0piOTHE2g9c5aSoTGYXu3CzOmJZf7pT6Xh+nwm5d6yQ==
3035+
dependencies:
3036+
"@opentelemetry/semantic-conventions" "1.7.0"
3037+
30263038
"@opentelemetry/core@^0.12.0":
30273039
version "0.12.0"
30283040
resolved "https://registry.yarnpkg.com/@opentelemetry/core/-/core-0.12.0.tgz#a888badc9a408fa1f13976a574e69d14be32488e"
@@ -3032,6 +3044,14 @@
30323044
"@opentelemetry/context-base" "^0.12.0"
30333045
semver "^7.1.3"
30343046

3047+
"@opentelemetry/resources@1.7.0":
3048+
version "1.7.0"
3049+
resolved "https://registry.yarnpkg.com/@opentelemetry/resources/-/resources-1.7.0.tgz#90ccd3a6a86b4dfba4e833e73944bd64958d78c5"
3050+
integrity sha512-u1M0yZotkjyKx8dj+46Sg5thwtOTBmtRieNXqdCRiWUp6SfFiIP0bI+1XK3LhuXqXkBXA1awJZaTqKduNMStRg==
3051+
dependencies:
3052+
"@opentelemetry/core" "1.7.0"
3053+
"@opentelemetry/semantic-conventions" "1.7.0"
3054+
30353055
"@opentelemetry/resources@^0.12.0":
30363056
version "0.12.0"
30373057
resolved "https://registry.yarnpkg.com/@opentelemetry/resources/-/resources-0.12.0.tgz#5eb287c3032a2bebb2bb9f69b44bd160d2a7d591"
@@ -3040,6 +3060,20 @@
30403060
"@opentelemetry/api" "^0.12.0"
30413061
"@opentelemetry/core" "^0.12.0"
30423062

3063+
"@opentelemetry/sdk-trace-base@^1.7.0":
3064+
version "1.7.0"
3065+
resolved "https://registry.yarnpkg.com/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.7.0.tgz#b498424e0c6340a9d80de63fd408c5c2130a60a5"
3066+
integrity sha512-Iz84C+FVOskmauh9FNnj4+VrA+hG5o+tkMzXuoesvSfunVSioXib0syVFeNXwOm4+M5GdWCuW632LVjqEXStIg==
3067+
dependencies:
3068+
"@opentelemetry/core" "1.7.0"
3069+
"@opentelemetry/resources" "1.7.0"
3070+
"@opentelemetry/semantic-conventions" "1.7.0"
3071+
3072+
"@opentelemetry/semantic-conventions@1.7.0":
3073+
version "1.7.0"
3074+
resolved "https://registry.yarnpkg.com/@opentelemetry/semantic-conventions/-/semantic-conventions-1.7.0.tgz#af80a1ef7cf110ea3a68242acd95648991bcd763"
3075+
integrity sha512-FGBx/Qd09lMaqQcogCHyYrFEpTx4cAjeS+48lMIR12z7LdH+zofGDVQSubN59nL6IpubfKqTeIDu9rNO28iHVA==
3076+
30433077
"@opentelemetry/semantic-conventions@^0.12.0":
30443078
version "0.12.0"
30453079
resolved "https://registry.yarnpkg.com/@opentelemetry/semantic-conventions/-/semantic-conventions-0.12.0.tgz#7e392aecdbdbd5d737d3995998b120dc17589ab0"

0 commit comments

Comments
 (0)