Skip to content

Commit 1df4b68

Browse files
committed
feat(google-cloud): Add @sentry/google-cloud package
1 parent 8d0b779 commit 1df4b68

File tree

34 files changed

+1865
-0
lines changed

34 files changed

+1865
-0
lines changed

.craft.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ targets:
9191
- name: npm
9292
id: '@sentry/serverless'
9393
includeNames: /^sentry-serverless-\d.*\.tgz$/
94+
- name: npm
95+
id: '@sentry/google-cloud'
96+
includeNames: /^sentry-google-cloud-\d.*\.tgz$/
9497
- name: npm
9598
id: '@sentry/bun'
9699
includeNames: /^sentry-bun-\d.*\.tgz$/

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ body:
4343
- '@sentry/react'
4444
- '@sentry/remix'
4545
- '@sentry/serverless'
46+
- '@sentry/google-cloud'
4647
- '@sentry/svelte'
4748
- '@sentry/sveltekit'
4849
- '@sentry/vue'

MIGRATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ We've removed the following packages:
4848
- [@sentry/hub](./MIGRATION.md#sentryhub)
4949
- [@sentry/tracing](./MIGRATION.md#sentrytracing)
5050
- [@sentry/integrations](./MIGRATION.md#sentryintegrations)
51+
- [@sentry/serverless](./MIGRATION.md#sentryserverless)
5152

5253
#### @sentry/hub
5354

dev-packages/e2e-tests/test-applications/node-exports-test-app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@sentry/astro": "latest || *",
2020
"@sentry/nextjs": "latest || *",
2121
"@sentry/serverless": "latest || *",
22+
"@sentry/google-cloud": "latest || *",
2223
"@sentry/bun": "latest || *",
2324
"@sentry/types": "latest || *",
2425
"@types/node": "18.15.1",

dev-packages/e2e-tests/test-applications/node-exports-test-app/scripts/consistentExports.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as SentryAstro from '@sentry/astro';
22
import * as SentryBun from '@sentry/bun';
3+
import * as SentryGoogleCloud from '@sentry/google-cloud';
34
import * as SentryNextJs from '@sentry/nextjs';
45
import * as SentryNode from '@sentry/node';
56
import * as SentryNodeExperimental from '@sentry/node-experimental';
@@ -74,6 +75,12 @@ const DEPENDENTS: Dependent[] = [
7475
exports: Object.keys(SentryServerless),
7576
ignoreExports: ['cron', 'hapiErrorPlugin'],
7677
},
78+
{
79+
package: '@sentry/google-cloud',
80+
compareWith: nodeExperimentalExports,
81+
exports: Object.keys(SentryGoogleCloud),
82+
ignoreExports: ['cron', 'hapiErrorPlugin'],
83+
},
7784
{
7885
package: '@sentry/sveltekit',
7986
compareWith: nodeExperimentalExports,

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

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

143+
'@sentry/google-cloud':
144+
access: $all
145+
publish: $all
146+
unpublish: $all
147+
# proxy: npmjs # Don't proxy for E2E tests!
148+
143149
'@sentry/svelte':
144150
access: $all
145151
publish: $all

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"packages/eslint-plugin-sdk",
5757
"packages/feedback",
5858
"packages/gatsby",
59+
"packages/google-cloud",
5960
"packages/integration-shims",
6061
"packages/nextjs",
6162
"packages/node",

packages/google-cloud/.eslintrc.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
env: {
3+
node: true,
4+
},
5+
extends: ['../../.eslintrc.js'],
6+
rules: {
7+
'@sentry-internal/sdk/no-optional-chaining': 'off',
8+
},
9+
overrides: [
10+
{
11+
files: ['scripts/**/*.ts'],
12+
parserOptions: {
13+
project: ['../../tsconfig.dev.json'],
14+
},
15+
},
16+
{
17+
files: ['test/**'],
18+
parserOptions: {
19+
sourceType: 'module',
20+
},
21+
},
22+
],
23+
};

packages/google-cloud/LICENSE

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Copyright (c) 2024 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/google-cloud/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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 Google Cloud Functions
8+
9+
## Links
10+
11+
- [Official SDK Docs](https://docs.sentry.io/)
12+
- [TypeDoc](http://getsentry.github.io/sentry-javascript/)
13+
14+
## General
15+
16+
This package is a wrapper around `@sentry/node`, with added functionality related to various Serverless solutions. All
17+
methods available in `@sentry/node` can be imported from `@sentry/google-cloud`.
18+
19+
To use this SDK, call `Sentry.init(options)` at the very beginning of your JavaScript file.
20+
21+
```javascript
22+
import * as Sentry from '@sentry/google-cloud';
23+
24+
Sentry.init({
25+
dsn: '__DSN__',
26+
tracesSampleRate: 1.0,
27+
// ...
28+
});
29+
30+
// For HTTP Functions:
31+
32+
exports.helloHttp = Sentry.wrapHttpFunction((req, res) => {
33+
throw new Error('oh, hello there!');
34+
});
35+
36+
// For Background Functions:
37+
38+
exports.helloEvents = Sentry.wrapEventFunction((data, context, callback) => {
39+
throw new Error('oh, hello there!');
40+
});
41+
42+
// For CloudEvents:
43+
44+
exports.helloEvents = Sentry.wrapCloudEventFunction((context, callback) => {
45+
throw new Error('oh, hello there!');
46+
});
47+
```

0 commit comments

Comments
 (0)