c# - How to know if application insights telemetry client is functional? -
this code execute without errors, not log in applicationinsights. foobar
key not valid.
var client = new telemetryclient { context = { instrumentationkey = "foobar" } }; client.trackevent(telemetryevent);
i understand may thing. dont want application crash because appinsights not avalaible. nice know somehow not reachable, can else instead.
possible errors think append :
- the api not reachable
- the event malformed
- the api key invalid
- etc.
some of these may transcient (api temporary not available), others may not (invalid api key).
is there way "test" client react these cases?
something :
if (!client.isappinsightreachable) { //send email can check if ok }
if wanted it, could, might lot of work re-inventing wheel.
you'd have lot of work yourself, implementing or wrapping things itelemetrychannel
want.
much of source various application insights sdks on github:
Comments
Post a Comment