-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Query and Metrics docs #3074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
matt-aitken
wants to merge
5
commits into
main
Choose a base branch
from
query-metrics-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Query and Metrics docs #3074
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c661a9d
1st drafts of Query/Metrics docs
matt-aitken dcd9c90
Metrics docs improved
matt-aitken 27010f4
Update docs/insights/query.mdx
matt-aitken 21caf35
Update docs/insights/query.mdx
matt-aitken eea5c5d
Update docs/insights/query.mdx
matt-aitken File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| --- | ||
| title: "Metrics dashboards" | ||
| description: "Create custom dashboards with real-time metrics powered by TRQL queries." | ||
| --- | ||
|
|
||
| ## Overview | ||
|
|
||
| In the Trigger.dev dashboard we have built-in dashboards and you can create your own. | ||
|
|
||
| Metrics dashboards are powered by [TRQL queries](/insights/query) with widgets that can be displayed as charts, tables, or single values. They automatically refresh to show the latest data. | ||
|
|
||
|  | ||
|
|
||
| ### Visualization types | ||
|
|
||
| - **Line chart** - Show trends over time | ||
| - **Bar chart** - Compare values across categories | ||
| - **Area chart** - Display cumulative trends | ||
| - **Table** - Show detailed data in rows | ||
| - **Single value** - Display a single metric (count, sum, average, etc.) | ||
|
|
||
| You can also add Titles to your dashboard. | ||
|
|
||
| ## Filtering and time ranges | ||
|
|
||
| All widgets on a dashboard use the time range filter applied to the dashboard. | ||
|
|
||
| You can also filter the data by: | ||
|
|
||
| - Scope: Environment, Project, Organization | ||
| - Tasks | ||
| - Queues | ||
|
|
||
| ## Creating custom metrics dashboards | ||
|
|
||
| 1. In the sidebar click the + icon next to "Metrics". | ||
| 2. Name your custom dashboard. | ||
| 3. From the top-right you can "Add chart" or "Add title". | ||
| 4. For charts you write [TRQL queries](/insights/query) and choose a visualization type. | ||
| 5. You can resize and reposition widgets on your dashboards. | ||
|
|
||
| ## Performance considerations | ||
|
|
||
| ### Optimize queries for metrics | ||
|
|
||
| 1. **Use time bucketing** - `timeBucket()` automatically groups by appropriate intervals | ||
| 2. **Limit result size** - Add `LIMIT` clauses, especially for table widgets | ||
| 3. **Use approximate functions** - `uniq()` instead of `uniqExact()` for faster approximate counts | ||
|
|
||
| ## Exporting metric data | ||
|
|
||
| Export data from any metric widget: | ||
|
|
||
| 1. Click the widget menu (three dots) | ||
| 2. Select "Copy JSON" or "Copy CSV" | ||
|
|
||
| ## Best practices | ||
|
|
||
| 1. **Start simple** - Begin with basic metrics and iterate based on insights | ||
| 2. **Use meaningful names** - Give widgets clear, descriptive titles | ||
| 3. **Group related metrics** - Organize dashboards by theme (performance, costs, errors) | ||
| 4. **Test queries first** - Use the Query page to develop and test before adding to dashboards | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Widget shows "No data" | ||
|
|
||
| - Check that your query returns results in the Query page | ||
| - Verify time filters include the period with data | ||
| - Ensure task/queue filters match existing runs | ||
|
|
||
| ### Widget is slow to load | ||
|
|
||
| - Add time range filters to your query | ||
| - Use `LIMIT` clauses | ||
| - Simplify aggregations | ||
| - Check query execution time in Query page | ||
|
|
||
| ### Chart displays incorrectly | ||
|
|
||
| - Verify column names match visualization config | ||
| - Check data types (numbers for charts, dates for time series) | ||
| - Ensure `timeBucket()` is used for time-series charts | ||
| - Review that series columns exist in query results | ||
|
|
||
| ## Limits | ||
|
|
||
| Metrics is powered by Query so have [the same limits](/insights/query#limits) as Query. | ||
|
|
||
| There is a separate concurrency limits for metric widgets. | ||
|
|
||
| | Limit | Details | | ||
| | :------------------------ | :------------- | | ||
| | Concurrent widget queries | 30 per project | | ||
|
|
||
| See [Limits](/limits) for details. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.