-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Forge runtime transport #3669
Conversation
Meh, sorry for this. Looks like we have a blocker on our side for this PR: https://ecosystem.atlassian.net/browse/FRGE-273 |
a8b293c
to
aadce0b
Compare
Update on the blocking dependencies:
|
…transport * upstream/master: (29 commits) ref: Always use lowercase files (getsentry#3742) feat: Make dedupe integration default for browser (getsentry#3730) ref(ember): Allow initing Ember without config entry (getsentry#3745) fix(serverless): wrapEventFunction does not await for async code (getsentry#3740) Metrics: Tag CLS elements (getsentry#3734) feat: Add Next.js 11 to supported peer dependencies list (getsentry#3711) test: Run integration tests for Next 10/11 and Webpack 4/5 matrix (getsentry#3741) fix: Correctly limit Buffer requests (getsentry#3736) Whoops. Remove pinned node version from package.json ref: Introduce test runner for node session health tests (getsentry#3728) fix: Prevent circular structure serialization in events (getsentry#3727) ref(node): Update Node manual tests and test for sessionCount (getsentry#3726) ref(ember): Update scenarios and remove a few to speed up tests (getsentry#3720) docs: Fix typos (getsentry#3716) fix(ember): Fix ember test flake (getsentry#3719) release: 6.7.2 ci: fix ember flaky test (getsentry#3718) misc: changelog for release 6.7.2 (getsentry#3717) fix(release-health): Prevent sending terminal status session updates (getsentry#3701) ref: Make beforeSend more strict (getsentry#3713) ...
Happy days. Our changes in the beta branch work fine. On Tuesday next week, we will publish new stable versions of the packages and I will update this PR with these versions. |
…transport * upstream/master: fix(tracing): Add check for document.scripts in metrics (getsentry#3766) ref(nextjs): Stop setting redundant `productionBrowserSourceMaps` in config (getsentry#3765) test: Ensure withScope and run bubble up exceptions (getsentry#3764) ref(gatsby): Default release to empty string (getsentry#3759) fix(nextjs): Make `withSentryConfig` return type match given config type (getsentry#3760) misc: Fix typos (getsentry#3763) fix(node): Enable autoSessionTracking correctly (getsentry#3758) release: 6.8.0 meta: 6.8.0 changelog feat: Enable serialization of multiple DOM attributes for breadcrumbs. (getsentry#3755) ref: Leave only valid buffer implementation (getsentry#3744)
@kamilogorek okay, it's finally happening :) My changes have been published today and this PR should be ready to review. |
Ah, I forgot to replace our company NPM mirror with a public one. Will do in a min. |
5260abd
to
5fcba08
Compare
Alright, it should be fine now. |
Hey @kamilogorek do you need any clarifying comments from me to review this PR? My plan was also to add documentation (https://github.com/getsentry/sentry-docs) after this PR but I can raise a PR in the docs repo in parallel. |
Hey @1999, the PR looks good, however after discussing with the team, we decided to not merge it into the main mono-repo in it's current shape (monorepo shape, not your PR). Current SDK architecture makes it quite hard for 3rd party contributions due to everything being stored in the main packages (in opposition to something like a basic plugin system, or per-feature structure like we are planning to do in the future - see: https://github.com/getsentry/sentry-javascript/tree/v7-dev/packages ). Would it be possible that you create a standalone repo/npm package out of this PR instead? I'm more than happy to do necessary changes to the SDK if there are any that'd prevent you from doing that. Once you do that, we will happily link your package in our documentation with all the necessary explanations and section about Atlassian Forge. Thanks! |
I don't quite agree with this. The way how transport is built is by passing Forge fetch function as a parameter. Also, it is a devDependency, therefore Sentry Node users won't download Forge parts.
That's a 100% valid reason and I fully agree with you.
I remember that I tried to extract this but there were some types that I needed to heavily rely on and these types were not exported. I will take a look again and comment in this PR on what I will need to export. |
@kamilogorek thanks for finding time to review this. I really appreciate this! |
Looks like I will need these types:
and also
Do you think it's reasonable if we export these types and class from |
I think this should already work: import { Transports } from '@sentry/node';
class ForgeRuntimeTransport extends Transports.BaseTransport {
// ...
} as for types, I'll see what we can do there. |
I just realized that all the types you mentioned are self-contained and have no cross-references to the rest of the SDK. Because of this, and the fact that it's only 24LoC, it's rather safe and trivial to vendor them. import { IncomingHttpHeaders, RequestOptions as HTTPRequestOptions } from 'http';
import { RequestOptions as HTTPSRequestOptions } from 'https';
import { URL } from 'url';
export type HTTPModuleRequestOptions = HTTPRequestOptions | HTTPSRequestOptions | string | URL;
export interface HTTPModuleRequestIncomingMessage {
headers: IncomingHttpHeaders;
statusCode?: number;
on(event: 'data' | 'end', listener: () => void): void;
setEncoding(encoding: string): void;
}
export interface HTTPModuleClientRequest {
end(chunk: string): void;
on(event: 'error', listener: () => void): void;
}
export interface HTTPModule {
request(options: HTTPModuleRequestOptions, callback?: (res: HTTPModuleRequestIncomingMessage) => void): HTTPModuleClientRequest;
} |
@kamilogorek this one is challenging. What part of Sentry Node.JS API is considered "public"? As an example, if you decide to change BaseTransport.module type from |
That's a very valid question. We are trying to keep all the public methods/classes and their appropriate configs backward compatible. Eg. a change that you introduced ( |
Shouldn't exporting types be one of the ways to enforce this? Imagine any of the custom transports created outside Sentry monorepo. The only thing they can rely on is a BaseTransport because it is exported. But what about the types used in this module? ( |
I do agree with you, however, after 3 years of this version of SDK being alive, it's the first use-case like this that we had. The reason for this I believe is that |
@kamilogorek fair enough. Thanks for explaining, I will continue with just BaseTransport. |
@kamilogorek good news: we managed to finally publish this custom transport. Here's how it is used in a real Forge app: https://bitbucket.org/atlassian/confluence-recent-edits-overview/src/master/src/sentry.ts. Do you think it's fine if I add a "Transports" section to Node.JS transport docs as you have for PHP? |
Definitely! I'm out next week, but feel free to assign me (or a whole @getsentry/team-webplatform) for a review and I'll take a look once I'm back. |
@kamilogorek have a great week off! Here's a PR: getsentry/sentry-docs#3962 |
@kamilogorek heads up that with the newest release of Forge CLI it is no longer possible to use Sentry in Forge apps. The root cause is webpack@5 that no longer bundles some polyfills and Sentry SDK for Node relies on "domain". Sad but there's not much I can do so I will have to deprecate the transport package. |
Sad to hear, but we opened #4633. Hopefully we can revisit this sometime in the future! |
Thanks for the heads-up @1999, appreciate that |
This is a follow-up to #3655. This PR has the real Forge runtime transport implementation. If this PR gets merged, my next PR will be a change to the documentation. It will contain detailed information on how to use this transport in Forge runtime.
cc @nvenegas