Using App Insights Analytics Query Language to Make Better Decisions

So we’ve been working on an App recently to complement our website. One thing I strongly believe in is data driven design or put simple: “Don’t guess gather evidence”.

In our current site we’re using App Insights to capture usage, performance and general telemetry from the platform. This gives us a wealth of knowledge which we can query when making business decisions.

Let’s jump in, I’m going to be using the new Analytics platform and its query language to understand more about our mobile users, specifically iOS, as an example.

First up I’m going to run a query to get the numbers for each client OS we see on the site.

100116_1019_usingappins2

Now, as you can see in the results, iOS is split over various versions. Let’s narrow down the query to look at just iOS..

100116_1019_usingappins3

 

Let’s remove the grouping and see if we can find out what we’d lose by just targeting iOS9 upwards.

First up what are the total numbers for all iOS visitors?

100116_1019_usingappins4

What about just iOS9?

100116_1019_usingappins5

In our case this shows that 89% of our usage is from iOS9 and above. We haven’t taken into account time here so all the older iOS usage could be from way in the past. Let’s take a quick look at that.

100116_1019_usingappins7

So no feasible trend to be seen here, 89% stands.

At the moment we’re just looking at requests, so this number could be massively off if one user came and hit the site a lot on a single phone. We’ll use the dcount operator to do a distinct count by sessionID. This will only count each user session once.

This query showed that this wasn’t the case and the numbers we had are valid, so we can rule out a single user doing a lot of browsing and throwing off our stats.

At this point I realised that we’re using some SPA functionality and server requests doesn’t really map to pageviews so I switched to looking at page views to compare the numbers.

Sure enough this made a difference but the rations between the numbers where similar, 1 request generated x number of page views, where x is fairly constant.

Let’s next look at the split between device types, for this we’ll use the reduce function. It groups together similar variables to make things simple. For example, the jumbled list below:

Becomes..

This is great to help understand patterns in data without having to do lots of where/group by’s. But in this case it’s a bit too extreme, I’d like “other” broken down a bit more.

By playing around with the “threshold” value I can make this happen. After tweaking the “threshold” value I found that 0.2 did the trick for me, I now have a breakdown of iPad vs iPhone

Roughly this showed a 50/50 split in iPhone vs iPad traffic for us over the time period.

Summary

89% of our iOS users are on iOS 9 or above and we have a 50/50 split of traffic between iPad and iPhone users. Now when making product decisions we can use this data to drive what and how we target the platform.

Obviously this is only a high level overview of the numbers we ran but hopefully it serves to illustrate some of the functions in analytics and how they can be used to inform better development decisions.

Backup Azure Table Storage – Quick PowerShell Script

Hi,

So I recently had to make some changes and wanted to ensure I could roll back, in the event of any issues.

Azure Storage is great at replication and availability but it doesn’t offer point in time restore, should you accidentally make some changes and want to roll back. So I wrote a quick little powershell script which uses AzCopy and the Table Storage Rest API to find all the tables in an account and then pull down a JSON file of their contents, tagged with the current time.

It uses a SAS token to limit the permissions the script has, only needing list & read, to minimize the risk if the script has an issue.

TableBackupPic

The only requirement for the script is AzCopy, an MS utility which it uses to pull down the content of each table.

(Here is a quick overview of SASTokens in Azure Storage, the Microsoft Storage Explorer offers a nice right click option to generate them – make sure you give the SASToken Permissions to access the Table Service, Read and List)

Hope it’s useful!

PubSub in Service Fabric with Redis

I’ve been working on a project that uses Fabric and I’m hosting Redis inside the cluster as a simple cache system.

One of things that isn’t baked into Fabric is a pub/sub model for communicating between services  about events that are occuring.

As I’ve got the Redis instance up and running in the cluster I decided to take a look at using the Pub/Sub capabilities in Redis to make this happen. N.B Redis isn’t a guarenteed delivery so use where appropriate, there are lots of discussions around it’s pub/sub model and when/where to use etc.

Turns out it’s nice and easy to get working, I’m a big fan of using RX to make nice reactive programs operating on streams of events and there is already a nice sample combineing Redis and RX in C# here.

In not too long I had just what I wanted and through it might be useful to others so I’ve put together a sample. My sample is here with one “EventPublisher” service pushing out events and an “EventSubscriber” listening to events.

Both services write out what they’re up to as ETW messages so you can view in the diagnostic window.

 

image

Lawrence Gripper

@lawrencegripper

Tagged ,