@sentry/mcp-server 0.32.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/dist/auth/constants.cjs +1 -1
  2. package/dist/auth/constants.js +1 -1
  3. package/dist/auth/device-code-flow.cjs +4 -4
  4. package/dist/auth/device-code-flow.d.ts +1 -1
  5. package/dist/auth/device-code-flow.js +4 -4
  6. package/dist/auth/resolve-token.cjs +6 -6
  7. package/dist/auth/resolve-token.d.cts +1 -1
  8. package/dist/auth/resolve-token.d.ts +1 -1
  9. package/dist/auth/resolve-token.js +6 -6
  10. package/dist/auth/token-cache.cjs +1 -1
  11. package/dist/auth/token-cache.d.ts +1 -1
  12. package/dist/auth/token-cache.js +1 -1
  13. package/dist/auth/types.cjs +1 -1
  14. package/dist/auth/types.d.ts +1 -1
  15. package/dist/auth/types.js +1 -1
  16. package/dist/{auth-XNi9K4Nz.js → auth-A9SbZrVW.js} +7 -7
  17. package/dist/{auth-XNi9K4Nz.js.map → auth-A9SbZrVW.js.map} +1 -1
  18. package/dist/{auth-DamN9R04.cjs → auth-BFtSFR07.cjs} +7 -7
  19. package/dist/{auth-DamN9R04.cjs.map → auth-BFtSFR07.cjs.map} +1 -1
  20. package/dist/blob-utils-B9a20TSV.js +3 -0
  21. package/dist/blob-utils-CGHZbDNh-CN3juEJQ.cjs +66 -0
  22. package/dist/blob-utils-CGHZbDNh-CN3juEJQ.cjs.map +1 -0
  23. package/dist/blob-utils-CGHZbDNh-Dhzb2_wT.js +54 -0
  24. package/dist/blob-utils-CGHZbDNh-Dhzb2_wT.js.map +1 -0
  25. package/dist/blob-utils-dQmZRlIb.cjs +3 -0
  26. package/dist/cli/commands/auth.cjs +8 -8
  27. package/dist/cli/commands/auth.js +8 -8
  28. package/dist/cli/parse.cjs +1 -1
  29. package/dist/cli/parse.d.cts +1 -1
  30. package/dist/cli/parse.d.cts.map +1 -1
  31. package/dist/cli/parse.d.ts +1 -1
  32. package/dist/cli/parse.d.ts.map +1 -1
  33. package/dist/cli/parse.js +1 -1
  34. package/dist/cli/resolve.cjs +2 -2
  35. package/dist/cli/resolve.d.cts +1 -1
  36. package/dist/cli/resolve.d.cts.map +1 -1
  37. package/dist/cli/resolve.d.ts +1 -1
  38. package/dist/cli/resolve.d.ts.map +1 -1
  39. package/dist/cli/resolve.js +2 -2
  40. package/dist/cli/types.d.cts +1 -1
  41. package/dist/cli/types.d.ts +1 -1
  42. package/dist/cli/usage.cjs +1 -1
  43. package/dist/cli/usage.js +1 -1
  44. package/dist/config-Bnslg67w.js +3 -0
  45. package/dist/config-IA5hZFjI.cjs +7 -0
  46. package/dist/{config-D1QOSX9W-BurxE_FB.cjs → config-YHBj037H-DI-vM9pT.cjs} +302 -22
  47. package/dist/config-YHBj037H-DI-vM9pT.cjs.map +1 -0
  48. package/dist/{config-D1QOSX9W-CtF1qegU.js → config-YHBj037H-DRbUBG2X.js} +297 -23
  49. package/dist/config-YHBj037H-DRbUBG2X.js.map +1 -0
  50. package/dist/constants-CR1eH5g2.js +367 -0
  51. package/dist/constants-CR1eH5g2.js.map +1 -0
  52. package/dist/constants-DxEbVScP.cjs +517 -0
  53. package/dist/constants-DxEbVScP.cjs.map +1 -0
  54. package/dist/{device-code-flow-BCdcs8S7.js → device-code-flow-C5A4Ubww.js} +4 -4
  55. package/dist/{device-code-flow-BCdcs8S7.js.map → device-code-flow-C5A4Ubww.js.map} +1 -1
  56. package/dist/{device-code-flow-B-sYi7io.cjs → device-code-flow-DmHR9gAX.cjs} +4 -4
  57. package/dist/{device-code-flow-B-sYi7io.cjs.map → device-code-flow-DmHR9gAX.cjs.map} +1 -1
  58. package/dist/index.cjs +22245 -19968
  59. package/dist/index.cjs.map +1 -1
  60. package/dist/index.js +22242 -19965
  61. package/dist/index.js.map +1 -1
  62. package/dist/{parse-BC0czE2L.js → parse-BSFxOAQG.js} +4 -1
  63. package/dist/parse-BSFxOAQG.js.map +1 -0
  64. package/dist/{parse-CBlXTQfk.cjs → parse-BTaa9TK5.cjs} +4 -1
  65. package/dist/parse-BTaa9TK5.cjs.map +1 -0
  66. package/dist/{resolve-DQS7cx8P.cjs → resolve-BOBiWoGW.cjs} +14 -3
  67. package/dist/resolve-BOBiWoGW.cjs.map +1 -0
  68. package/dist/{resolve-D19wc4BJ.js → resolve-rfTy87TT.js} +14 -3
  69. package/dist/resolve-rfTy87TT.js.map +1 -0
  70. package/dist/{resolve-token-BeHiwgSY.js → resolve-token-BBveHRyr.js} +5 -5
  71. package/dist/{resolve-token-BeHiwgSY.js.map → resolve-token-BBveHRyr.js.map} +1 -1
  72. package/dist/{resolve-token-DKH-nkWs.cjs → resolve-token-D3Ti8TJ_.cjs} +5 -5
  73. package/dist/{resolve-token-DKH-nkWs.cjs.map → resolve-token-D3Ti8TJ_.cjs.map} +1 -1
  74. package/dist/{stdio-CSjj4HGd.cjs → stdio-CNiKUCkA.cjs} +3 -3
  75. package/dist/{stdio-CSjj4HGd.cjs.map → stdio-CNiKUCkA.cjs.map} +1 -1
  76. package/dist/{stdio-B6V73MMI.js → stdio-MUSHk0bq.js} +3 -3
  77. package/dist/{stdio-B6V73MMI.js.map → stdio-MUSHk0bq.js.map} +1 -1
  78. package/dist/{token-Dx4qrxlx.cjs → token-URCv7LSS.cjs} +2 -2
  79. package/dist/{token-Dx4qrxlx.cjs.map → token-URCv7LSS.cjs.map} +1 -1
  80. package/dist/{token-D7eiINbV.js → token-YhriRz-K.js} +2 -2
  81. package/dist/{token-D7eiINbV.js.map → token-YhriRz-K.js.map} +1 -1
  82. package/dist/{token-cache-iqkTOca3.cjs → token-cache-914WGYb3.cjs} +1 -1
  83. package/dist/{token-cache-iqkTOca3.cjs.map → token-cache-914WGYb3.cjs.map} +1 -1
  84. package/dist/{token-cache-BTEUyVx2.js → token-cache-DHBN2ixb.js} +1 -1
  85. package/dist/{token-cache-BTEUyVx2.js.map → token-cache-DHBN2ixb.js.map} +1 -1
  86. package/dist/{token-util-DtX1UM9f.js → token-util-7XgZqk3d.js} +1 -1
  87. package/dist/{token-util-bEa_1v46.cjs → token-util-B-ZIWywO.cjs} +1 -1
  88. package/dist/{token-util-VkLmCUNV.js → token-util-Dnkz6ExF.js} +1 -1
  89. package/dist/{token-util-VkLmCUNV.js.map → token-util-Dnkz6ExF.js.map} +1 -1
  90. package/dist/{token-util-oe0G9a-s.cjs → token-util-I45r8kkb.cjs} +1 -1
  91. package/dist/{token-util-oe0G9a-s.cjs.map → token-util-I45r8kkb.cjs.map} +1 -1
  92. package/dist/transports/stdio.cjs +2 -2
  93. package/dist/transports/stdio.d.cts +1 -1
  94. package/dist/transports/stdio.js +2 -2
  95. package/dist/{types-uISvMJKw.d.ts → types-BHd78Leq.d.cts} +5 -1
  96. package/dist/types-BHd78Leq.d.cts.map +1 -0
  97. package/dist/{types-T07_vWhw.d.cts → types-BdLzKRyK.d.ts} +5 -1
  98. package/dist/types-BdLzKRyK.d.ts.map +1 -0
  99. package/dist/{types-DDkgkRP9.d.ts → types-C0xriI9T.d.ts} +1 -1
  100. package/dist/{types-DDkgkRP9.d.ts.map → types-C0xriI9T.d.ts.map} +1 -1
  101. package/dist/{types-DViCeKUc.cjs → types-CxTPg1vE.cjs} +1 -1
  102. package/dist/{types-DViCeKUc.cjs.map → types-CxTPg1vE.cjs.map} +1 -1
  103. package/dist/{types-C336ZSwF.js → types-nsyASfJr.js} +1 -1
  104. package/dist/{types-C336ZSwF.js.map → types-nsyASfJr.js.map} +1 -1
  105. package/dist/{usage-QnwsoeF4.js → usage-CyXue87B.js} +4 -2
  106. package/dist/usage-CyXue87B.js.map +1 -0
  107. package/dist/{usage-DqxR1zdC.cjs → usage-WAgAGh1G.cjs} +4 -2
  108. package/dist/usage-WAgAGh1G.cjs.map +1 -0
  109. package/dist/{version-g6exOvkr.cjs → version-B6ykl6YN.cjs} +3 -3
  110. package/dist/version-B6ykl6YN.cjs.map +1 -0
  111. package/dist/version-DsnkzOWJ.js +7 -0
  112. package/dist/version-DsnkzOWJ.js.map +1 -0
  113. package/package.json +4 -4
  114. package/dist/config-D1QOSX9W-BurxE_FB.cjs.map +0 -1
  115. package/dist/config-D1QOSX9W-CtF1qegU.js.map +0 -1
  116. package/dist/config-DvaRyDc4.cjs +0 -7
  117. package/dist/config-UqbHNH-n.js +0 -3
  118. package/dist/constants-CnQOQOfw.js +0 -165
  119. package/dist/constants-CnQOQOfw.js.map +0 -1
  120. package/dist/constants-zXY4MUBL.cjs +0 -249
  121. package/dist/constants-zXY4MUBL.cjs.map +0 -1
  122. package/dist/parse-BC0czE2L.js.map +0 -1
  123. package/dist/parse-CBlXTQfk.cjs.map +0 -1
  124. package/dist/resolve-D19wc4BJ.js.map +0 -1
  125. package/dist/resolve-DQS7cx8P.cjs.map +0 -1
  126. package/dist/types-T07_vWhw.d.cts.map +0 -1
  127. package/dist/types-uISvMJKw.d.ts.map +0 -1
  128. package/dist/usage-DqxR1zdC.cjs.map +0 -1
  129. package/dist/usage-QnwsoeF4.js.map +0 -1
  130. package/dist/version-BBolBvwF.js +0 -7
  131. package/dist/version-BBolBvwF.js.map +0 -1
  132. package/dist/version-g6exOvkr.cjs.map +0 -1
