For clearer insights and consistency, use calculated fields to create new fields by applying functions and logic to existing data.
Calculated fields (also called Derived Columns) let you create new data properties by applying functions, math, or logic to existing fields–similar to spreadsheet formulas.
Use Calculated Fields to:
In Honeycomb, Calculated Fields behave like any other field in your data and can be used in queries, boards, and alerts, depending on the scope.
To learn more about syntax and available functions, visit Calculated Field Formula Reference.
In Honeycomb, you can create calculated fields that are tied to a query session or save calculated fields for use across Honeycomb resources.
By default, calculated fields created through the Query Builder are scoped to your query, which means you can find the field again by name as long as you’re in the same query session. This helps reduce dataset bloat and makes it easier to iterate quickly without needing to manage one-off or exploratory formulas long-term.
Use query-scoped calculated fields when you:
You can also save calculated fields to either a specific dataset or an entire environment:
By default, Honeycomb shows environment calculated fields when building environment-wide queries and dataset calculated fields when building dataset queries.
Saved calculated fields can be used across Honeycomb resources, including in queries, Boards, and alerts.
To understand how you can use calculated fields in practical situations, explore these example scenarios.
For advanced comparisons, calculated fields enable you to transform or categorize data dynamically, which not only simplifies data exploration but also ensures consistency in how comparisons are made across different investigations.
Scenario:
Your team manages a web server that handles requests with varying sizes of content.
Querying in Honeycomb with the GROUP BY clause set to content_length
returns a time series graph that displays the count for each value of content_length
.
You want to compare small requests to all other requests.
Your team internally categorizes a small request as having a content_length
of less than or equal to 1000.
Solution:
Create a calculated field named smallRequest
as a boolean with the function LTE($content_length, 1000)
.
Build a query with the GROUP BY clause set to smallRequest
.
Your query will return a time series graph that displays the small requests alongside the other requests.
Calculated fields let you standardize data across multiple datasets by defining consistent field names and expressions, which ensures queries return comparable results even when services implement fields differently. This enables seamless cross-dataset analysis within an environment.
Scenario:
Your organization has three different services running in production: Payment, Checkout, and Support. You want to get the total amount of purchases in USD from each service, but the services are implemented differently.
Solution:
In Honeycomb, create an environment named Production
.
Inside your environment, send the data from each service to a different dataset: PaymentService
, CheckoutService
, and SupportService
.
Inside each dataset, create a calculated field with the alias total_amount_in_usd
and construct it using an appropriate expression.
For example:
Dataset Name | Calculated Field Name | Calculated Field Expression |
---|---|---|
PaymentService |
total_amount_in_usd |
COALESCE($usd_total, ADD(MUL($tax_rate, $item_total), $fees)) |
CheckoutService |
total_amount_in_usd |
MUL($cart_total, $tax_rate) |
SupportService |
total_amount_in_usd |
SUM(0) |
When you query across the Production
environment, you can use the total_amount_in_usd
field to get the correct calculation for each dataset.
total_amount_in_usd
now exists in a dataset, you cannot create an environment-wide calculated field with the same name.
Name any environment-wide calculated fields something unique to your environment, or change your instrumentation to rename the calculated fields in the datasets.You can create calculated fields in Honeycomb’s UI through:
Log in to the Honeycomb UI.
In the navigation menu, select Query.
From the New Query in dropdown, choose the dataset or environment you want to query.
Select either the VISUALIZE, WHERE, or GROUP BY clause.
From the list of suggested fields, choose Create Calculated Field.
In the modal, enter details:
Field | Description |
---|---|
Save toggle switch | Controls where the query is saved. Save to the query session only [off], or save to the selected dataset or environment [on]. |
Display Name | Name that appears in the Query Builder. Enter a name that is unique across all datasets and the containing environment. Although Honeycomb tries to prevent duplicate field names, they can still occur. For help resolving naming conflicts, visit Common Issues with Queries: Calculated Fields. |
Description | Description of your field. Use a maximum of 255 characters. |
Editor | Formula that defines your field. For syntax, available functions, and example formulas, visit Calculated Field Formula Reference. |
Select Use in New Query.
Your calculated field may take up to one minute to appear.
Saved calculated fields and query-scoped calculated fields in the VISUALIZE clause will appear in dropdowns at the bottom of the field list. Query-scoped calculated fields in the WHERE and GROUP BY clauses will appear in dropdowns under the In this query session section.
To create a dataset-specific calculated field:
Log in to the Honeycomb UI.
In the navigation menu, select the Environment label, then choose the environment that includes the dataset to which you want to add a calculated field.
In the navigation menu, select Manage Data, then choose Datasets.
Locate the dataset to which you want to add a calculated field, and select its name to open its settings.
Go to the Schema view.
Expand the Calculated Fields section.
Select Add New Calculated Field.
In the modal, enter details:
Field | Description |
---|---|
Display Name | Name that appears in the Query Builder. Enter a name that is unique across the dataset and its containing environment. Although Honeycomb tries to prevent duplicate field names, they can still occur. For help resolving naming conflicts, visit Common Issues with Queries: Calculated Fields. |
Editor | Formula that defines your field. For syntax, available functions, and example formulas, visit Calculated Field Formula Reference. |
Select Save.
The screen refreshes, and your new field appears in the list.
To create an environment-wide calculated field:
Log in to the Honeycomb UI.
In the navigation menu, select the Environment label, then choose Manage Environments.
Locate the environment to which you want to add a calculated field, and select its name to open its settings.
Go to the Schema view.
Select Add New Calculated Field.
In the modal, enter details:
Field | Description |
---|---|
Display Name | Name that appears in the Query Builder. Enter a name that is unique across all datasets and the containing environment. Although Honeycomb tries to prevent duplicate field names, they can still occur. For help resolving naming conflicts, visit Common Issues with Queries: Calculated Fields. |
Editor | Formula that defines your field. For syntax, available functions, and example formulas, visit Calculated Field Formula Reference. |
Select Save.
The screen refreshes, and your new field appears in the list.
Once created, edit query-scoped calculated fields in a clause by selecting their Edit icon (
).Saved calculated fields are part of the schema for a dataset or environment and must be managed within the settings for those areas. To modify a saved calculated field, access the configuration associated with its scope:
For guidance when troubleshooting calculated fields in Honeycomb, visit Common Issues with Queries.