Skip to content

Conversation

@KyleBonnes
Copy link
Contributor

Same concept as TorQ's logusage script.
Basic by-hand testing for kdb+ 3.0 and above on Linux

@KyleBonnes KyleBonnes self-assigned this Jul 4, 2025
Copy link
Member

@jonathonmcmurray jonathonmcmurray left a comment

Choose a reason for hiding this comment

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

a few style tweaks to bring this in line with other packages please

@DHopkinson-DI DHopkinson-DI self-assigned this Jul 21, 2025
@DHopkinson-DI DHopkinson-DI requested a review from jonnypress July 22, 2025 13:11
@jonnypress
Copy link
Contributor

@jmlemay could we pull out the unit test framework parts of this package and merge them separately to the main code base so that we all the packages can use the same framework code please?

Copy link
Contributor

@jonnypress jonnypress left a comment

Choose a reason for hiding this comment

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

I think this looks good generally as first version.

Question (which we can follow up in second pass). Does it handle very long input query strings, i.e. greater than whatever \c is set to? In the TorQ version they get truncated in the log file. I don't know a good solution but I guess there probably is one (there are pros and cons to the truncation).

Copy link
Contributor

@jonnypress jonnypress left a comment

Choose a reason for hiding this comment

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

Approved (sorry meant to hit approve on the last update)

@jmlemay
Copy link
Contributor

jmlemay commented Aug 5, 2025

I think this looks good generally as first version.

Question (which we can follow up in second pass). Does it handle very long input query strings, i.e. greater than whatever \c is set to? In the TorQ version they get truncated in the log file. I don't know a good solution but I guess there probably is one (there are pros and cons to the truncation).

It handles long query strings in that it will execute them, but they will be truncated in the logs to whatever \c is. E.g.

// Remote process.
q)`::5000(::;til 100000)
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42..

// Logged usage.
q)\c 2000 2000
q)@[;`cmd].usage.usage -2+count .usage.usage
"(::;0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
42 43 44 45 46 47 48 49 50.."

I suppose the best solution is probably to make this configurable? Could be done in a second version. At the moment it's configurable simply by setting \c, with the only limitation being the max console size.

@jmlemay jmlemay merged commit fc2d35a into main Aug 5, 2025
@jonathonmcmurray jonathonmcmurray deleted the add_usage_lib branch October 22, 2025 11:18
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.

5 participants