@@ -1,7 +1,7 @@
1
- //#region ../mcp-core/dist/config-D1QOSX9W.js
1
+ //#region ../mcp-core/dist/config-YHBj037H.js
2
2
  const systemPrompt = `You are a Sentry query translator. You need to:
3
- 1. FIRST determine which dataset (spans, errors, or logs) is most appropriate for the query
4
- 2. Query the available attributes for that dataset using the datasetAttributes tool
3
+ 1. FIRST determine which dataset (spans, errors, logs, metrics, profiles, or replays) is most appropriate for the query
4
+ 2. Query the available attributes for that dataset using the datasetAttributes tool for spans/errors/logs/metrics/profiles, or the replayFields tool for replays
5
5
  3. Use the otelSemantics tool if you need OpenTelemetry semantic conventions
6
6
  4. Convert the natural language query to Sentry's search syntax (NOT SQL syntax)
7
7
  5. Decide which fields to return in the results
@@ -9,11 +9,18 @@ const systemPrompt = `You are a Sentry query translator. You need to:
9
9
  CRITICAL: Sentry does NOT use SQL syntax. Do NOT generate SQL-like queries.
10
10
 
11
11
  DATASET SELECTION GUIDELINES:
12
- - spans: Performance data, traces, AI/LLM calls, database queries, HTTP requests, token usage, costs, duration metrics, user agent data, "XYZ calls", ambiguous operations (richest attribute set)
13
- - errors: Exceptions, crashes, error messages, stack traces, unhandled errors, browser/client errors
14
- - logs: Log entries, log messages, severity levels, debugging information
12
+ - spans: Raw trace/span events for performance, AI/LLM calls, database queries, HTTP requests, token usage, costs, user agent data, "XYZ calls", ambiguous operations (richest attribute set)
13
+ - errors: Exceptions, crashes, stack traces, unhandled errors, browser/client errors; these usually become Sentry issues
14
+ - logs: Application log entries, log messages, severity levels, debugging information; error-severity logs are still logs
15
+ - metrics: Metric rows and aggregates, especially named metrics, counters, gauges, distributions, metric values, and queries that explicitly mention metric names/types
16
+ - profiles: Transaction and continuous profile results, profile IDs, profile durations, releases, platforms, and profile-related transactions
17
+ - replays: Session replay results, clicked elements, rage/dead clicks, visited pages, replay users, browsers, and releases
15
18
 
16
19
  For ambiguous queries like "calls using XYZ", prefer spans dataset first as it contains the most comprehensive telemetry data.
20
+ For queries that explicitly ask about a metric name, metric type, counter/gauge/distribution, or newer span metrics, prefer metrics.
21
+ For queries about captured profiles, profile IDs, flamegraphs, or profiled transactions, prefer profiles.
22
+ For queries about session replays, clicked UI elements, rage clicks, dead clicks, visited URLs/screens, or replay users/sessions, prefer replays.
23
+ If the user says logs, log messages, error logs, or warning logs, choose logs instead of errors.
17
24
 
18
25
  CRITICAL - FIELD VERIFICATION REQUIREMENT:
19
26
  Before constructing ANY query, you MUST verify field availability:
@@ -21,13 +28,18 @@ Before constructing ANY query, you MUST verify field availability:
21
28
  2. This includes ALL fields: custom attributes, database fields, HTTP fields, AI fields, user fields, etc.
22
29
  3. Fields vary by project based on what data is being sent to Sentry
23
30
  4. Using an unverified field WILL cause your query to fail with "field not found" errors
24
- 5. The datasetAttributes tool tells you EXACTLY which fields are available
31
+ 5. For spans, logs, and metrics, datasetAttributes can validate exact field names with attributes and can list likely fields using substringMatch/query/attributeTypes
32
+ 6. A broad datasetAttributes listing is a discovery preview and may be truncated; do not treat absence from the preview as proof that a user-supplied field is invalid
33
+ 7. Replay fields vary by project too, so use replayFields before constructing replay queries
25
34
 
26
35
  TOOL USAGE GUIDELINES:
27
36
  1. Use datasetAttributes tool to discover available fields for your chosen dataset
28
- 2. Use otelSemantics tool when you need specific OpenTelemetry semantic convention attributes
29
- 3. Use whoami tool when queries contain "me" references for user.id or user.email fields
30
- 4. IMPORTANT: For ambiguous terms like "user agents", "browser", "client" - use the datasetAttributes tool to find the correct field name (typically user_agent.original) instead of assuming it's related to user.id
37
+ 2. Use replayFields tool to discover available replay fields and custom replay tags
38
+ 3. Use otelSemantics tool when you need specific OpenTelemetry semantic convention attributes
39
+ 4. Use whoami tool when queries contain "me" references for user.id or user.email fields
40
+ 5. IMPORTANT: For ambiguous terms like "user agents", "browser", "client" - use the appropriate field discovery tool instead of guessing field names
41
+ 6. When the user already supplied Sentry search syntax for spans/logs/metrics, call datasetAttributes with exact attributes from the query or fields before dropping or renaming them
42
+ 7. Use datasetAttributes substringMatch, query, and attributeTypes for targeted lookup when broad field discovery is truncated
31
43
 
32
44
  CRITICAL - TOOL RESPONSE HANDLING:
33
45
  All tools return responses in this format: {error?: string, result?: data}
@@ -75,6 +87,16 @@ QUERY MODES:
75
87
  - For equations in aggregate queries: You SHOULD use "-equation|..." prefix unless user wants lowest values
76
88
  - When user asks "how many total", "sum of", or similar: They want the highest/total value, use descending sort
77
89
 
90
+ 3. REPLAY SEARCH RESULTS:
91
+ - Replays return a LIST of replay sessions, not aggregations
92
+ - For replays, set dataset to "replays"
93
+ - For replays, return fields: []
94
+ - For replays, use replay query syntax like count_errors:>0, url:*checkout*, click.textContent:"Save"
95
+ - For replays, put environment in the separate "environment" field, NOT inside query
96
+ - For replay environment filters, use a string for one environment or an array of strings for multiple environments
97
+ - For replays, use sorts like -started_at, -count_errors, -count_rage_clicks, -count_dead_clicks, -duration
98
+ - Replays do NOT support count()/avg()/sum() aggregations through this path
99
+
78
100
  CRITICAL LIMITATION - TIME SERIES NOT SUPPORTED:
79
101
  - Queries asking for data "over time", "by hour", "by day", "time series", or similar temporal groupings are NOT currently supported
80
102
  - If user asks for "X over time", return an error explaining: "Time series aggregations are not currently supported."
@@ -86,6 +108,15 @@ CRITICAL - DO NOT USE SQL SYNTAX:
86
108
  - For field existence: Use has:field_name, NOT field_name IS NOT NULL
87
109
  - For field absence: Use !has:field_name, NOT field_name IS NULL
88
110
 
111
+ REPLAY SEARCH RULES:
112
+ - Use replayFields when dataset is replays
113
+ - For replay environment filtering, set the separate "environment" field to a string or array of strings
114
+ - Replay time filtering must use "timeRange", not query fields
115
+ - Replay queries should not include event-search-only syntax like has:field_name
116
+ - Replay sort must still go in the separate "sort" field
117
+ - If the user asks about replays they have viewed, prefer viewed_by_me:true
118
+ - If the user asks about replay users and says "me", use whoami and translate to user.email:<actual email>
119
+
89
120
  MATHEMATICAL QUERY PATTERNS:
90
121
  When user asks mathematical questions like "how many X", "total Y used", "sum of Z":
91
122
  - Identify the appropriate dataset based on context
@@ -102,9 +133,18 @@ When user asks for calculated metrics, ratios, or conversions:
102
133
  - "combined metric total" → fields: ["equation|sum(metric.a) + sum(metric.b)"], sort: "-equation|sum(metric.a) + sum(metric.b)"
103
134
  - "error rate percentage" → fields: ["equation|failure_rate() * 100"], sort: "-equation|failure_rate() * 100"
104
135
  - "events per second" → fields: ["equation|count() / 3600"], sort: "-equation|count() / 3600"
105
- - IMPORTANT: Equations are ONLY supported in the spans dataset, NOT in errors or logs
136
+ - IMPORTANT: Equations are ONLY supported in the spans dataset, NOT in errors, logs, or metrics
106
137
  - IMPORTANT: When sorting by equations, use "-equation|..." for descending order (highest values first)
107
138
 
139
+ TRACE METRICS AGGREGATES (TRACEMETRICS DATASET):
140
+ When querying metrics aggregates, prefer aggregate functions that fully encode the target metric:
141
+ - Format: fn(value,metric.name,metric.type,metric.unit)
142
+ - Counter examples: "sum(value,my.counter,counter,-)", "per_second(value,my.counter,counter,-)"
143
+ - Gauge examples: "avg(value,cpu.usage,gauge,percent)", "max(value,cpu.usage,gauge,percent)"
144
+ - Distribution examples: "p95(value,http.request.duration,distribution,millisecond)", "avg(value,http.request.duration,distribution,millisecond)"
145
+ - IMPORTANT: Use the exact metric.name, metric.type, and metric.unit values when they are available
146
+ - IMPORTANT: Tracemetrics do NOT support equation| fields
147
+
108
148
  PERFORMANCE INVESTIGATION STRATEGY:
109
149
  When users ask about "performance problems", "slow pages", "slow endpoints", "latency issues",
110
150
  "web vitals", "LCP", "CLS", "INP", "page speed", "load time", "response time", or similar:
