-
Notifications
You must be signed in to change notification settings - Fork 1
#634 Logging #660
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
base: main
Are you sure you want to change the base?
#634 Logging #660
Conversation
Work in Progress |
@mhmdkrmabd @HadesArchitect how we doing on this? Do we want to pull this into the next major release (right click)? |
It looks good and will be finalized tomorrow, but I'm worried about proper testing. With no autotests and a huge changeset, we'll need to test everything manually. |
|
With more debug added, I see why the app is never It brings two questions:
@mhmdkrmabd @digiserg, wdyt?
Much later, after I manually exit the workbench: ...
19:25:57.638 › PTY instance exited! exitcode: 0 signal: 9 Some log output is omitted for clarity |
Manual call for aleks@aleksmacbookcable axonops-workbench % ./main/bin/cqlsh/cqlsh
[3428] Failed to load Python shared library '/Users/aleks/axonops-workbench/main/bin/cqlsh/_internal/Python': dlopen: dlopen(/Users/aleks/axonops-workbench/main/bin/cqlsh/_internal/Python, 0x000A): tried: '/Users/aleks/axonops-workbench/main/bin/cqlsh/_internal/Python' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/aleks/axonops-workbench/main/bin/cqlsh/_internal/Python' (no such file), '/Users/aleks/axonops-workbench/main/bin/cqlsh/_internal/Python' (no such file)
aleks@aleksmacbookcable axonops-workbench % echo $?
255 The cqlsh file was downloaded as described in instructions |
@HadesArchitect well based on the log it seems the building process of cqlsh wasn't successful, a Python shared library is missing, and the workbench - and this is only happening on macOS - is running an initialization process to grant privileges regarding the access of OS keychain and other permissions. The workbench would show notification to users about missing binaries, but in our case it's seems to be corrupted. Did you build the binaries from your side? If so you please try those instead: P.S: Saw the new comment. Let us test the darwin version of the binaries in our side to make sure it's not a common issue |
Thanks @mhmdkrmabd I'll try those tomorrow |
Use this script to download the binaries: CQLSH_BUILD_VERSION="0.14.3"
CQLSH_GITHUB_URL='https://github.com/axonops/axonops-workbench-cqlsh/releases/download'
mkdir -p main/bin
for binary in cqlsh keys_generator; do
curl -fL ${CQLSH_GITHUB_URL}/${CQLSH_BUILD_VERSION}/${binary}-$(uname -s)-$(uname -m).tar | tar xf - -C main/bin
mv main/bin/${binary}-$(uname -s)-$(uname -m) main/bin/${binary}
mv main/bin/${binary}/${binary}-$(uname -s)-$(uname -m) main/bin/${binary}/${binary}
done |
Thanks, @digiserg. This script works. I see it brings more than just two files; I'll update the documentation accordingly. The first question is answered, the second one is still to do: "How do we detect an issue like that so we write something meaningful to user and in log?" I'd extend check of these dependencies: not only check the presence of the files, but maybe call them and check exit code. |
Ready for review |
@HadesArchitect thank you for your effort! I'll review it as soon as possible 👍 |
Sample log file: main.log |
Updated PR description to describe changes, test process and add special notes. |
@mhmdkrmabd can you review this please we should merge this in if possible for next weeks release |
@mhmdkrmabd @HadesArchitect if you can please fix the merge conflict, I'll trigger a build for this branch to test and it contains lots of changes. |
@digiserg if @HadesArchitect wasn't have time or not able to do that I'll try to handle it today once I finish work in hand We've many upcoming PRs, one on the way shortly |
I can do it in a couple of hours
ср, 19 февр. 2025 г., 10:23 Mohammed Abed El Hay Abu Baker <
***@***.***>:
… @digiserg <https://github.com/digiserg> if @HadesArchitect
<https://github.com/HadesArchitect> wasn't have time or not able to do
that I'll try to handle it today once I finish work in hand
—
Reply to this email directly, view it on GitHub
<#660 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANJLXJBTKGMCQH3QIUUXTL2QRERTAVCNFSM6AAAAABUB6MUECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRYGAZDOMZZGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
[image: mhmdkrmabd]*mhmdkrmabd* left a comment
(axonops/axonops-workbench#660)
<#660 (comment)>
@digiserg <https://github.com/digiserg> if @HadesArchitect
<https://github.com/HadesArchitect> wasn't have time or not able to do
that I'll try to handle it today once I finish work in hand
—
Reply to this email directly, view it on GitHub
<#660 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANJLXJBTKGMCQH3QIUUXTL2QRERTAVCNFSM6AAAAABUB6MUECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRYGAZDOMZZGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Signed-off-by: Aleks Volochnev <a.volochnev@gmail.com>
Resolved conflict |
|
||
// Add those secrets to the final result | ||
temp.info.secrets = JSON.parse(secret.password) | ||
if (secret == undefined) { |
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 needs to be secret != undefined
) | ||
} catch (e) { | ||
// If no secrets have been provided then skip | ||
if (cluster.info.secrets != undefined && Object.keys(cluster.info.secrets).length > 0) { |
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 needs to be back within try-catch block, in case cluster.info
doesn't have secrets
attribute/key it'll throw a critical runtime error
|
||
// Get a random free-to-use ports for the AxonOps agent and Apache Cassandra | ||
[this.axonopsPort, this.cassandraPort] = await getRandomPort(2) |
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.
No need for this change, getRandomPort
function return an array of ports
authentication.privateKey = prasedKey.getPrivatePEM() | ||
} catch (e) { | ||
// If a pass phrase for the private key file has been passed | ||
if (data.passphrase != undefined && data.passphrase.trim().length > 0) { |
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 line of code needs to be within a try-catch block, trim
function will throw an error in case it's called by non-String object, in case where data.passphrase
is undefined a runtime error will cause the process to be terminated
if (sshTunnel.port != clusterID) | ||
return | ||
|
||
if (isPort) { |
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 part needs to be reviewed, looks like it return different results from the original implementation
errorLog(e, 'common') | ||
} catch (e) {} | ||
// Save `username` | ||
if (credentialsArray.authusername.trim().length != 0) |
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 should be within try-catch block, reason explained in a previous comment
errorLog(e, 'common') | ||
} catch (e) {} | ||
// Save the SSH `username` | ||
if (credentialsArray.sshusername.trim().length != 0) |
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 one also
Okay @HadesArchitect thanks a lot for the effort and time you did for that PR. I've added some comments that should be handled, when they're handled I'll consider to do further tests. Regarding the try-catch blocks, if statements, the way of handling things, everything is in place for a purpose, it's fine to modify minor things - like using Please consider reading the comments when you have time, am tuned for the changes, thank you! 😄 |
@mhmdkrmabd @HadesArchitect any updates on this? |
Sorry, guys, the review got me right on a vacation. I'll try to make requested changes in the next few days. |
Fixes #634: "Replace custom logger with a standard library."
What was done
electron-log
catch (e) {}
Maintainability Improvement: avoid error suppression #710How to test
Due to a lack of automated testing and a big changeset (25 files affected, +570/-1300), we must run extensive manual testing to avoid regression.
npm i
to get the new dependencymain + renderer
debugger./Users/[USER]/Library/Logs/AxonOps Workbench/main.log
Path to the log file is printed in console if the logging to file is enabled.Special notes
warning
log-level has been set. Personally, I disagree with many of those cases as I'd consider them as errors, thuserror
log-level would be more suitable, but they aren't processed as errors (control flow goes as if nothing happened).throw 0
) is an anti-pattern. Exceptions are designed for handling exceptional situations, not a regular flow control (https://wiki.c2.com/?DontUseExceptionsForFlowControl).