Skip to content

Improve SDK API #4272

Closed
Closed
@yordis

Description

@yordis

Following the request from @AbhiPrasad getsentry/sentry-fullstory#60 (comment)

Related to: getsentry/sentry-fullstory#60

Context

What would be the easiest way we can extract most of the code from this package that would allow people to create sentry-segment or sentry-fullstory from scratch?

Right now they are multiple things happening around the Fullstory itself (if you think about it), that some people (like me) feel the need to extend this one because of fear of maintaining the other code and things could break and requires them to be on top of Sentry SDK (except that Sentry owns these stuff right now).

So the simpler we make it for others to take advantage of such boilerplate code, the easier is to justify to them that they can put a tiny JS in their codebase and own it.

Observation

Although once you read the codebase it makes sense the following https://github.com/getsentry/sentry-fullstory having files like utils or some part of the plugin feels like a sign that the SDK is lacking some helper functions to accomplish common things.

For example,

Get the project ID from a Sentry DSN: https://github.com/getsentry/sentry-fullstory/blob/a5c11c837e3b1a7fe1be244598b227b542eec567/src/util.ts#L3-L9

Which is used in another function: https://github.com/getsentry/sentry-fullstory/blob/a5c11c837e3b1a7fe1be244598b227b542eec567/src/SentryFullStory.ts#L36-L56

That would even remove the need for such a function since "getting the Sentry URL" feels like a common thing to do if you are interested in sending data to other places that correlate to Sentry errors somehow such as analytics events.

Or doing things like https://github.com/getsentry/sentry-fullstory/blob/a5c11c837e3b1a7fe1be244598b227b542eec567/src/SentryFullStory.ts#L59-L60

"// Run the integration ONLY when it was installed on the current Hub AND isn't a transaction"

I still don't know what that means precisely but it seems something important, so a combination of documentation and SDK API should help with this use case (it possible exists, so take it with a grain of salt)

Finally,

Get the message and name properties from the original exception:
https://github.com/getsentry/sentry-fullstory/blob/a5c11c837e3b1a7fe1be244598b227b542eec567/src/util.ts#L15-L27

That sounds like something that people would be interested in if they want to send some information about the error to another system, so definitely really handy for systems that are trying to integrate with Sentry.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions