Skip to content

Commit 29ec571

Browse files
feat(database): Query sources (#8670)
* Add content for Query Sources * Convert queries page to mdx Co-authored-by: vivianyentran <[email protected]>
1 parent 9a40a54 commit 29ec571

File tree

3 files changed

+66
-14
lines changed

3 files changed

+66
-14
lines changed

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
"typescript.tsdk": "node_modules/typescript/lib",
99
"editor.codeActionsOnSave": {
10-
"source.fixAll.eslint": true
10+
"source.fixAll.eslint": "explicit"
1111
},
1212
"git.ignoreLimitWarning": true,
1313
"search.exclude": {
14-
"**/src/wizard/**": true,
14+
"**/src/wizard/**": true
1515
}
1616
}

src/docs/product/performance/queries.md renamed to src/docs/product/performance/queries.mdx

Lines changed: 64 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,18 @@ Starting with the [**Queries** page](#queries-page), you get a high-level overvi
1515

1616
The gif below demonstrates how to use performance monitoring for queries.
1717

18-
<div style="position: relative; padding-bottom: calc(48.68055555555556% + 41px); height: 0; width: 100%"><iframe src="https://demo.arcade.software/miaHF3SwPiABh9bZnMoq?embed" frameborder="0" loading="lazy" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;color-scheme: light;" title="Performance - Queries - Walkthrough"></iframe></div>
19-
20-
</br>
18+
<div style="position: relative; padding-bottom: calc(48.68055555555556% + 41px); height: 0; width: 100%">
19+
<iframe
20+
src="https://demo.arcade.software/miaHF3SwPiABh9bZnMoq?embed"
21+
frameborder="0"
22+
loading="lazy"
23+
webkitallowfullscreen
24+
mozallowfullscreen
25+
allowfullscreen
26+
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;color-scheme: light;"
27+
title="Performance - Queries - Walkthrough"
28+
></iframe>
29+
</div>
2130

2231
## Prerequisites and Limitations
2332

@@ -65,9 +74,20 @@ To view more details, click on a query from the table to open its **Query Summar
6574

6675
The gif below provides a detailed walkthrough of the **Queries** page.
6776

68-
<div style="position: relative; padding-bottom: calc(48.68055555555556% + 41px); height: 0; width: 100%"><iframe src="https://demo.arcade.software/v66mxydrZRsNxRgNMYUl?embed" frameborder="0" loading="lazy" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;color-scheme: light;" title="Performance - Queries - Queries Page Walkthrough"></iframe></div>
69-
70-
</br>
77+
<div style="position: relative; padding-bottom: calc(48.68055555555556% + 41px); height: 0; width: 100%">
78+
<iframe
79+
src="https://demo.arcade.software/v66mxydrZRsNxRgNMYUl?embed"
80+
frameborder="0"
81+
loading="lazy"
82+
webkitallowfullscreen
83+
mozallowfullscreen
84+
allowfullscreen
85+
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;color-scheme: light;"
86+
title="Performance - Queries - Queries Page Walkthrough"
87+
></iframe>
88+
</div>
89+
90+
<br />
7191

7292
### Query Parameterization
7393

@@ -84,17 +104,40 @@ You can see the full query by hovering on a truncated description, or clicking i
84104

85105
To open a query's **Query Summary** page, click on the query from either the table in the "Most Time-Consuming Queries" widget on the **Performance** page or the table in the **Queries** page.
86106

87-
At the top of the page, queries per minute, average duration, and time spent are shown for the selected time range. The full query is shown below these metrics, followed by graphs for queries per minute and average duration.
107+
At the top of the page, queries per minute, average duration, and time spent are shown for the selected time range. The full query is shown below these metrics, followed by graphs for queries per minute and average duration. The query's source in the code is also shown if it is available.
88108

89109
At the bottom, you can find a list of endpoints the query is found in, sorted by the most time your application spent in that span.
90110

91111
If you want to investigate a specific endpoint, click on it to open a sidebar showing some sample events.
92112

93113
The gif below provides a detailed walkthrough of the **Query Summary** page.
94114

95-
<div style="position: relative; padding-bottom: calc(48.68055555555556% + 41px); height: 0; width: 100%"><iframe src="https://demo.arcade.software/MTzviZtIiN7ZCmNFVJg4?embed" frameborder="0" loading="lazy" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;color-scheme: light;" title="Performance - Queries - Query Summary Page Walkthrough"></iframe></div>
115+
<div style="position: relative; padding-bottom: calc(48.68055555555556% + 41px); height: 0; width: 100%">
116+
<iframe
117+
src="https://demo.arcade.software/MTzviZtIiN7ZCmNFVJg4?embed"
118+
frameborder="0"
119+
loading="lazy"
120+
webkitallowfullscreen
121+
mozallowfullscreen
122+
allowfullscreen
123+
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;color-scheme: light;"
124+
title="Performance - Queries - Query Summary Page Walkthrough"
125+
></iframe>
126+
</div>
127+
128+
## Query Sources
129+
130+
<Note>
131+
132+
Query Sources are currently supported in Sentry's [Laravel](/platforms/php/guides/laravel/configuration/laravel-options/) (enabled with the `SENTRY_TRACE_SQL_ORIGIN_ENABLED` option) and [Python](/platforms/python/configuration/options/#enable-db-query-source) (enabled with the `enable-db-query-source` option) SDKs. For Python, Sentry only attaches query sources to queries that are slower than a [configurable threshold](/platforms/python/configuration/options/#db-query-source-threshold-ms) to reduce the performance impact.
96133

97-
</br>
134+
</Note>
135+
136+
A query's source is the location in your application's code that triggered the query. Sentry automatically determines the query source by examining the stack trace and attaches the source to the query data.
137+
138+
You can see the query's source underneath the query description on the **Query Summary** page, as shown in the image below. You can also find the query's source on the [**Event Details** page](/product/sentry-basics/concepts/tracing/event-detail/) next to other span properties in the span waterfall. If you have a [source code management integration](/product/integrations/source-code-mgmt/) enabled, Sentry will also show a link to open the query's source in the relevant repository.
139+
140+
![Example of Query Source](./query-source-laravel.png)
98141

99142
## Sample List
100143

@@ -112,9 +155,18 @@ From the sample list, you can drill down to specific good, average, or bad examp
112155

113156
The gif below explains how to navigate the sample list.
114157

115-
<div style="position: relative; padding-bottom: calc(48.68055555555556% + 41px); height: 0; width: 100%"><iframe src="https://demo.arcade.software/dr7yesA9RCqfpSyICbmP?embed" frameborder="0" loading="lazy" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;color-scheme: light;" title="Performance - Queries - Sample List Walkthrough"></iframe></div>
116-
117-
</br>
158+
<div style="position: relative; padding-bottom: calc(48.68055555555556% + 41px); height: 0; width: 100%">
159+
<iframe
160+
src="https://demo.arcade.software/dr7yesA9RCqfpSyICbmP?embed"
161+
frameborder="0"
162+
loading="lazy"
163+
webkitallowfullscreen
164+
mozallowfullscreen
165+
allowfullscreen
166+
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;color-scheme: light;"
167+
title="Performance - Queries - Sample List Walkthrough"
168+
></iframe>
169+
</div>
118170

119171
## What is Time Spent
120172

Loading

0 commit comments

Comments
 (0)