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

refactor: log event name change #550

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/orca-loader/Hyper.res
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ let make = (publishableKey, options: option<JSON.t>, analyticsInfo: option<JSON.
resolve(JSON.Encode.null)
})
->then(_ => {
logger.setLogInfo(~value=Window.hrefWithoutSearch, ~eventName=ORCA_ELEMENTS_CALLED)
logger.setLogInfo(~value=Window.hrefWithoutSearch, ~eventName=WEB_SDK_IFRAME_MOUNTED)
resolve()
})
->ignore
Expand Down
17 changes: 10 additions & 7 deletions src/orca-log-catcher/OrcaLogger.res
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type eventName =
| APP_REINITIATED
| LOG_INITIATED
| LOADER_CALLED
| ORCA_ELEMENTS_CALLED
| WEB_SDK_IFRAME_MOUNTED
Copy link
Contributor

@ArushKapoorJuspay ArushKapoorJuspay Aug 21, 2024

Choose a reason for hiding this comment

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

Could you please explain the use case of this event? Can it be something like HYPER_ELEMENTS_CALLED or ELEMENTS_CALLED?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We wanted to make it more readable to merchant in control center's audit trail. The names like HYPER_ELEMENTS_CALLED or ELEMENTS_CALLED makes more sense to Hyperswitch devs, but we wanted to make it more generic.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please rename this to PAYMENT_ELEMENTS_INITIATED. Since we should not have WEB as a prefix for any log event. Also since this is not the only iframe which gets mounted, it will be confusing moving forward

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The name of mobile counter part of this event name is APP_RENDERED so we can use WEB as prefix for this one. Agree, PAYMENT_ELEMENTS_INITIATED is more a generic and umbrella term as it's not only about an iframe. But to a merchant iframe mounted is a more tangible event instead of something like elements initiated. The merchant should be able to derive some sense out of an event name. Let's decide a self explanatory event name for this before moving forward. cc @seekshiva @akash-c-k @PritishBudhiraja

| PAYMENT_OPTIONS_PROVIDED
| BLUR
| FOCUS
Expand Down Expand Up @@ -120,7 +120,7 @@ let eventNameToStrMapper = eventName => {
| APP_REINITIATED => "APP_REINITIATED"
| LOG_INITIATED => "LOG_INITIATED"
| LOADER_CALLED => "LOADER_CALLED"
| ORCA_ELEMENTS_CALLED => "ORCA_ELEMENTS_CALLED"
| WEB_SDK_IFRAME_MOUNTED => "WEB_SDK_IFRAME_MOUNTED"
| PAYMENT_OPTIONS_PROVIDED => "PAYMENT_OPTIONS_PROVIDED"
| BLUR => "BLUR"
| FOCUS => "FOCUS"
Expand Down Expand Up @@ -539,14 +539,17 @@ let make = (
let counter = eventName->calculateAndUpdateCounterHook
if GlobalVars.enableLogging && counter <= maxLogsPushedPerEventName {
switch loggingLevel {
| DEBUG => log->Array.push(mainLogFile, _)->ignore
| DEBUG => log->(Array.push(mainLogFile, _))->ignore
| INFO =>
[INFO, WARNING, ERROR]->Array.includes(log.logType)
? log->Array.push(mainLogFile, _)->ignore
? log->(Array.push(mainLogFile, _))->ignore
: ()
| WARNING =>
[WARNING, ERROR]->Array.includes(log.logType) ? log->Array.push(mainLogFile, _)->ignore : ()
| ERROR => [ERROR]->Array.includes(log.logType) ? log->Array.push(mainLogFile, _)->ignore : ()
[WARNING, ERROR]->Array.includes(log.logType)
? log->(Array.push(mainLogFile, _))->ignore
: ()
| ERROR =>
[ERROR]->Array.includes(log.logType) ? log->(Array.push(mainLogFile, _))->ignore : ()
| SILENT => ()
}
}
Expand Down Expand Up @@ -594,7 +597,7 @@ let make = (
let checkForPriorityEvents = (arrayOfLogs: array<logFile>) => {
let priorityEventNames = [
APP_RENDERED,
ORCA_ELEMENTS_CALLED,
WEB_SDK_IFRAME_MOUNTED,
PAYMENT_DATA_FILLED,
PAYMENT_ATTEMPT,
CONFIRM_CALL,
Expand Down
Loading