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

Adding errors event listener #5563

Merged
merged 22 commits into from
Sep 8, 2020
Merged

Adding errors event listener #5563

merged 22 commits into from
Sep 8, 2020

Conversation

ofirpaBrowsi
Copy link
Contributor

@ofirpaBrowsi ofirpaBrowsi commented Aug 3, 2020

Type of change

  • Feature

Description of change

Added event emitter on every error logged to the console.

Using this listener will provide a way to get debug events without the need of 'debug mode'

Usage:
pbjs.onEvent('auctionDebug', (debugData) => { //Do stuff with the error data });

The idea came from the need to track our clients prebid errors, using this single event we can log prebid errors to our servers, notice their existence and fix them ASAP.

@harpere harpere self-assigned this Aug 4, 2020
@harpere harpere added needs review needs 2nd review Core module updates require two approvals from the core team labels Aug 4, 2020
@harpere harpere self-requested a review August 4, 2020 14:47
@patmmccann
Copy link
Collaborator

patmmccann commented Aug 4, 2020

Do we need a test similar to test/spec/AnalyticsAdapter_spec.js line 75?

@GLStephen
Copy link
Collaborator

@ofirpaBrowsi this seems like a good change. I'd like to see one small change in addition to the feedback from @patmmccann. It is likely that someone may want to log other events later. It would be nice to change this to some variant of the below. This is pseudocode so doublecheck the syntax downstream.

events.emit(CONSTANTS.EVENTS.AUCTION_DEBUG, {type: 'ERROR', arguments: arguments});

This is a small change to allow some flexibility later with the goal of eventually allowing any other console debug to be sent through this channel, without adding another event type.

@patmmccann
Copy link
Collaborator

I added my suggestion on ofirpaBrowsi#1

@patmmccann
Copy link
Collaborator

patmmccann commented Aug 6, 2020

fascinating behavior here; sigmoid and prebidanalyticsmanager are creating errors in their test spec which now go against the event count in those specs. fixed on ofirpaBrowsi#2

@ofirpaBrowsi
Copy link
Contributor Author

ofirpaBrowsi commented Aug 9, 2020

@patmmccann Haven't noticed your fix PR (ofirpaBrowsi#2). I've Fixed it as same as you did though.

@ofirpaBrowsi ofirpaBrowsi reopened this Aug 9, 2020
@ofirpaBrowsi
Copy link
Contributor Author

@harpere @GLStephen any concerns?

@ofirpaBrowsi
Copy link
Contributor Author

@harpere What should I do with the change request?

@ofirpaBrowsi
Copy link
Contributor Author

Hi @harpere, Please help merging this PR?

@gpolaert
Copy link
Contributor

What about naming it "onError" instead?

@ofirpaBrowsi
Copy link
Contributor Author

What about naming it "onError" instead?

@GLStephen @harpere What do you think?

@harpere
Copy link
Collaborator

harpere commented Aug 31, 2020

I like the onError suggestion. @GLStephen ?

Copy link
Collaborator

@harpere harpere left a comment

Choose a reason for hiding this comment

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

what's there LGTM, though note we should consider the onError recommendation mentioned earlier.

@GLStephen
Copy link
Collaborator

@harpere @ofirpaBrowsi @gpolaert Semantically onError, or ON_ERROR, makes sense but ultimately we could send any of the debug info, so ON_DEBUG is maybe even more clear, at which point the current AUCTION_DEBUG is pretty close. The names of the whole array of events has never followed an "on" semantic though I agree it would have been arguably better.

I don't have heartburn about either approach at this point. @harpere your call

@harpere
Copy link
Collaborator

harpere commented Aug 31, 2020

@ofirpaBrowsi - Let's change it so adding "INFO" or "WARN" later makes more sense. Though "onError" doesn't follow the existing format (EXISTING_FORMAT). Maybe just "ERROR"? or "AUCTION_ERROR"?

@patmmccann
Copy link
Collaborator

AUCTION_ERROR was the original commit; we've come full circle :)

@harpere
Copy link
Collaborator

harpere commented Aug 31, 2020

AUCTION_ERROR was the original commit; we've come full circle :)

funny!

@GLStephen
Copy link
Collaborator

GLStephen commented Aug 31, 2020

@patmmccann @harpere We have indeed. Too funny. To be fair my initial feedback was focused around making the change to process any of the debug/error related debug levels without another event being created. The name change of the actual event was a more subjective thing.

@patmmccann
Copy link
Collaborator

@ofirpaBrowsi if you change the event name lmk so I can change the docs pr prebid/prebid.github.io#2255

@harpere
Copy link
Collaborator

harpere commented Sep 1, 2020

@ofirpaBrowsi will you make the change?

@ofirpaBrowsi
Copy link
Contributor Author

ofirpaBrowsi commented Sep 1, 2020

@ofirpaBrowsi will you make the change?

@harpere I think we can use the current name (AUCTION_DEBUG) as it is not only for errors

@harpere
Copy link
Collaborator

harpere commented Sep 2, 2020

@harpere I think we can use the current name (AUCTION_DEBUG) as it is not only for errors

@ofirpaBrowsi The event only fires from inside logError()

@harpere
Copy link
Collaborator

harpere commented Sep 2, 2020

we just spoke about this in the Prebid JS committee meeting and there was agreement that we should change the name of the event.

@ofirpaBrowsi
Copy link
Contributor Author

@harpere I think we can use the current name (AUCTION_DEBUG) as it is not only for errors

@ofirpaBrowsi The event only fires from inside logError()

Correct, but we planned to use this event on other debug events too (we added the 'TYPE' prop for this)
Anyway, I will change it as you wish, but please lmk what is the best name from your opinion.

@harpere
Copy link
Collaborator

harpere commented Sep 2, 2020

@ofirpaBrowsi - Sorry for the disconnect. I think that's fine too (and don't think anyone else in the meeting would object), but if we do it that way, let's add the other event Types - WARN, INFO, MESSAGE (add to those log functions).

@ofirpaBrowsi
Copy link
Contributor Author

@ofirpaBrowsi - Sorry for the disconnect. I think that's fine too (and don't think anyone else in the meeting would object), but if we do it that way, let's add the other event Types - WARN, INFO, MESSAGE (add to those log functions).

@harpere No problem, will be done, please note that the event emitter is using the 'logMessage' function so we could not implement AUCTION_DEBUG to this log type as it will cause infinite loop.

@harpere
Copy link
Collaborator

harpere commented Sep 3, 2020

@harpere No problem, will be done, please note that the event emitter is using the 'logMessage' function so we could not implement AUCTION_DEBUG to this log type as it will cause infinite loop.

thanks @ofirpaBrowsi makes sense.

@GLStephen
Copy link
Collaborator

@harpere @ofirpaBrowsi can we/I merge this?

@harpere
Copy link
Collaborator

harpere commented Sep 8, 2020

was hoping to get the event added to the other log functions, but that can be done later. yes, let's merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs docs needs review needs 2nd review Core module updates require two approvals from the core team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants