-
Notifications
You must be signed in to change notification settings - Fork 487
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
Draft: Upgrading from raven-js to sentry/browser #2417
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Muthukumar <[email protected]>
If you see https://docs.sentry.io/platforms/javascript/configuration/integrations/breadcrumbs/ |
Migration in progress Signed-off-by: Muthukumar <[email protected]>
Signed-off-by: Muthukumar <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2417 +/- ##
==========================================
+ Coverage 96.60% 96.61% +0.01%
==========================================
Files 254 254
Lines 7662 7688 +26
Branches 1996 1993 -3
==========================================
+ Hits 7402 7428 +26
Misses 260 260 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Muthukumar <[email protected]>
The PR is almost over, I need to change file names and function names. For now the existing unit tests pass, but any other ways to test this properly? @yurishkuro |
You can set up your own property in GA and test that Jaeger UI generates the desired events, as well as compare them with events generated by the UI before your change. You will probably need to induce some exceptions, e.g. by using Upload function in Search tab and uploading a malformed text. |
Alright, I'll try that. Meanwhile, can you review the code and see if there are any obvious mistakes? |
@@ -169,9 +160,7 @@ function convNav(to: string) { | |||
// "dp" - fetch the dependency data | |||
// And, "NNN" is a non-200 status code. | |||
type TCrumbData = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain what "breadcrumb" means in this context? I saw a link you posted to sentry docs, but they didn't explain it either, just started talking details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will explain this tomorrow, late night here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
breadcrumb in this context is basically any event that is captured. Everything is referred to as a breadcrumb. It basically lets us capture everything leading up to that event/error.
Signed-off-by: Muthukumar <[email protected]>
Signed-off-by: Muthukumar <[email protected]>
README has to be updated, removing the old raven-sdk information. Signed-off-by: Muthukumar <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will you be able to test against Google Analytics?
@@ -22,7 +22,7 @@ export interface IWebAnalyticsFunc { | |||
|
|||
export default interface IWebAnalytics { | |||
init: () => void; | |||
context: boolean | RavenStatic | null; | |||
context: boolean | typeof BrowserClient | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This field is rather confusing to me. Is it a readable property for the user of IWebAnalytics interface? Or is it an input to the implementation of the interface? If it's the latter, why does it need to be exposed in the interface?
Not specifically related to the PR, but I am trying to understand the structure of the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So here, IWebAnalytics
is an interface of the object that is returned by the function IWebAnalyticsFunc
that takes in 3 variables as the input.
This is used in ga.tsx
as function GA
. There, if you notice, context is assigned to BrowserClient
, and not an instance of it. That is why I have kept context as either a boolean, null, or a type of BrowserClient object, and not an instance of it.
Even I am a little confused as to the places it being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is set depending on whether error tracking is enabled on not. It needs to be there on the interface because depending on the config, this needs to be set.
It is used in L56-57 in packages/jaeger-ui/src/utils/tracking/index.tsx
@@ -247,20 +236,14 @@ function compressCssSelector(selector: string) { | |||
// The chronological ordering of the breadcrumbs is older events precede newer | |||
// events. This ordering was kept because it's easier to see which page events | |||
// occurred on. | |||
interface ICrumb { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems like we used an abstraction over Raven type (even though abstraction itself is a bit coupled, but an abstraction nonetheless, i.e. could be implemented by something other than Raven). What's the reason to remove it instead of just adapting? Adapting seems to only require optionality on the fields, which would minimize the changes throughout this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does make sense. But why I thought of using the Breadcrumb
interface from Sentry was because this function convSentryToGa
is called from trackSentryError
in L192, packages/jaeger-ui/src/utils/tracking/ga.tsx
.
So there, the transport options come from the Event
interface in Sentry, which has a breadcrumb field which uses the Breadcrumb
interface. I just thought of keeping it uniform everywhere and since that field already uses the same interface, used it here as well.
Could be better if someone who already has an idea about GA does it. Can you do it? Else I can go through the docs and setup, but will need one or two days. |
Signed-off-by: Muthukumar <[email protected]>
I don't have any of that set up either. At minimum you can enable debug mode and see what the tracking logs into console and compare it with the before version. |
i'll do. |
Hey, I got caught up with a bit of work stuff. I'll test this PR tomorrow and day after, and hopefully by this weekend we can get this done. @yurishkuro |
I tried, but couldn't really find a way to troubleshoot using just the console.log statements. I went through a bunch of tests that use this config in a lot of places, so since they have passed, I am 90% sure this works. It is just the other 10% I'm a little concerned about. |
Is it possible to test with a real GA account / property? There's also a Chrome extension that claims to help with testing. |
Will checkt that out |
Which problem is this PR solving?
Resolves #2412
Description of the changes
I've migrated a part of the things, but I want to know whether the approach is correct or it needs to be different. Hence a draft MR. The names of files, variables etc haven't been changed, this is just in progress.
How was this change tested?
Test cases for now, the old ones with the same payload.
Checklist
jaeger
:make lint test
jaeger-ui
:yarn lint
andyarn test