Skip to content
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

feat: allow to pass custom sdk for fullstory #60

Merged
merged 1 commit into from
Jan 21, 2022

Conversation

yordis
Copy link
Contributor

@yordis yordis commented Oct 20, 2021

fixes #30

Context

This change will allow passing a different client. That means you can create your own client implementation that uses Segment over Fullstory directly.

Breaking Changes

I would prefer to remove the default import since I don't want to bundle up such a dependency. Although it is less than ideal and we should avoid breaking changes, this sounds like something simple enough that upgrading is a matter of importing Fullstory SDK and passing it to the initialization.

Another proposal

Ideally, Segment would have its own integration SDK with Sentry, or even Google Analytics or any of those tools that track user events.

Packages like https://www.npmjs.com/package/analytics try to standardize across a common API since they all seem to behave really similarly.

If such new integration standardize using the following

import { Event, EventHint } from '@sentry/types';

type ExceptionProperties = {
  name?: string;
  message?: string;
};

export interface Tracker {
  track(eventName: Event, properties: ExceptionProperties): Event;
}

Then we could probably implement something that will work for most of those tools.

I am more than happy to take the lead on such a topic, just need support from Sentry on the topic, I would prefer to move the ownership under the org eventually.

We would probably want to set up a workspace so we can have multiple implementations of the tracker.

@yordis
Copy link
Contributor Author

yordis commented Nov 7, 2021

@leeandher could you share some love over here as well 🙏🏻 🙏🏻 🙏🏻 🙏🏻 🙏🏻

@leeandher leeandher self-assigned this Dec 9, 2021
@yordis yordis force-pushed the yordis/add-dependency-injection branch 3 times, most recently from c425b9a to c86b5d4 Compare December 12, 2021 04:08
@leeandher leeandher removed their assignment Jan 5, 2022
@leeandher
Copy link
Member

@yordis Sorry for another late response, but if you could rebase this PR I can go ahead and restart the review process to get this merged!

@yordis
Copy link
Contributor Author

yordis commented Jan 19, 2022

Right on, let me work on this today

@yordis yordis force-pushed the yordis/add-dependency-injection branch from c86b5d4 to 5cc1462 Compare January 20, 2022 01:15
@yordis
Copy link
Contributor Author

yordis commented Jan 20, 2022

I think it is ready,

One thought that came to my mind, take it with a grain of salt since I am just want to share some thoughts out of context.

About Logging

The more logging the integrations and Sentry itself adds the bigger the bundle, and noisy the integrations become.

Ideally, pass the logger as a dependency at the very minimal (that means don't use console directly)

But in reality, most of the logging should be added by yet another closure that somebody would create because it wants logs.

For example,

const sentryProcessor = makeSentryProcessor();

const sentryProcessorWithLogger = withLogger(sentryProcessor);

// just making a point of keep wrapping thing, embracing SOLID

Default values that can't be minimize

It is always a balance between adding good defaults (in this case the baseSentryUrl) or the consumers having to know about such a thing.

The more defaults you add, the bigger the bundle especially when those default values are not applicable for whatever reason.

Same strategy before, yet another function (really minifier friendly) that give you the defaults but don't assume thing about consumers

import { makeSentryProcessor, withDefaultConfiguration } from '...'
const sentryProcessor = makeSentryProcessor(
  withDefaultConfiguration({
    //....
  })
)

People don't read docs

No question ask, don't have an answer other than training people and make documentation that makes more sense like following, https://diataxis.fr/ we wrote an ADR trying to help on the topic: https://github.com/straw-hat-team/adr/tree/master/adrs/3223845695

@yordis
Copy link
Contributor Author

yordis commented Jan 20, 2022

Please double-check me in the PR.

Remember we need to remove the default client, but it would require a breaking change, or we can expose two clients, where one client does have the import type of thing.

Copy link
Member

@leeandher leeandher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yordis Changes look good to me! Thanks for the types and util file additions as well, it's a lot more readable. For now, I think the client as a default option is a trade-off we're going to make as we want to avoid breaking changes if possible. Bandwidth on the integration team is stretched across multiple services external to Sentry, and we don't have capacity to go forward with a project like that just yet.

Thanks for sharing your thoughts though and being super patient with our review process!

@leeandher leeandher merged commit a69049b into getsentry:master Jan 21, 2022
leeandher added a commit that referenced this pull request Jan 21, 2022
With the new open source contributions merged, we are ready to release a new version with those changes.
 - Custom client option change: #60 
 - Exception catching on client methods: #58
@yordis yordis deleted the yordis/add-dependency-injection branch January 21, 2022 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loading Fullstory through Segment not supported
3 participants