How to know if Tracker is correctly connected and up and running?


#1

Hi,

I’m fiddling around with the CPP Tracker in a unit test project.

I have not yet installed SnowPlow on my local computer and it seems that no matter what I pass to the init method I will always get a valid Tracker instance… although it’s obviously not connected to anything.

How to really know if a Tracker is connected and up-and-running? That seems like a decent piece of information to know as a developer.

Cheers!


#2

Hello @a.rochette,

I never had an experience particularly with CPP Tracker, but can say of general Snowplow Tracker design.

First of all, I don’t think “connected” is a right word here. Tracker is not required to have a persistent connection to collector. Tracker can idle for long time and not used at all. Or collector can be down and not receive events, or internet connection not available - in that case sent events should be buffered and DevOps/sysadmin notified through appropriate channel (stderr at very least). It is better to think of tracking events as of independent HTTP requests. As long as emitter constructed with valid host - there’s no way to check if this is a real collector or random host without events being sent.

However, you say:

If you can pass #Q#31! without getting exception - then it is a bug as only valid hosts/IP addresses should be accepted. But as far as I can tell, Emitter does some URL validation.

In fact what developer should really be aware of is whether event he or she sent was accepted by collector (e.g. status 200 and expected response content) or collector is unavailable. Also as far as I can tell (sorry, my CPP is very rusty), developer will also be notified about unsucсessful responses.

Some other trackers, such as Scala Tracker provide more sophisticated callbacks to notify DevOps, but in CPP I guess only stderr output is available, however there’s a ticket for that.

Hope that helps.


#4

Awesome!

Ok I understand why a tracker doesn’t technically “connect”.

in that case sent events should be buffered and DevOps/sysadmin notified through appropriate channel

But what component is responsible for checking whether the collector is available or not and cache events accordingly? I couldn’t really see any piece of code doing this in the CPP Tracker.

If you can pass #Q#31! without getting exception - then it is a bug as only valid hosts/IP addresses should be accepted. But as far as I can tell, Emitter does some URL validation.

Not really this is just checking that it’s valid url format not that the host is reachable. So this is very hard to get any feedback here.

It would be very nice that somebody tackles this ticket. We are a company with several 100k of customers and our code base should be ideally using a C++ library that is stable and provides a certain degree of transparency to our users whether the service is even working or not.