@@ -127,8 +167,8 @@ Performance Query Patterns (use duck typing):
127
167
  - Database: has:db.statement or has:db.system
128
168
  - HTTP/API calls: has:http.method or has:http.url
129
169
  - External Services: has:http.url (for outbound calls)
130
- - AI/LLM: has:gen_ai.system or has:gen_ai.request.model
131
- - MCP Tools: has:mcp.tool.name
170
+ - AI/LLM: has:gen_ai.provider.name or has:gen_ai.request.model
171
+ - MCP Tools: has:gen_ai.tool.name
132
172
 
133
173
  WHEN TO USE is_transaction:true (rare):
134
174
  - ONLY when you specifically need transaction boundaries (full request/response cycle)
@@ -151,6 +191,9 @@ SORTING RULES (CRITICAL - YOU MUST ALWAYS SPECIFY A SORT):
151
191
  - errors dataset: Use "-timestamp" (newest first)
152
192
  - spans dataset: Use "-span.duration" (slowest first)
153
193
  - logs dataset: Use "-timestamp" (newest first)
194
+ - metrics dataset: Use "-timestamp" for samples, or sort by the selected aggregate for grouped metric results
195
+ - profiles dataset: Use "-timestamp" for samples, or sort by the selected aggregate for grouped profile results
196
+ - replays dataset: Use "-started_at" (most recent replay first)
154
197
 
155
198
  3. SORTING SYNTAX:
156
199
  - Use "-" prefix for descending order (e.g., "-timestamp" for newest first)
@@ -168,12 +211,14 @@ SORTING RULES (CRITICAL - YOU MUST ALWAYS SPECIFY A SORT):
168
211
 
169
212
  YOUR RESPONSE FORMAT:
170
213
  Return a JSON object with these fields:
171
- - "dataset": Which dataset you determined to use ("spans", "errors", or "logs")
214
+ - "dataset": Which dataset you determined to use ("spans", "errors", "logs", "metrics", "profiles", or "replays")
172
215
  - "query": The Sentry query string for filtering results (use empty string "" for no filters)
173
216
  - "fields": Array of field names to return in results
174
217
  - For individual event queries: OPTIONAL (will use recommended fields if not provided)
175
218
  - For aggregate queries: REQUIRED (must include aggregate functions AND any groupBy fields)
219
+ - For replay queries: return []
176
220
  - "sort": Sort parameter for results (REQUIRED - YOU MUST ALWAYS SPECIFY THIS)
221
+ - "environment": Separate environment filter for replays, as a string or array of strings, or null when not needed
177
222
  - "timeRange": Time range parameters (optional)
178
223
  - Relative: {"statsPeriod": "24h"} for last 24 hours, "7d" for last 7 days, etc.
179
224
  - Absolute: {"start": "2025-06-19T07:00:00", "end": "2025-06-20T06:59:59"} for specific date ranges
@@ -188,9 +233,9 @@ CORRECT QUERY PATTERNS (FOLLOW THESE):
188
233
  PROCESS:
189
234
  1. Analyze the user's query
190
235
  2. Determine appropriate dataset
191
- 3. Use datasetAttributes tool to discover available fields
236
+ 3. Use datasetAttributes or replayFields to discover available fields
192
237
  4. Use otelSemantics tool if needed for OpenTelemetry attributes
193
- 5. Construct the final query with proper fields and sort parameters
238
+ 5. Construct the final query with proper fields, sort parameters, and replay environment when needed
194
239
 
195
240
  COMMON ERRORS TO AVOID:
196
241
  - Using SQL syntax (IS NOT NULL, IS NULL, yesterday(), today(), etc.) - Use has: operator and timeRange instead
@@ -198,6 +243,7 @@ COMMON ERRORS TO AVOID:
198
243
  - Using incorrect field names (use the otelSemantics tool to look up correct names)
199
244
  - Missing required fields in the fields array for aggregate queries
200
245
  - Invalid sort parameter not included in fields array
246
+ - Putting replay environment filters inside the replay query instead of the separate environment field
201
247
  - For field existence: Use has:field_name (NOT field_name IS NOT NULL)
202
248
  - For field absence: Use !has:field_name (NOT field_name IS NULL)
