DEV Community

Cover image for Apps run until you stop them
John Bannister
John Bannister

Posted on Originally published at streamgen.io AI-assisted

Apps run until you stop them

I work at Websson, the company that develops StreamGen, so read this with that in mind.

A few weeks ago someone asked on r/snowflake whether anyone had real enterprise experience with Snowflake's App Runtime. The product manager for App Runtime answered in the thread, and two of his lines stuck with me. "Apps run until you stop them." And: "You see usage per account, not per app."

Neither is a complaint. It is how the platform works, and he said it straight. But put the two next to each other and you get the problem StreamGen was built around. Somebody builds a Streamlit app in Snowsight for a quarterly review. It works, people use it for a month, and then nobody opens it again. It still exists, and nobody is sure it can go. And when finance asks what the apps cost, the honest answer is a number for the whole account.

Multiply that by a team where analysts are now building apps by describing them to an AI, and the list grows faster than anyone can keep track of.

What the account already tells you

Most of the answer is already in your account. Snowflake tags every query a Streamlit app runs with the app's name, in the query tag, and runs it as the person looking at the app. So QUERY_HISTORY can tell you who opened which app, and QUERY_ATTRIBUTION_HISTORY can add up the credits of each app's queries. I wrote those queries up as a separate guide, and they are on GitHub too, because you don't need us to run them.

What the views don't give you is the habit. Someone has to run the queries, look at the result, and decide that the app nobody opened since July can go. And the per-query credits leave out a warehouse sitting idle because an app kept it awake, which no single query carries.

What we built

StreamGen started as a tool that writes Streamlit apps on your own data from a sentence. The more apps it built, the more the question turned into the one above: fine, but which of these are still used, and what do they cost?

So Admin → Inventory is now the heart of it. Every Streamlit and App Runtime app the role can see, built in StreamGen or not: owner, last deploy, last use, who viewed it in the last 30 days, and the warehouse credits it used. Apps nobody has opened for 60 days get flagged, with what it would take to retire them. StreamGen never drops one itself; that stays your call.

Then the cost side. Each app shows what it costs, in money once you enter your price per credit, and StreamGen's own compute and the pool its apps share get their own lines, so nothing hides in the total. Apps can be switched off at a set time, say 20:00 on workdays, or after a few hours without viewers, and they start again when someone opens them. That is our answer to "apps run until you stop them": something stops them. There is also a monthly budget that emails the admins at 80% and 100%. It only alerts. I didn't want a budget that switches off an app in the middle of someone's board meeting.

Every night it also runs each app's queries against your data, so a dropped column or a lost grant shows up in the inventory before a user finds it, and checks the packages the apps use against known vulnerabilities.

It runs as a Snowflake Native App, inside the customer's account. It acts as the signed-in user and never with more rights than that user has. The data doesn't leave the account. It connects out only to hosts the admin approves: our licence server, and optionally GitHub and a vulnerability database.

Getting through the Marketplace review

StreamGen went live on the Snowflake Marketplace on 23 October. The review was fair and mostly quiet. The one thing they sent back was our SQL examples. We had written four "Quick Start" queries, and three of them were GRANT statements and install steps. Their point was that examples should show using the app, not setting it up. They were right. The grants were already in the app's README, so we replaced the examples with four calls a consumer actually runs: open StreamGen, check that it is running, read its recent log lines, and switch it and its apps off. Resubmitted, approved.

If you are preparing a listing: no database name in the example identifiers (the consumer names the app at install), one statement per example, and each one has to return at least one row, because they are validated automatically.

If you want to try it

Here is the listing on the Snowflake Marketplace. You need a paid Snowflake account in a region that runs apps with containers. Installing is free and it is activated with a licence key; there is a free 7-day trial key, counted from the day you activate it.

And if you don't want another app in your account, the queries in the guide get you most of the way. I'd like to hear how other teams keep track of their apps today, especially anyone doing it per app rather than per warehouse.

Top comments (0)