Toggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Configure Labels

the Sundeck Native App Labels allow you to tag historical queries based on conditions you specify, and then filter Query Activity reports based on these Labels. This allows you to better understand your workload, and to drill down into specific types of queries.

A Label consists of:

  • Label Name: A unique name for the Label. This name will appear in filter dropdowns in the Query Activity reports.
  • Label Type: the Sundeck Native App labels can be either “Ungrouped” or “Grouped” labels. Any number of Ungrouped labels can be applied to a single query, but only a single label within a given Group can be applied to one query. You can think of “Grouped” labels as providing “binning” of queries, whereas “Ungrouped” labels act more like tags.
  • Label Condition: This is valid WHERE clause which can be applied to Snowflake’s SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY table. In addition, QTag functions can be used in Label Conditions to provide more advanced matching. See the Labels Examples page for more possibilities.

Creating Labels

Let’s first navigate to the Labels page by clicking on the “Labels” link in the left-hand navigation menu:

Home Page

You’ll see that initially, there are no Labels configured in the system. Let’s create one!

There are two buttons below the labels listing: “New”, which creates a new Ungrouped label, and “New (in group)” which creates a new Grouped label. We’ll start with the simplest case, an Ungrouped label. Click “New”:

Home Page

All we need to provide is the label name, and the label condition. In this example, let’s create a label which matches all queries which Snowflake had to spill to disk during processing. We’ll call the label “Spilled”, and provide the condition BYTES_SPILLED_TO_LOCAL_STORAGE > 0 OR BYTES_SPILLED_TO_REMOTE_STORAGE (where clause on QUERY_HISTORY):

Home Page

Click “Create” to save the label definition. You’ll be taken back to the Labels listing page, and you’ll see your new label listed:

Home Page

Using Labels in Reports

Once you have created one or more the Sundeck Native App Labels, they can be used in the advanced Filter Conditions on the Query Activity reports:

Home Page

The dropdowns are fairly straightforward; each can contain muliple selections. Multiple selections in “Include All” are ANDed together, meaning only queries which match all selected labels will be shown. Multiple selections in “Include Any” are ORed together, such that queries matching any of the selections are shown. Selections in “Exclude Any” will be excluded from the results.

It is possible to select a combination of Label filter conditions which are mutually exclusive, resulting in no queries being displayed on a report. If you end up with a blank report after modifying filter conditions, go back and clear one or more of the Label filters and try again.

Grouped Labels

Grouped Labels are similar to Ungrouped Labels, but with one key difference: Only one Label within a given group can be applied to a single query. This allows you to “bin” queries across the labels in a group, then filter on that group to see a breakout of the data across all labels in the group.

For example, you could create a Grouped Label called “Long Running Queries”, and then create a number of Labels within that group, each with a different runtime threshold. This would allow you to filter on “Long Running Queries” and see all queries which ran longer than a certain threshold, with a breakout by duration “bins”.

To create Grouped labels, click on the “New (in group)” button, and you will notice that there are two additional fields to fill in (“Group Name” and “Rank”):

Home Page

Since Group labels are effectively “binning” all queries into one of the labels within the group, the label conditions need to be tested in a specific order to provide deterministic results. To establish the order, set the Rank value relative to the other labels within the same group. Lower Rank numbers will be evaluated first.