203
249
  - For time periods: Use timeRange parameter (NOT SQL date functions like yesterday())`;
@@ -228,7 +274,14 @@ const NUMERIC_FIELDS = {
228
274
  "measurements.ttfb"
229
275
  ]),
230
276
  errors: new Set(["stack.lineno"]),
231
- logs: new Set(["severity_number", "sentry.observed_timestamp_nanos"])
277
+ logs: new Set(["severity_number", "sentry.observed_timestamp_nanos"]),
278
+ tracemetrics: new Set([
279
+ "value",
280
+ "timestamp_precise",
281
+ "observed_timestamp",
282
+ "payload_size"
283
+ ]),
284
+ profiles: new Set(["profile.duration", "transaction.duration"])
232
285
  };
233
286
  const DATASET_FIELDS = {
234
287
  spans: {
@@ -250,12 +303,15 @@ const DATASET_FIELDS = {
250
303
  "http.url": "Full HTTP URL",
251
304
  "db.system": "Database system (postgresql, mysql, etc.)",
252
305
  "db.operation": "Database operation (SELECT, INSERT, etc.)",
253
- "gen_ai.system": "AI system (e.g., anthropic, openai)",
306
+ "gen_ai.provider.name": "AI provider name (e.g., anthropic, openai)",
254
307
  "gen_ai.request.model": "Model name (e.g., claude-3-5-sonnet-20241022)",
255
308
  "gen_ai.operation.name": "Operation type (e.g., chat, completion)",
256
309
  "gen_ai.usage.input_tokens": "Number of input tokens (numeric)",
257
310
  "gen_ai.usage.output_tokens": "Number of output tokens (numeric)",
258
- "mcp.tool.name": "Tool name (e.g., search_issues, search_events)",
311
+ "gen_ai.tool.name": "Tool name (e.g., search_issues, search_events)",
312
+ "mcp.method.name": "MCP request or notification method",
313
+ "mcp.protocol.version": "MCP protocol version",
314
+ "mcp.resource.uri": "MCP resource URI",
259
315
  "mcp.session.id": "MCP session identifier",
260
316
  "measurements.lcp": "Largest Contentful Paint - time until largest content element is visible (ms). Good < 2500ms",
261
317
  "measurements.cls": "Cumulative Layout Shift - visual stability score (unitless). Good < 0.1",
@@ -319,6 +375,56 @@ const DATASET_FIELDS = {
319
375
  "p99(field)": "99th percentile",
320
376
  "p100(field)": "100th percentile (max)",
321
377
  "epm()": "Events per minute rate"
378
+ },
379
+ tracemetrics: {
380
+ "metric.name": "Metric name for the newer span metrics dataset",
381
+ "metric.type": "Metric type (counter, gauge, distribution)",
382
+ "metric.unit": "Metric unit if present (for example millisecond, byte, percent)",
383
+ value: "Raw metric value (numeric)",
384
+ trace: "Trace ID",
385
+ span_id: "Span ID that emitted the metric",
386
+ "trace.parent_span_id": "Parent span ID",
387
+ timestamp: "When the metric sample occurred",
388
+ timestamp_precise: "High precision timestamp (numeric)",
389
+ observed_timestamp: "Observed timestamp (numeric)",
390
+ "sum(value,metric.name,metric.type,metric.unit)": "Sum a specific metric, e.g. sum(value,request_count,counter,-)",
391
+ "avg(value,metric.name,metric.type,metric.unit)": "Average a specific metric, e.g. avg(value,http.request.duration,distribution,millisecond)",
392
+ "min(value,metric.name,metric.type,metric.unit)": "Minimum metric value for a specific metric",
393
+ "max(value,metric.name,metric.type,metric.unit)": "Maximum metric value for a specific metric",
394
+ "count(value,metric.name,metric.type,metric.unit)": "Count samples for a specific metric",
395
+ "p50(value,metric.name,metric.type,metric.unit)": "Median for a distribution metric",
396
+ "p75(value,metric.name,metric.type,metric.unit)": "75th percentile for a distribution metric",
397
+ "p90(value,metric.name,metric.type,metric.unit)": "90th percentile for a distribution metric",
398
+ "p95(value,metric.name,metric.type,metric.unit)": "95th percentile for a distribution metric",
399
+ "p99(value,metric.name,metric.type,metric.unit)": "99th percentile for a distribution metric",
400
+ "per_second(value,metric.name,metric.type,metric.unit)": "Per-second rate for a metric, typically counters",
401
+ "per_minute(value,metric.name,metric.type,metric.unit)": "Per-minute rate for a metric, typically counters"
402
+ },
403
+ profiles: {
404
+ "profile.id": "Transaction profile ID for a specific captured profile",
405
+ "profiler.id": "Continuous profiler session ID for chunk-based profile captures",
406
+ "thread.id": "Thread ID associated with a continuous profile result when available",
407
+ timestamp: "When the profile was captured",
408
+ transaction: "Transaction name associated with the profile when available",
409
+ trace: "Trace ID linked to the profiled transaction",
410
+ release: "Release version associated with the profile",
411
+ environment: "Environment for the profile",
412
+ project: "Project slug",
413
+ "project.name": "Project name",
414
+ "platform.name": "Runtime or SDK platform name",
415
+ "device.model": "Device model for mobile or device-bound profiles",
416
+ "device.classification": "Device performance classification",
417
+ "device.arch": "Device architecture",
418
+ "profile.duration": "Total profile duration in nanoseconds for a captured profile",
419
+ "transaction.duration": "Transaction duration represented by the profile in nanoseconds",
420
+ "precise.start_ts": "Continuous profile precise start timestamp when available",
421
+ "precise.finish_ts": "Continuous profile precise finish timestamp when available",
422
+ "count()": "Count of matching profiles",
423
+ "last_seen()": "Most recent timestamp of the matching profile group",
424
+ "p50()": "Median profile duration for the selected grouping",
425
+ "p75()": "75th percentile profile duration",
426
+ "p95()": "95th percentile profile duration",
427
+ "p99()": "99th percentile profile duration"
322
428
  }
323
429
  };
324
430
  const DATASET_EXAMPLES = {
@@ -395,8 +501,8 @@ const DATASET_EXAMPLES = {
395
501
  {
396
502
  description: "top MCP tool calls by usage",
397
503
  output: {
398
- query: "has:mcp.tool.name",
399
- fields: ["mcp.tool.name", "count()"],
504
+ query: "has:gen_ai.tool.name",
505
+ fields: ["gen_ai.tool.name", "count()"],
400
506
  sort: "-count()"
401
507
  }
402
508
  },
@@ -558,6 +664,139 @@ const DATASET_EXAMPLES = {
558
664
  sort: "-timestamp"
559
665
  }
560
666
  }
667
+ ],
668
+ tracemetrics: [
669
+ {
670
+ description: "request duration percentiles by route",
671
+ output: {
672
+ query: "",
673
+ fields: [
674
+ "transaction",
675
+ "p75(value,http.request.duration,distribution,millisecond)",
676
+ "p95(value,http.request.duration,distribution,millisecond)",
677
+ "count(value,http.request.duration,distribution,millisecond)"
678
+ ],
679
+ sort: "-p95(value,http.request.duration,distribution,millisecond)"
680
+ }
681
+ },
682
+ {
683
+ description: "throughput by endpoint from a counter metric",
684
+ output: {
685
+ query: "",
686
+ fields: ["transaction", "per_minute(value,http.server.request.count,counter,-)"],
687
+ sort: "-per_minute(value,http.server.request.count,counter,-)"
688
+ }
689
+ },
690
+ {
691
+ description: "latest samples for a specific metric",
692
+ output: {
693
+ query: "metric.name:http.request.duration AND metric.type:distribution",
694
+ fields: [
695
+ "timestamp",
696
+ "project",
697
+ "metric.name",
698
+ "metric.type",
699
+ "metric.unit",
700
+ "value",
701
+ "trace"
702
+ ],
703
+ sort: "-timestamp"
704
+ }
705
+ },
706
+ {
707
+ description: "largest payload size metrics",
708
+ output: {
709
+ query: "metric.name:payload.size",
710
+ fields: [
711
+ "project",
712
+ "max(value,payload.size,gauge,byte)",
713
+ "avg(value,payload.size,gauge,byte)"
714
+ ],
715
+ sort: "-max(value,payload.size,gauge,byte)"
716
+ }
717
+ },
718
+ {
719
+ description: "metric value grouped by environment",
720
+ output: {
721
+ query: "metric.name:http.request.duration AND metric.type:distribution",
722
+ fields: [
723
+ "environment",
724
+ "avg(value,http.request.duration,distribution,millisecond)",
725
+ "count(value,http.request.duration,distribution,millisecond)"
726
+ ],
727
+ sort: "-avg(value,http.request.duration,distribution,millisecond)"
728
+ }
729
+ }
730
+ ],
731
+ profiles: [
732
+ {
733
+ description: "latest profiles for a transaction",
734
+ output: {
735
+ query: "transaction:/api/users",
736
+ fields: [
737
+ "project",
738
+ "profile.id",
739
+ "timestamp",
740
+ "transaction",
741
+ "transaction.duration",
742
+ "release",
743
+ "trace"
744
+ ],
745
+ sort: "-timestamp"
746
+ }
747
+ },
748
+ {
749
+ description: "count profiles by release",
750
+ output: {
751
+ query: "",
752
+ fields: [
753
+ "release",
754
+ "count()",
755
+ "last_seen()"
756
+ ],
757
+ sort: "-count()"
758
+ }
759
+ },
760
+ {
761
+ description: "slowest profiled transactions",
762
+ output: {
763
+ query: "",
764
+ fields: [
765
+ "transaction",
766
+ "p95()",
767
+ "count()"
768
+ ],
769
+ sort: "-p95()"
770
+ }
771
+ },
772
+ {
773
+ description: "continuous profiles for a profiler session",
774
+ output: {
775
+ query: "profiler.id:041bde57b9844e36b8b7e5734efae5f7",
776
+ fields: [
777
+ "project",
778
+ "profiler.id",
779
+ "thread.id",
780
+ "timestamp",
781
+ "precise.start_ts",
782
+ "precise.finish_ts",
783
+ "release"
784
+ ],
785
+ sort: "-timestamp"
786
+ }
787
+ },
788
+ {
789
+ description: "profiles grouped by environment",
790
+ output: {
791
+ query: "",
792
+ fields: [
793
+ "environment",
794
+ "count()",
795
+ "p95()"
796
+ ],
797
+ sort: "-count()"
798
+ }
799
+ }
561
800
  ]
562
801
  };
563
802
  const RECOMMENDED_FIELDS = {
@@ -596,9 +835,44 @@ const RECOMMENDED_FIELDS = {
596
835
  "trace"
597
836
  ],
598
837
  description: "Core span/trace information including span ID, operation, duration, and trace context"
838
+ },
839
+ tracemetrics: {
840
+ basic: [
841
+ "id",
842
+ "timestamp",
843
+ "project",
844
+ "trace",
845
+ "metric.name",
846
+ "metric.type",
847
+ "metric.unit",
848
+ "value"
849
+ ],
850
+ description: "Core trace metric sample information including metric identity, value, and trace context"
851
+ },
852
+ profiles: {
853
+ basic: [
854
+ "project",
855
+ "profile.id",
856
+ "profiler.id",
857
+ "thread.id",
858
+ "timestamp",
859
+ "transaction",
860
+ "transaction.duration",
861
+ "release",
862
+ "environment",
863
+ "trace",
864
+ "precise.start_ts",
865
+ "precise.finish_ts"
866
+ ],
867
+ description: "Core profiling information including profile identifiers, transaction context, timing, and trace linkage"
599
868
  }
600
869
  };
870
+ const TRACE_METRICS_SAMPLE_IDENTITY_FIELDS = [
871
+ "metric.name",
872
+ "metric.type",
873
+ "metric.unit"
874
+ ];
601
875
 
602
876
  //#endregion
603
- export { BASE_COMMON_FIELDS, DATASET_EXAMPLES, DATASET_FIELDS, NUMERIC_FIELDS, RECOMMENDED_FIELDS, systemPrompt };
604
- //# sourceMappingURL=config-D1QOSX9W-CtF1qegU.js.map
877
+ export { BASE_COMMON_FIELDS, DATASET_EXAMPLES, DATASET_FIELDS, NUMERIC_FIELDS, RECOMMENDED_FIELDS, TRACE_METRICS_SAMPLE_IDENTITY_FIELDS, systemPrompt };
878
+ //# sourceMappingURL=config-YHBj037H-DRbUBG2X.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-YHBj037H-DRbUBG2X.js","names":[],"sources":["../../mcp-core/dist/config-YHBj037H.js"],"sourcesContent":["//#region src/tools/search-events/config.ts\nconst systemPrompt = `You are a Sentry query translator. You need to:\n1. FIRST determine which dataset (spans, errors, logs, metrics, profiles, or replays) is most appropriate for the query\n2. Query the available attributes for that dataset using the datasetAttributes tool for spans/errors/logs/metrics/profiles, or the replayFields tool for replays\n3. Use the otelSemantics tool if you need OpenTelemetry semantic conventions\n4. Convert the natural language query to Sentry's search syntax (NOT SQL syntax)\n5. Decide which fields to return in the results\n\nCRITICAL: Sentry does NOT use SQL syntax. Do NOT generate SQL-like queries.\n\nDATASET SELECTION GUIDELINES:\n- spans: Raw trace/span events for performance, AI/LLM calls, database queries, HTTP requests, token usage, costs, user agent data, \"XYZ calls\", ambiguous operations (richest attribute set)\n- errors: Exceptions, crashes, stack traces, unhandled errors, browser/client errors; these usually become Sentry issues\n- logs: Application log entries, log messages, severity levels, debugging information; error-severity logs are still logs\n- metrics: Metric rows and aggregates, especially named metrics, counters, gauges, distributions, metric values, and queries that explicitly mention metric names/types\n- profiles: Transaction and continuous profile results, profile IDs, profile durations, releases, platforms, and profile-related transactions\n- replays: Session replay results, clicked elements, rage/dead clicks, visited pages, replay users, browsers, and releases\n\nFor ambiguous queries like \"calls using XYZ\", prefer spans dataset first as it contains the most comprehensive telemetry data.\nFor queries that explicitly ask about a metric name, metric type, counter/gauge/distribution, or newer span metrics, prefer metrics.\nFor queries about captured profiles, profile IDs, flamegraphs, or profiled transactions, prefer profiles.\nFor queries about session replays, clicked UI elements, rage clicks, dead clicks, visited URLs/screens, or replay users/sessions, prefer replays.\nIf the user says logs, log messages, error logs, or warning logs, choose logs instead of errors.\n\nCRITICAL - FIELD VERIFICATION REQUIREMENT:\nBefore constructing ANY query, you MUST verify field availability:\n1. You CANNOT assume ANY field exists without checking - not even common ones\n2. This includes ALL fields: custom attributes, database fields, HTTP fields, AI fields, user fields, etc.\n3. Fields vary by project based on what data is being sent to Sentry\n4. Using an unverified field WILL cause your query to fail with \"field not found\" errors\n5. For spans, logs, and metrics, datasetAttributes can validate exact field names with attributes and can list likely fields using substringMatch/query/attributeTypes\n6. A broad datasetAttributes listing is a discovery preview and may be truncated; do not treat absence from the preview as proof that a user-supplied field is invalid\n7. Replay fields vary by project too, so use replayFields before constructing replay queries\n\nTOOL USAGE GUIDELINES:\n1. Use datasetAttributes tool to discover available fields for your chosen dataset\n2. Use replayFields tool to discover available replay fields and custom replay tags\n3. Use otelSemantics tool when you need specific OpenTelemetry semantic convention attributes\n4. Use whoami tool when queries contain \"me\" references for user.id or user.email fields\n5. IMPORTANT: For ambiguous terms like \"user agents\", \"browser\", \"client\" - use the appropriate field discovery tool instead of guessing field names\n6. When the user already supplied Sentry search syntax for spans/logs/metrics, call datasetAttributes with exact attributes from the query or fields before dropping or renaming them\n7. Use datasetAttributes substringMatch, query, and attributeTypes for targeted lookup when broad field discovery is truncated\n\nCRITICAL - TOOL RESPONSE HANDLING:\nAll tools return responses in this format: {error?: string, result?: data}\n- If 'error' is present: The tool failed - analyze the error message and potentially retry with corrections\n- If 'result' is present: The tool succeeded - use the result data for your query construction\n- Always check for errors before using results\n\nCRITICAL - HANDLING \"DISTINCT\" OR \"UNIQUE VALUES\" QUERIES:\nWhen user asks for \"distinct\", \"unique\", \"all values of\", or \"what are the X\" queries:\n1. This ALWAYS requires an AGGREGATE query with count() function\n2. Pattern: fields=['field_name', 'count()'] to show distinct values with counts\n3. Sort by \"-count()\" to show most common values first\n4. Use datasetAttributes tool to verify the field exists before constructing query\n5. Examples:\n - \"distinct categories\" → fields=['category.name', 'count()'], sort='-count()'\n - \"unique types\" → fields=['item.type', 'count()'], sort='-count()'\n\nCRITICAL - TRAFFIC/VOLUME/COUNT QUERIES:\nWhen user asks about \"traffic\", \"volume\", \"how much\", \"how many\" (without specific metrics):\n1. This ALWAYS requires an AGGREGATE query with count() function\n2. For total counts: fields=['count()']\n3. For grouped counts: fields=['grouping_field', 'count()']\n4. Always include timeRange for period-specific queries\n5. Examples:\n - \"how much traffic in last 30 days\" → fields=['count()'], timeRange: {\"statsPeriod\": \"30d\"}\n - \"traffic on mcp-server\" → query: \"project:mcp-server\", fields=['count()']\n\nCRITICAL - HANDLING \"ME\" REFERENCES:\n- If the query contains \"me\", \"my\", \"myself\", or \"affecting me\" in the context of user.id or user.email fields, use the whoami tool to get the user's ID and email\n- For assignedTo fields, you can use \"me\" directly without translation (e.g., assignedTo:me works as-is)\n- After calling whoami, replace \"me\" references with the actual user.id or user.email values\n- If whoami fails, return an error explaining the issue\n\nQUERY MODES:\n1. INDIVIDUAL EVENTS (default): Returns raw event data\n - Used when fields contain no function() calls\n - Include recommended fields plus any user-requested fields\n\n2. AGGREGATE QUERIES: Grouping and aggregation (NOT SQL)\n - Activated when ANY field contains a function() call\n - Fields should ONLY include: aggregate functions + groupBy fields\n - Automatically groups by ALL non-function fields\n - For aggregate queries, ONLY include the aggregate functions and groupBy fields - do NOT include default fields like timestamp, id, etc.\n - You SHOULD sort aggregate results by \"-function_name()\" for descending order (highest values first)\n - For equations in aggregate queries: You SHOULD use \"-equation|...\" prefix unless user wants lowest values\n - When user asks \"how many total\", \"sum of\", or similar: They want the highest/total value, use descending sort\n\n3. REPLAY SEARCH RESULTS:\n - Replays return a LIST of replay sessions, not aggregations\n - For replays, set dataset to \"replays\"\n - For replays, return fields: []\n - For replays, use replay query syntax like count_errors:>0, url:*checkout*, click.textContent:\"Save\"\n - For replays, put environment in the separate \"environment\" field, NOT inside query\n - For replay environment filters, use a string for one environment or an array of strings for multiple environments\n - For replays, use sorts like -started_at, -count_errors, -count_rage_clicks, -count_dead_clicks, -duration\n - Replays do NOT support count()/avg()/sum() aggregations through this path\n\nCRITICAL LIMITATION - TIME SERIES NOT SUPPORTED:\n- Queries asking for data \"over time\", \"by hour\", \"by day\", \"time series\", or similar temporal groupings are NOT currently supported\n- If user asks for \"X over time\", return an error explaining: \"Time series aggregations are not currently supported.\"\n\nCRITICAL - DO NOT USE SQL SYNTAX:\n- NEVER use SQL functions like yesterday(), today(), now(), IS NOT NULL, IS NULL\n- NEVER use SQL date functions - use timeRange parameter instead\n- For \"yesterday\": Use timeRange: {\"statsPeriod\": \"24h\"}, NOT timestamp >= yesterday()\n- For field existence: Use has:field_name, NOT field_name IS NOT NULL\n- For field absence: Use !has:field_name, NOT field_name IS NULL\n\nREPLAY SEARCH RULES:\n- Use replayFields when dataset is replays\n- For replay environment filtering, set the separate \"environment\" field to a string or array of strings\n- Replay time filtering must use \"timeRange\", not query fields\n- Replay queries should not include event-search-only syntax like has:field_name\n- Replay sort must still go in the separate \"sort\" field\n- If the user asks about replays they have viewed, prefer viewed_by_me:true\n- If the user asks about replay users and says \"me\", use whoami and translate to user.email:<actual email>\n\nMATHEMATICAL QUERY PATTERNS:\nWhen user asks mathematical questions like \"how many X\", \"total Y used\", \"sum of Z\":\n- Identify the appropriate dataset based on context\n- Use datasetAttributes tool to find available numeric fields\n- Use sum() function for totals, avg() for averages, count() for counts\n- For time-based queries (\"today\", \"yesterday\", \"this week\"), use timeRange parameter\n- For \"total\" or \"how many\" questions: Users typically want highest values first (descending sort)\n\nDERIVED METRICS AND CALCULATIONS (SPANS ONLY):\nWhen user asks for calculated metrics, ratios, or conversions:\n- Use equation fields with \"equation|\" prefix\n- Examples:\n - \"duration in milliseconds\" → fields: [\"equation|avg(span.duration) * 1000\"], sort: \"-equation|avg(span.duration) * 1000\"\n - \"combined metric total\" → fields: [\"equation|sum(metric.a) + sum(metric.b)\"], sort: \"-equation|sum(metric.a) + sum(metric.b)\"\n - \"error rate percentage\" → fields: [\"equation|failure_rate() * 100\"], sort: \"-equation|failure_rate() * 100\"\n - \"events per second\" → fields: [\"equation|count() / 3600\"], sort: \"-equation|count() / 3600\"\n- IMPORTANT: Equations are ONLY supported in the spans dataset, NOT in errors, logs, or metrics\n- IMPORTANT: When sorting by equations, use \"-equation|...\" for descending order (highest values first)\n\nTRACE METRICS AGGREGATES (TRACEMETRICS DATASET):\nWhen querying metrics aggregates, prefer aggregate functions that fully encode the target metric:\n- Format: fn(value,metric.name,metric.type,metric.unit)\n- Counter examples: \"sum(value,my.counter,counter,-)\", \"per_second(value,my.counter,counter,-)\"\n- Gauge examples: \"avg(value,cpu.usage,gauge,percent)\", \"max(value,cpu.usage,gauge,percent)\"\n- Distribution examples: \"p95(value,http.request.duration,distribution,millisecond)\", \"avg(value,http.request.duration,distribution,millisecond)\"\n- IMPORTANT: Use the exact metric.name, metric.type, and metric.unit values when they are available\n- IMPORTANT: Tracemetrics do NOT support equation| fields\n\nPERFORMANCE INVESTIGATION STRATEGY:\nWhen users ask about \"performance problems\", \"slow pages\", \"slow endpoints\", \"latency issues\",\n\"web vitals\", \"LCP\", \"CLS\", \"INP\", \"page speed\", \"load time\", \"response time\", or similar:\n\n1. ALWAYS use AGGREGATE queries first - individual samples are misleading for performance analysis\n2. Use p75() as the primary percentile for consistent performance measurement\n3. Group by transaction to identify which pages/endpoints have problems\n4. Include count() to understand sample size (low count = unreliable data)\n5. Sort by the worst-performing metric (descending with \"-\" prefix)\n\nCRITICAL: For performance investigations, return AGGREGATES grouped by the span's transaction attribute, NOT individual events.\n\nSPAN QUERY PHILOSOPHY - DUCK TYPING:\nUse \"has:attribute\" to find spans by their characteristics, NOT \"is_transaction:true\".\nThe is_transaction:true filter ONLY returns transaction boundaries (request entry/exit points).\nMost performance queries want specific span types, not just boundaries.\n\nPerformance Query Patterns (use duck typing):\n- Web Vitals: has:measurements.lcp, has:measurements.cls, has:measurements.inp\n- Database: has:db.statement or has:db.system\n- HTTP/API calls: has:http.method or has:http.url\n- External Services: has:http.url (for outbound calls)\n- AI/LLM: has:gen_ai.provider.name or has:gen_ai.request.model\n- MCP Tools: has:gen_ai.tool.name\n\nWHEN TO USE is_transaction:true (rare):\n- ONLY when you specifically need transaction boundaries (full request/response cycle)\n- Example: \"total request duration by endpoint\" - you want the outermost span\n- For most queries about \"slow X\" or \"X performance\", use duck typing instead\n\nWeb Vitals Thresholds (for context when reporting):\n- LCP: Good < 2500ms, Needs Improvement 2500-4000ms, Poor >= 4000ms\n- CLS: Good < 0.1, Needs Improvement 0.1-0.25, Poor >= 0.25\n- INP: Good < 200ms, Needs Improvement 200-500ms, Poor >= 500ms\n- FCP: Good < 1800ms, Needs Improvement 1800-3000ms, Poor >= 3000ms\n- TTFB: Good < 800ms, Needs Improvement 800-1800ms, Poor >= 1800ms\n\nSORTING RULES (CRITICAL - YOU MUST ALWAYS SPECIFY A SORT):\n1. CRITICAL: Sort MUST go in the separate \"sort\" field, NEVER in the \"query\" field\n - WRONG: query: \"level:error sort:-timestamp\" ← Sort syntax in query field is FORBIDDEN\n - CORRECT: query: \"level:error\", sort: \"-timestamp\" ← Sort in separate field\n\n2. DEFAULT SORTING:\n - errors dataset: Use \"-timestamp\" (newest first)\n - spans dataset: Use \"-span.duration\" (slowest first) \n - logs dataset: Use \"-timestamp\" (newest first)\n - metrics dataset: Use \"-timestamp\" for samples, or sort by the selected aggregate for grouped metric results\n - profiles dataset: Use \"-timestamp\" for samples, or sort by the selected aggregate for grouped profile results\n - replays dataset: Use \"-started_at\" (most recent replay first)\n\n3. SORTING SYNTAX:\n - Use \"-\" prefix for descending order (e.g., \"-timestamp\" for newest first)\n - Use field name without prefix for ascending order\n - For aggregate queries: sort by aggregate function results (e.g., \"-count()\" for highest count first)\n - For equation fields: You SHOULD use \"-equation|...\" for descending order (e.g., \"-equation|sum(field1) + sum(field2)\")\n - Only omit the \"-\" prefix if the user clearly wants lowest values first (rare)\n\n4. IMPORTANT SORTING REQUIREMENTS:\n - YOU MUST ALWAYS INCLUDE A SORT PARAMETER\n - CRITICAL: The field you sort by MUST be included in your fields array\n - If sorting by \"-timestamp\", include \"timestamp\" in fields\n - If sorting by \"-count()\", include \"count()\" in fields\n - This is MANDATORY - Sentry will reject queries where sort field is not in the selected fields\n\nYOUR RESPONSE FORMAT:\nReturn a JSON object with these fields:\n- \"dataset\": Which dataset you determined to use (\"spans\", \"errors\", \"logs\", \"metrics\", \"profiles\", or \"replays\")\n- \"query\": The Sentry query string for filtering results (use empty string \"\" for no filters)\n- \"fields\": Array of field names to return in results\n - For individual event queries: OPTIONAL (will use recommended fields if not provided)\n - For aggregate queries: REQUIRED (must include aggregate functions AND any groupBy fields)\n - For replay queries: return []\n- \"sort\": Sort parameter for results (REQUIRED - YOU MUST ALWAYS SPECIFY THIS)\n- \"environment\": Separate environment filter for replays, as a string or array of strings, or null when not needed\n- \"timeRange\": Time range parameters (optional)\n - Relative: {\"statsPeriod\": \"24h\"} for last 24 hours, \"7d\" for last 7 days, etc.\n - Absolute: {\"start\": \"2025-06-19T07:00:00\", \"end\": \"2025-06-20T06:59:59\"} for specific date ranges\n- \"explanation\": Brief explanation of how you translated this query\n\nCORRECT QUERY PATTERNS (FOLLOW THESE):\n- For field existence: Use has:field_name (NOT field_name IS NOT NULL)\n- For field absence: Use !has:field_name (NOT field_name IS NULL)\n- For time periods: Use timeRange parameter (NOT SQL date functions)\n- Example: \"items processed yesterday\" → query: \"has:item.processed\", timeRange: {\"statsPeriod\": \"24h\"}\n\nPROCESS:\n1. Analyze the user's query\n2. Determine appropriate dataset\n3. Use datasetAttributes or replayFields to discover available fields\n4. Use otelSemantics tool if needed for OpenTelemetry attributes\n5. Construct the final query with proper fields, sort parameters, and replay environment when needed\n\nCOMMON ERRORS TO AVOID:\n- Using SQL syntax (IS NOT NULL, IS NULL, yesterday(), today(), etc.) - Use has: operator and timeRange instead\n- Using numeric functions (sum, avg, min, max, percentiles) on non-numeric fields\n- Using incorrect field names (use the otelSemantics tool to look up correct names)\n- Missing required fields in the fields array for aggregate queries\n- Invalid sort parameter not included in fields array\n- Putting replay environment filters inside the replay query instead of the separate environment field\n- For field existence: Use has:field_name (NOT field_name IS NOT NULL)\n- For field absence: Use !has:field_name (NOT field_name IS NULL)\n- For time periods: Use timeRange parameter (NOT SQL date functions like yesterday())`;\nconst BASE_COMMON_FIELDS = {\n\tproject: \"Project slug\",\n\ttimestamp: \"When the event occurred\",\n\tenvironment: \"Environment (production, staging, development)\",\n\trelease: \"Release version\",\n\tplatform: \"Platform (javascript, python, etc.)\",\n\t\"user.id\": \"User ID\",\n\t\"user.email\": \"User email\",\n\t\"sdk.name\": \"SDK name\",\n\t\"sdk.version\": \"SDK version\"\n};\nconst NUMERIC_FIELDS = {\n\tspans: new Set([\n\t\t\"span.duration\",\n\t\t\"span.self_time\",\n\t\t\"transaction.duration\",\n\t\t\"http.status_code\",\n\t\t\"gen_ai.usage.input_tokens\",\n\t\t\"gen_ai.usage.output_tokens\",\n\t\t\"gen_ai.request.max_tokens\",\n\t\t\"measurements.lcp\",\n\t\t\"measurements.cls\",\n\t\t\"measurements.inp\",\n\t\t\"measurements.fcp\",\n\t\t\"measurements.ttfb\"\n\t]),\n\terrors: new Set([\"stack.lineno\"]),\n\tlogs: new Set([\"severity_number\", \"sentry.observed_timestamp_nanos\"]),\n\ttracemetrics: new Set([\n\t\t\"value\",\n\t\t\"timestamp_precise\",\n\t\t\"observed_timestamp\",\n\t\t\"payload_size\"\n\t]),\n\tprofiles: new Set([\"profile.duration\", \"transaction.duration\"])\n};\nconst DATASET_FIELDS = {\n\tspans: {\n\t\t\"span.op\": \"Span operation type (e.g., http.client, db.query, cache.get)\",\n\t\t\"span.description\": \"Detailed description of the span operation\",\n\t\t\"span.duration\": \"Duration of the span in milliseconds\",\n\t\t\"span.status\": \"Span status (ok, cancelled, unknown, etc.)\",\n\t\t\"span.self_time\": \"Time spent in this span excluding child spans\",\n\t\ttransaction: \"Transaction name/route\",\n\t\t\"transaction.duration\": \"Total transaction duration in milliseconds\",\n\t\t\"transaction.op\": \"Transaction operation type\",\n\t\t\"transaction.status\": \"Transaction status\",\n\t\tis_transaction: \"Whether this span is a transaction (true/false)\",\n\t\ttrace: \"Trace ID\",\n\t\t\"trace.span_id\": \"Span ID within the trace\",\n\t\t\"trace.parent_span_id\": \"Parent span ID\",\n\t\t\"http.method\": \"HTTP method (GET, POST, etc.)\",\n\t\t\"http.status_code\": \"HTTP response status code\",\n\t\t\"http.url\": \"Full HTTP URL\",\n\t\t\"db.system\": \"Database system (postgresql, mysql, etc.)\",\n\t\t\"db.operation\": \"Database operation (SELECT, INSERT, etc.)\",\n\t\t\"gen_ai.provider.name\": \"AI provider name (e.g., anthropic, openai)\",\n\t\t\"gen_ai.request.model\": \"Model name (e.g., claude-3-5-sonnet-20241022)\",\n\t\t\"gen_ai.operation.name\": \"Operation type (e.g., chat, completion)\",\n\t\t\"gen_ai.usage.input_tokens\": \"Number of input tokens (numeric)\",\n\t\t\"gen_ai.usage.output_tokens\": \"Number of output tokens (numeric)\",\n\t\t\"gen_ai.tool.name\": \"Tool name (e.g., search_issues, search_events)\",\n\t\t\"mcp.method.name\": \"MCP request or notification method\",\n\t\t\"mcp.protocol.version\": \"MCP protocol version\",\n\t\t\"mcp.resource.uri\": \"MCP resource URI\",\n\t\t\"mcp.session.id\": \"MCP session identifier\",\n\t\t\"measurements.lcp\": \"Largest Contentful Paint - time until largest content element is visible (ms). Good < 2500ms\",\n\t\t\"measurements.cls\": \"Cumulative Layout Shift - visual stability score (unitless). Good < 0.1\",\n\t\t\"measurements.inp\": \"Interaction to Next Paint - responsiveness to user input (ms). Good < 200ms\",\n\t\t\"measurements.fcp\": \"First Contentful Paint - time until first content is visible (ms). Good < 1800ms\",\n\t\t\"measurements.ttfb\": \"Time to First Byte - server response time (ms). Good < 800ms\",\n\t\t\"count()\": \"Count of spans\",\n\t\t\"count_unique(field)\": \"Count of unique values, e.g. count_unique(user.id)\",\n\t\t\"avg(field)\": \"Average of numeric field, e.g. avg(span.duration)\",\n\t\t\"sum(field)\": \"Sum of numeric field, e.g. sum(span.self_time)\",\n\t\t\"min(field)\": \"Minimum of numeric field, e.g. min(span.duration)\",\n\t\t\"max(field)\": \"Maximum of numeric field, e.g. max(span.duration)\",\n\t\t\"p50(field)\": \"50th percentile (median), e.g. p50(span.duration)\",\n\t\t\"p75(field)\": \"75th percentile - standard for performance analysis, e.g. p75(span.duration)\",\n\t\t\"p90(field)\": \"90th percentile, e.g. p90(span.duration)\",\n\t\t\"p95(field)\": \"95th percentile, e.g. p95(span.duration)\",\n\t\t\"p99(field)\": \"99th percentile, e.g. p99(span.duration)\",\n\t\t\"p100(field)\": \"100th percentile (max), e.g. p100(span.duration)\",\n\t\t\"epm()\": \"Events per minute rate\",\n\t\t\"failure_rate()\": \"Percentage of failed spans\"\n\t},\n\terrors: {\n\t\tmessage: \"Error message\",\n\t\tlevel: \"Error level (error, warning, info, debug)\",\n\t\t\"error.type\": \"Error type/exception class\",\n\t\t\"error.value\": \"Error value/description\",\n\t\t\"error.handled\": \"Whether the error was handled (true/false)\",\n\t\tculprit: \"Code location that caused the error\",\n\t\ttitle: \"Error title/grouping\",\n\t\t\"stack.filename\": \"File where error occurred\",\n\t\t\"stack.function\": \"Function where error occurred\",\n\t\t\"stack.module\": \"Module where error occurred\",\n\t\t\"stack.abs_path\": \"Absolute path to file\",\n\t\t\"os.name\": \"Operating system name\",\n\t\t\"browser.name\": \"Browser name\",\n\t\t\"device.family\": \"Device family\",\n\t\t\"count()\": \"Count of error events\",\n\t\t\"count_unique(field)\": \"Count of unique values, e.g. count_unique(user.id)\",\n\t\t\"count_if(field,equals,value)\": \"Conditional count, e.g. count_if(error.handled,equals,false)\",\n\t\t\"last_seen()\": \"Most recent timestamp of the group\",\n\t\t\"eps()\": \"Events per second rate\",\n\t\t\"epm()\": \"Events per minute rate\"\n\t},\n\tlogs: {\n\t\tmessage: \"Log message\",\n\t\tseverity: \"Log severity level (trace, debug, info, warn, error, fatal)\",\n\t\tseverity_number: \"Numeric severity level\",\n\t\t\"sentry.item_id\": \"Sentry item ID\",\n\t\t\"sentry.observed_timestamp_nanos\": \"Observed timestamp in nanoseconds\",\n\t\ttrace: \"Trace ID\",\n\t\t\"count()\": \"Count of log entries\",\n\t\t\"count_unique(field)\": \"Count of unique values, e.g. count_unique(user.id)\",\n\t\t\"avg(field)\": \"Average of numeric field, e.g. avg(severity_number)\",\n\t\t\"sum(field)\": \"Sum of numeric field\",\n\t\t\"min(field)\": \"Minimum of numeric field\",\n\t\t\"max(field)\": \"Maximum of numeric field\",\n\t\t\"p50(field)\": \"50th percentile (median)\",\n\t\t\"p75(field)\": \"75th percentile\",\n\t\t\"p90(field)\": \"90th percentile\",\n\t\t\"p95(field)\": \"95th percentile\",\n\t\t\"p99(field)\": \"99th percentile\",\n\t\t\"p100(field)\": \"100th percentile (max)\",\n\t\t\"epm()\": \"Events per minute rate\"\n\t},\n\ttracemetrics: {\n\t\t\"metric.name\": \"Metric name for the newer span metrics dataset\",\n\t\t\"metric.type\": \"Metric type (counter, gauge, distribution)\",\n\t\t\"metric.unit\": \"Metric unit if present (for example millisecond, byte, percent)\",\n\t\tvalue: \"Raw metric value (numeric)\",\n\t\ttrace: \"Trace ID\",\n\t\tspan_id: \"Span ID that emitted the metric\",\n\t\t\"trace.parent_span_id\": \"Parent span ID\",\n\t\ttimestamp: \"When the metric sample occurred\",\n\t\ttimestamp_precise: \"High precision timestamp (numeric)\",\n\t\tobserved_timestamp: \"Observed timestamp (numeric)\",\n\t\t\"sum(value,metric.name,metric.type,metric.unit)\": \"Sum a specific metric, e.g. sum(value,request_count,counter,-)\",\n\t\t\"avg(value,metric.name,metric.type,metric.unit)\": \"Average a specific metric, e.g. avg(value,http.request.duration,distribution,millisecond)\",\n\t\t\"min(value,metric.name,metric.type,metric.unit)\": \"Minimum metric value for a specific metric\",\n\t\t\"max(value,metric.name,metric.type,metric.unit)\": \"Maximum metric value for a specific metric\",\n\t\t\"count(value,metric.name,metric.type,metric.unit)\": \"Count samples for a specific metric\",\n\t\t\"p50(value,metric.name,metric.type,metric.unit)\": \"Median for a distribution metric\",\n\t\t\"p75(value,metric.name,metric.type,metric.unit)\": \"75th percentile for a distribution metric\",\n\t\t\"p90(value,metric.name,metric.type,metric.unit)\": \"90th percentile for a distribution metric\",\n\t\t\"p95(value,metric.name,metric.type,metric.unit)\": \"95th percentile for a distribution metric\",\n\t\t\"p99(value,metric.name,metric.type,metric.unit)\": \"99th percentile for a distribution metric\",\n\t\t\"per_second(value,metric.name,metric.type,metric.unit)\": \"Per-second rate for a metric, typically counters\",\n\t\t\"per_minute(value,metric.name,metric.type,metric.unit)\": \"Per-minute rate for a metric, typically counters\"\n\t},\n\tprofiles: {\n\t\t\"profile.id\": \"Transaction profile ID for a specific captured profile\",\n\t\t\"profiler.id\": \"Continuous profiler session ID for chunk-based profile captures\",\n\t\t\"thread.id\": \"Thread ID associated with a continuous profile result when available\",\n\t\ttimestamp: \"When the profile was captured\",\n\t\ttransaction: \"Transaction name associated with the profile when available\",\n\t\ttrace: \"Trace ID linked to the profiled transaction\",\n\t\trelease: \"Release version associated with the profile\",\n\t\tenvironment: \"Environment for the profile\",\n\t\tproject: \"Project slug\",\n\t\t\"project.name\": \"Project name\",\n\t\t\"platform.name\": \"Runtime or SDK platform name\",\n\t\t\"device.model\": \"Device model for mobile or device-bound profiles\",\n\t\t\"device.classification\": \"Device performance classification\",\n\t\t\"device.arch\": \"Device architecture\",\n\t\t\"profile.duration\": \"Total profile duration in nanoseconds for a captured profile\",\n\t\t\"transaction.duration\": \"Transaction duration represented by the profile in nanoseconds\",\n\t\t\"precise.start_ts\": \"Continuous profile precise start timestamp when available\",\n\t\t\"precise.finish_ts\": \"Continuous profile precise finish timestamp when available\",\n\t\t\"count()\": \"Count of matching profiles\",\n\t\t\"last_seen()\": \"Most recent timestamp of the matching profile group\",\n\t\t\"p50()\": \"Median profile duration for the selected grouping\",\n\t\t\"p75()\": \"75th percentile profile duration\",\n\t\t\"p95()\": \"95th percentile profile duration\",\n\t\t\"p99()\": \"99th percentile profile duration\"\n\t}\n};\nconst DATASET_EXAMPLES = {\n\tspans: [\n\t\t{\n\t\t\tdescription: \"web vitals performance problems\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:measurements.lcp\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"p75(measurements.lcp)\",\n\t\t\t\t\t\"p75(measurements.cls)\",\n\t\t\t\t\t\"p75(measurements.inp)\",\n\t\t\t\t\t\"count()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-p75(measurements.lcp)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"slowest database queries\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:db.statement\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"db.system\",\n\t\t\t\t\t\"db.statement\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"p75(span.duration)\",\n\t\t\t\t\t\"p95(span.duration)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-p75(span.duration)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"total request duration by endpoint (transaction boundaries)\",\n\t\t\toutput: {\n\t\t\t\tquery: \"is_transaction:true\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"avg(span.duration)\",\n\t\t\t\t\t\"p95(span.duration)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-avg(span.duration)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"slow API calls over 5 seconds\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:request.url AND span.duration:>5000\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"span.op\",\n\t\t\t\t\t\"span.description\",\n\t\t\t\t\t\"span.duration\",\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"trace\"\n\t\t\t\t],\n\t\t\t\tsort: \"-span.duration\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"token usage by AI model\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:gen_ai.usage.input_tokens\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"gen_ai.request.model\",\n\t\t\t\t\t\"sum(gen_ai.usage.input_tokens)\",\n\t\t\t\t\t\"sum(gen_ai.usage.output_tokens)\",\n\t\t\t\t\t\"count()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-sum(gen_ai.usage.input_tokens)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"top MCP tool calls by usage\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:gen_ai.tool.name\",\n\t\t\t\tfields: [\"gen_ai.tool.name\", \"count()\"],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"HTTP requests by user agent\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:http.method AND has:user_agent.original\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"user_agent.original\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"avg(span.duration)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"frontend performance overview\",\n\t\t\toutput: {\n\t\t\t\tquery: \"has:measurements.lcp\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"p75(span.duration)\",\n\t\t\t\t\t\"p75(measurements.lcp)\",\n\t\t\t\t\t\"p75(measurements.fcp)\",\n\t\t\t\t\t\"p75(measurements.ttfb)\",\n\t\t\t\t\t\"count()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-p75(span.duration)\"\n\t\t\t}\n\t\t}\n\t],\n\terrors: [\n\t\t{\n\t\t\tdescription: \"unhandled errors in production\",\n\t\t\toutput: {\n\t\t\t\tquery: \"error.handled:false AND environment:production\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"issue\",\n\t\t\t\t\t\"title\",\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"message\",\n\t\t\t\t\t\"error.type\",\n\t\t\t\t\t\"culprit\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"count errors by type\",\n\t\t\toutput: {\n\t\t\t\tquery: \"level:error\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"error.type\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"last_seen()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"errors in specific file\",\n\t\t\toutput: {\n\t\t\t\tquery: \"stack.filename:\\\"**/Button.tsx\\\"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"issue\",\n\t\t\t\t\t\"title\",\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"message\",\n\t\t\t\t\t\"stack.filename\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"most common errors\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\"title\", \"count()\"],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"unique users affected by errors\",\n\t\t\toutput: {\n\t\t\t\tquery: \"level:error\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"error.type\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"count_unique(user.id)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count_unique(user.id)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"errors by browser/user agent\",\n\t\t\toutput: {\n\t\t\t\tquery: \"level:error AND has:user_agent.original\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"user_agent.original\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"count_unique(user.id)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t}\n\t],\n\tlogs: [\n\t\t{\n\t\t\tdescription: \"error logs about database\",\n\t\t\toutput: {\n\t\t\t\tquery: \"severity:error AND message:\\\"*database*\\\"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"message\",\n\t\t\t\t\t\"severity\",\n\t\t\t\t\t\"trace\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"count logs by severity\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\"severity\", \"count()\"],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"most common log messages\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\"message\", \"count()\"],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"log volume by project\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"epm()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"warning logs about memory\",\n\t\t\toutput: {\n\t\t\t\tquery: \"severity:warn AND message:\\\"*memory*\\\"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"message\",\n\t\t\t\t\t\"severity\",\n\t\t\t\t\t\"trace\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t}\n\t],\n\ttracemetrics: [\n\t\t{\n\t\t\tdescription: \"request duration percentiles by route\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"p75(value,http.request.duration,distribution,millisecond)\",\n\t\t\t\t\t\"p95(value,http.request.duration,distribution,millisecond)\",\n\t\t\t\t\t\"count(value,http.request.duration,distribution,millisecond)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-p95(value,http.request.duration,distribution,millisecond)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"throughput by endpoint from a counter metric\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\"transaction\", \"per_minute(value,http.server.request.count,counter,-)\"],\n\t\t\t\tsort: \"-per_minute(value,http.server.request.count,counter,-)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"latest samples for a specific metric\",\n\t\t\toutput: {\n\t\t\t\tquery: \"metric.name:http.request.duration AND metric.type:distribution\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"metric.name\",\n\t\t\t\t\t\"metric.type\",\n\t\t\t\t\t\"metric.unit\",\n\t\t\t\t\t\"value\",\n\t\t\t\t\t\"trace\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"largest payload size metrics\",\n\t\t\toutput: {\n\t\t\t\tquery: \"metric.name:payload.size\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"max(value,payload.size,gauge,byte)\",\n\t\t\t\t\t\"avg(value,payload.size,gauge,byte)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-max(value,payload.size,gauge,byte)\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"metric value grouped by environment\",\n\t\t\toutput: {\n\t\t\t\tquery: \"metric.name:http.request.duration AND metric.type:distribution\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"environment\",\n\t\t\t\t\t\"avg(value,http.request.duration,distribution,millisecond)\",\n\t\t\t\t\t\"count(value,http.request.duration,distribution,millisecond)\"\n\t\t\t\t],\n\t\t\t\tsort: \"-avg(value,http.request.duration,distribution,millisecond)\"\n\t\t\t}\n\t\t}\n\t],\n\tprofiles: [\n\t\t{\n\t\t\tdescription: \"latest profiles for a transaction\",\n\t\t\toutput: {\n\t\t\t\tquery: \"transaction:/api/users\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"profile.id\",\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"transaction.duration\",\n\t\t\t\t\t\"release\",\n\t\t\t\t\t\"trace\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"count profiles by release\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"release\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"last_seen()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"slowest profiled transactions\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"transaction\",\n\t\t\t\t\t\"p95()\",\n\t\t\t\t\t\"count()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-p95()\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"continuous profiles for a profiler session\",\n\t\t\toutput: {\n\t\t\t\tquery: \"profiler.id:041bde57b9844e36b8b7e5734efae5f7\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"project\",\n\t\t\t\t\t\"profiler.id\",\n\t\t\t\t\t\"thread.id\",\n\t\t\t\t\t\"timestamp\",\n\t\t\t\t\t\"precise.start_ts\",\n\t\t\t\t\t\"precise.finish_ts\",\n\t\t\t\t\t\"release\"\n\t\t\t\t],\n\t\t\t\tsort: \"-timestamp\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tdescription: \"profiles grouped by environment\",\n\t\t\toutput: {\n\t\t\t\tquery: \"\",\n\t\t\t\tfields: [\n\t\t\t\t\t\"environment\",\n\t\t\t\t\t\"count()\",\n\t\t\t\t\t\"p95()\"\n\t\t\t\t],\n\t\t\t\tsort: \"-count()\"\n\t\t\t}\n\t\t}\n\t]\n};\nconst RECOMMENDED_FIELDS = {\n\terrors: {\n\t\tbasic: [\n\t\t\t\"issue\",\n\t\t\t\"title\",\n\t\t\t\"project\",\n\t\t\t\"timestamp\",\n\t\t\t\"level\",\n\t\t\t\"message\",\n\t\t\t\"error.type\",\n\t\t\t\"culprit\"\n\t\t],\n\t\tdescription: \"Basic error information including issue ID, title, timestamp, severity, and location\"\n\t},\n\tlogs: {\n\t\tbasic: [\n\t\t\t\"timestamp\",\n\t\t\t\"project\",\n\t\t\t\"message\",\n\t\t\t\"severity\",\n\t\t\t\"trace\"\n\t\t],\n\t\tdescription: \"Essential log entry information\"\n\t},\n\tspans: {\n\t\tbasic: [\n\t\t\t\"id\",\n\t\t\t\"span.op\",\n\t\t\t\"span.description\",\n\t\t\t\"span.duration\",\n\t\t\t\"transaction\",\n\t\t\t\"timestamp\",\n\t\t\t\"project\",\n\t\t\t\"trace\"\n\t\t],\n\t\tdescription: \"Core span/trace information including span ID, operation, duration, and trace context\"\n\t},\n\ttracemetrics: {\n\t\tbasic: [\n\t\t\t\"id\",\n\t\t\t\"timestamp\",\n\t\t\t\"project\",\n\t\t\t\"trace\",\n\t\t\t\"metric.name\",\n\t\t\t\"metric.type\",\n\t\t\t\"metric.unit\",\n\t\t\t\"value\"\n\t\t],\n\t\tdescription: \"Core trace metric sample information including metric identity, value, and trace context\"\n\t},\n\tprofiles: {\n\t\tbasic: [\n\t\t\t\"project\",\n\t\t\t\"profile.id\",\n\t\t\t\"profiler.id\",\n\t\t\t\"thread.id\",\n\t\t\t\"timestamp\",\n\t\t\t\"transaction\",\n\t\t\t\"transaction.duration\",\n\t\t\t\"release\",\n\t\t\t\"environment\",\n\t\t\t\"trace\",\n\t\t\t\"precise.start_ts\",\n\t\t\t\"precise.finish_ts\"\n\t\t],\n\t\tdescription: \"Core profiling information including profile identifiers, transaction context, timing, and trace linkage\"\n\t}\n};\nconst TRACE_METRICS_SAMPLE_IDENTITY_FIELDS = [\n\t\"metric.name\",\n\t\"metric.type\",\n\t\"metric.unit\"\n];\n\n//#endregion\nexport { BASE_COMMON_FIELDS, DATASET_EXAMPLES, DATASET_FIELDS, NUMERIC_FIELDS, RECOMMENDED_FIELDS, TRACE_METRICS_SAMPLE_IDENTITY_FIELDS, systemPrompt };\n//# sourceMappingURL=config-YHBj037H.js.map"],"mappings":";AACA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwPtB,MAAM,qBAAqB;CAC1B,SAAS;CACT,WAAW;CACX,aAAa;CACb,SAAS;CACT,UAAU;CACV,WAAW;CACX,cAAc;CACd,YAAY;CACZ,eAAe;AACf;AACD,MAAM,iBAAiB;CACtB,OAAO,IAAI,IAAI;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACA;CACD,QAAQ,IAAI,IAAI,CAAC,cAAe;CAChC,MAAM,IAAI,IAAI,CAAC,mBAAmB,iCAAkC;CACpE,cAAc,IAAI,IAAI;EACrB;EACA;EACA;EACA;CACA;CACD,UAAU,IAAI,IAAI,CAAC,oBAAoB,sBAAuB;AAC9D;AACD,MAAM,iBAAiB;CACtB,OAAO;EACN,WAAW;EACX,oBAAoB;EACpB,iBAAiB;EACjB,eAAe;EACf,kBAAkB;EAClB,aAAa;EACb,wBAAwB;EACxB,kBAAkB;EAClB,sBAAsB;EACtB,gBAAgB;EAChB,OAAO;EACP,iBAAiB;EACjB,wBAAwB;EACxB,eAAe;EACf,oBAAoB;EACpB,YAAY;EACZ,aAAa;EACb,gBAAgB;EAChB,wBAAwB;EACxB,wBAAwB;EACxB,yBAAyB;EACzB,6BAA6B;EAC7B,8BAA8B;EAC9B,oBAAoB;EACpB,mBAAmB;EACnB,wBAAwB;EACxB,oBAAoB;EACpB,kBAAkB;EAClB,oBAAoB;EACpB,oBAAoB;EACpB,oBAAoB;EACpB,oBAAoB;EACpB,qBAAqB;EACrB,WAAW;EACX,uBAAuB;EACvB,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,eAAe;EACf,SAAS;EACT,kBAAkB;CAClB;CACD,QAAQ;EACP,SAAS;EACT,OAAO;EACP,cAAc;EACd,eAAe;EACf,iBAAiB;EACjB,SAAS;EACT,OAAO;EACP,kBAAkB;EAClB,kBAAkB;EAClB,gBAAgB;EAChB,kBAAkB;EAClB,WAAW;EACX,gBAAgB;EAChB,iBAAiB;EACjB,WAAW;EACX,uBAAuB;EACvB,gCAAgC;EAChC,eAAe;EACf,SAAS;EACT,SAAS;CACT;CACD,MAAM;EACL,SAAS;EACT,UAAU;EACV,iBAAiB;EACjB,kBAAkB;EAClB,mCAAmC;EACnC,OAAO;EACP,WAAW;EACX,uBAAuB;EACvB,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,eAAe;EACf,SAAS;CACT;CACD,cAAc;EACb,eAAe;EACf,eAAe;EACf,eAAe;EACf,OAAO;EACP,OAAO;EACP,SAAS;EACT,wBAAwB;EACxB,WAAW;EACX,mBAAmB;EACnB,oBAAoB;EACpB,kDAAkD;EAClD,kDAAkD;EAClD,kDAAkD;EAClD,kDAAkD;EAClD,oDAAoD;EACpD,kDAAkD;EAClD,kDAAkD;EAClD,kDAAkD;EAClD,kDAAkD;EAClD,kDAAkD;EAClD,yDAAyD;EACzD,yDAAyD;CACzD;CACD,UAAU;EACT,cAAc;EACd,eAAe;EACf,aAAa;EACb,WAAW;EACX,aAAa;EACb,OAAO;EACP,SAAS;EACT,aAAa;EACb,SAAS;EACT,gBAAgB;EAChB,iBAAiB;EACjB,gBAAgB;EAChB,yBAAyB;EACzB,eAAe;EACf,oBAAoB;EACpB,wBAAwB;EACxB,oBAAoB;EACpB,qBAAqB;EACrB,WAAW;EACX,eAAe;EACf,SAAS;EACT,SAAS;EACT,SAAS;EACT,SAAS;CACT;AACD;AACD,MAAM,mBAAmB;CACxB,OAAO;EACN;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ,CAAC,oBAAoB,SAAU;IACvC,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;CACD;CACD,QAAQ;EACP;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ,CAAC,SAAS,SAAU;IAC5B,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;CACD;CACD,MAAM;EACL;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ,CAAC,YAAY,SAAU;IAC/B,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ,CAAC,WAAW,SAAU;IAC9B,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;CACD;CACD,cAAc;EACb;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ,CAAC,eAAe,uDAAwD;IAChF,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;CACD;CACD,UAAU;EACT;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;EACD;GACC,aAAa;GACb,QAAQ;IACP,OAAO;IACP,QAAQ;KACP;KACA;KACA;IACA;IACD,MAAM;GACN;EACD;CACD;AACD;AACD,MAAM,qBAAqB;CAC1B,QAAQ;EACP,OAAO;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACA;EACD,aAAa;CACb;CACD,MAAM;EACL,OAAO;GACN;GACA;GACA;GACA;GACA;EACA;EACD,aAAa;CACb;CACD,OAAO;EACN,OAAO;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACA;EACD,aAAa;CACb;CACD,cAAc;EACb,OAAO;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACA;EACD,aAAa;CACb;CACD,UAAU;EACT,OAAO;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACA;EACD,aAAa;CACb;AACD;AACD,MAAM,uCAAuC;CAC5C;CACA;CACA;AACA"}