3 ms·
> add instrumentation. Do this in a completely new database table, add a simple counter for every event that you can think of and add a single function to incre
by SideburnsOfDoom 9y ago
> add instrumentation. Do this in a completely new database table, add a simple counter for every event that you can think of and add a single function to increment these counters based on the name of the event.
The idea is a good one but the specific suggested implementation .. hasn't he heard of statsd or kibana?
- jacquesm 9y agoNot available on all platforms. Think: mainframes, platforms no longer with the times, non-unix and so on. If you have access to a tool like that by all means use it, the specific implementation is not relevant, the article merely tries to show a simplest way to implement this very useful functionality that will work without limitation on just about anything that I can think of.
- kod 9y agoSerious question - what platforms are you working on that you can't send a udp packet that looks like "somecounter:1|c"
- jacquesm 9y agoHehe. If you can't imagine that then you have a sheltered and probably very happy life. I don't care if it speaks ethernet, arcnet, twinax, X.25 or nothing at all, we'll find a way. By the time you can start sending UDP packets you are already on very solid footing. Be happy if your dev environment does not include an emulated version of the real hardware that mysteriously does not seem to be 100% representative of the real thing.
- kod 9y agoTelling someone they lead a sheltered life isn't the same as actually answering the question. What actual systems have you worked on that were connected to a database, but couldn't send UDP?
- jacquesm 9y agoAnything embedded running sqlite for instance. Anything on mainframes or older systems that do not have ethernet. Anything running Netware or equivalent (true, there you could probably hack some kind of interface but whether it would be reliable or not is another matter).
- SideburnsOfDoom 9y ago> Not available on all platforms. Think: mainframes, platforms no longer with the times, non-unix and so on. YMMV, though I would steer people towards an off-the-shelf solution over rolling your own. Does "non-unix" mean Windows? My experience there has been that you can find a statsd client for your language of choice, and a way to plug whatever logging tool you have into kibana.
- jacquesm 9y agoQuite often there is an embedded component in the mix somewhere, or even a machine that is not networked in any present day sense of the word. The whole reason these jobs exist is because modern tooling and the luxury that comes with them is unavailable. But I've yet to find a platform where that counter trick did not work, even on embedded platforms you can usually get away with a couple of incs and a way to read out the counters. If the timing isn't too close to failure. One interesting case involved a complex real life multi-player game with wearable computers. In the end we got it to work but only by making all the software run twice as fast as it did before so we could use the odd cycles for the stats collection without the rest of the system noticing. That was a big of a hack. And the best bit: after making it work we then used all the freed up time to send extra packets to give the system some redundancy and this greatly improved reliability. That system was running 8051 micro controllers and the guy that wrote the original said that 'this couldn't be done'. Fun times :) The server side portion of that particular project got completely re-written as well roughly along the lines presented in the article, that wasn't a huge project (500K lines or so) but I was very happy that it wasn't my first large technical debt mitigation project or I would have likely stranded.