The Apprenda runtime API gives you a toolkit for metering application usage. The block, limiter, toggle, and boundary feature types let developers enhance applications with behavior based on an end-user’s authorization to use functionality within the application. Want to allow some users to create X entities in your app, while others can create Y (because perhaps they’ve paid you more)? Use a limiter feature. Features within Apprenda’s API are a powerful framework for exerting control over user consumption of the application and its functionality.
But what if you simply want to monitor and keep track of users’ usage of your application instead of control it? What I mean here is akin to laying down a traffic counter within your application, to identify performance issues as well as user behavior characteristics. You’ve probably seen one of these before:
They’re used to count how many vehicles pass along a certain point on a road. The information they collect can help determine if the road should be widened, or perhaps identify changes in traffic volume if nearby routes are changed in some way.
One interesting way to use features in the Apprenda API is to create traffic counters within your app. To do so, you’ll use the block feature type. The block feature, upon creation of a user’s subscription, has a starting value, and as your application is used you can programmatically decrement that block until the block is “exhausted” (that is, it’s at zero). At that point, the user can no longer perform an action because they’ve exhausted the block. However, blocks can interestingly also be incremented for the purpose of crediting back a user a portion of their block allotment. You’re probably seeing where I’m going with this now. To create a traffic counter within your application anywhere – UI, web service, etc. – create a block feature. In your entitlement or pricebook, give that block a starting value of 1 (you cannot start at 0). Instead of decrementing the block every time a user performs the action you’re monitoring, increment the block. You’ve now got a rolling counter that tracks the user’s use of your app. The data you collect and the Apprenda API can be used elsewhere to run aggregate reports on the usage of these features over time, allowing you to see trends in usage patterns for a single customer or across customers if you app is multi-tenant.