@sentry/mcp-server 0.42.0 → 0.49.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.
- package/README.md +57 -0
- package/dist/sentry-mcp.cjs +3240 -0
- package/package.json +22 -40
- package/LICENSE.md +0 -105
- package/dist/auth/constants.cjs +0 -9
- package/dist/auth/constants.d.cts +0 -31
- package/dist/auth/constants.d.cts.map +0 -1
- package/dist/auth/constants.d.ts +0 -31
- package/dist/auth/constants.d.ts.map +0 -1
- package/dist/auth/constants.js +0 -3
- package/dist/auth/device-code-flow.cjs +0 -10
- package/dist/auth/device-code-flow.d.cts +0 -34
- package/dist/auth/device-code-flow.d.cts.map +0 -1
- package/dist/auth/device-code-flow.d.ts +0 -34
- package/dist/auth/device-code-flow.d.ts.map +0 -1
- package/dist/auth/device-code-flow.js +0 -6
- package/dist/auth/resolve-token.cjs +0 -8
- package/dist/auth/resolve-token.d.cts +0 -17
- package/dist/auth/resolve-token.d.cts.map +0 -1
- package/dist/auth/resolve-token.d.ts +0 -17
- package/dist/auth/resolve-token.d.ts.map +0 -1
- package/dist/auth/resolve-token.js +0 -8
- package/dist/auth/token-cache.cjs +0 -5
- package/dist/auth/token-cache.d.cts +0 -11
- package/dist/auth/token-cache.d.cts.map +0 -1
- package/dist/auth/token-cache.d.ts +0 -11
- package/dist/auth/token-cache.d.ts.map +0 -1
- package/dist/auth/token-cache.js +0 -3
- package/dist/auth/types.cjs +0 -7
- package/dist/auth/types.d.cts +0 -2
- package/dist/auth/types.d.ts +0 -2
- package/dist/auth/types.js +0 -3
- package/dist/auth-B__Aec1m.cjs +0 -90
- package/dist/auth-B__Aec1m.cjs.map +0 -1
- package/dist/auth-BtRpItji.js +0 -79
- package/dist/auth-BtRpItji.js.map +0 -1
- package/dist/blob-utils-B0ae0K-m-BF8kTomr.cjs +0 -4724
- package/dist/blob-utils-B0ae0K-m-BF8kTomr.cjs.map +0 -1
- package/dist/blob-utils-B0ae0K-m-BhC2W04C.js +0 -4701
- package/dist/blob-utils-B0ae0K-m-BhC2W04C.js.map +0 -1
- package/dist/blob-utils-BM8EcgEO.js +0 -3
- package/dist/blob-utils-DBvCs9nw.cjs +0 -3
- package/dist/chunk-CunrlGP7.js +0 -37
- package/dist/chunk-Cv9WC9bY.cjs +0 -58
- package/dist/cli/commands/auth.cjs +0 -11
- package/dist/cli/commands/auth.d.cts +0 -8
- package/dist/cli/commands/auth.d.cts.map +0 -1
- package/dist/cli/commands/auth.d.ts +0 -8
- package/dist/cli/commands/auth.d.ts.map +0 -1
- package/dist/cli/commands/auth.js +0 -10
- package/dist/cli/output.cjs +0 -3
- package/dist/cli/output.d.cts +0 -7
- package/dist/cli/output.d.cts.map +0 -1
- package/dist/cli/output.d.ts +0 -7
- package/dist/cli/output.d.ts.map +0 -1
- package/dist/cli/output.js +0 -3
- package/dist/cli/parse.cjs +0 -5
- package/dist/cli/parse.d.cts +0 -11
- package/dist/cli/parse.d.cts.map +0 -1
- package/dist/cli/parse.d.ts +0 -11
- package/dist/cli/parse.d.ts.map +0 -1
- package/dist/cli/parse.js +0 -3
- package/dist/cli/resolve.cjs +0 -6
- package/dist/cli/resolve.d.cts +0 -16
- package/dist/cli/resolve.d.cts.map +0 -1
- package/dist/cli/resolve.d.ts +0 -16
- package/dist/cli/resolve.d.ts.map +0 -1
- package/dist/cli/resolve.js +0 -4
- package/dist/cli/types.cjs +0 -0
- package/dist/cli/types.d.cts +0 -2
- package/dist/cli/types.d.ts +0 -2
- package/dist/cli/types.js +0 -0
- package/dist/cli/usage.cjs +0 -3
- package/dist/cli/usage.d.cts +0 -9
- package/dist/cli/usage.d.cts.map +0 -1
- package/dist/cli/usage.d.ts +0 -9
- package/dist/cli/usage.d.ts.map +0 -1
- package/dist/cli/usage.js +0 -3
- package/dist/config-40SaJWzQ-Bxau3bPR.cjs +0 -928
- package/dist/config-40SaJWzQ-Bxau3bPR.cjs.map +0 -1
- package/dist/config-40SaJWzQ-Dz27jdMQ.js +0 -886
- package/dist/config-40SaJWzQ-Dz27jdMQ.js.map +0 -1
- package/dist/config-DeGbV11k.cjs +0 -7
- package/dist/config-NGx6OsOU.js +0 -3
- package/dist/constants-CGu8w21D.js +0 -452
- package/dist/constants-CGu8w21D.js.map +0 -1
- package/dist/constants-Cw_BclsW.cjs +0 -644
- package/dist/constants-Cw_BclsW.cjs.map +0 -1
- package/dist/device-code-flow-afx1qvK6.cjs +0 -154
- package/dist/device-code-flow-afx1qvK6.cjs.map +0 -1
- package/dist/device-code-flow-mwBASRbi.js +0 -124
- package/dist/device-code-flow-mwBASRbi.js.map +0 -1
- package/dist/index.cjs +0 -61536
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -61537
- package/dist/index.js.map +0 -1
- package/dist/output-A_-7o7gV.js +0 -8
- package/dist/output-A_-7o7gV.js.map +0 -1
- package/dist/output-DEoNyYz7.cjs +0 -14
- package/dist/output-DEoNyYz7.cjs.map +0 -1
- package/dist/parse-CPY7-_2_.cjs +0 -130
- package/dist/parse-CPY7-_2_.cjs.map +0 -1
- package/dist/parse-Dd3OOgIq.js +0 -112
- package/dist/parse-Dd3OOgIq.js.map +0 -1
- package/dist/resolve-BvvBO-dw.cjs +0 -179
- package/dist/resolve-BvvBO-dw.cjs.map +0 -1
- package/dist/resolve-DOyeMm4X.js +0 -144
- package/dist/resolve-DOyeMm4X.js.map +0 -1
- package/dist/resolve-token-BHBj9ll0.js +0 -47
- package/dist/resolve-token-BHBj9ll0.js.map +0 -1
- package/dist/resolve-token-dsXzYI7-.cjs +0 -52
- package/dist/resolve-token-dsXzYI7-.cjs.map +0 -1
- package/dist/stdio-0Gl343e-.js +0 -59
- package/dist/stdio-0Gl343e-.js.map +0 -1
- package/dist/stdio-CZiqpRKP.cjs +0 -65
- package/dist/stdio-CZiqpRKP.cjs.map +0 -1
- package/dist/token-3xpHVxQo.js +0 -51
- package/dist/token-3xpHVxQo.js.map +0 -1
- package/dist/token-C7MavkKX.cjs +0 -55
- package/dist/token-C7MavkKX.cjs.map +0 -1
- package/dist/token-cache-ATUcs1cg.cjs +0 -84
- package/dist/token-cache-ATUcs1cg.cjs.map +0 -1
- package/dist/token-cache-DbZp4rvg.js +0 -66
- package/dist/token-cache-DbZp4rvg.js.map +0 -1
- package/dist/token-error-CBmJNKLY.js +0 -43
- package/dist/token-error-CBmJNKLY.js.map +0 -1
- package/dist/token-error-x_miDBP3.cjs +0 -48
- package/dist/token-error-x_miDBP3.cjs.map +0 -1
- package/dist/token-util-4bIYDTMS.js +0 -4
- package/dist/token-util-BRoQwIG6.cjs +0 -363
- package/dist/token-util-BRoQwIG6.cjs.map +0 -1
- package/dist/token-util-DurDL44i.cjs +0 -9
- package/dist/token-util-batRsXGA.js +0 -358
- package/dist/token-util-batRsXGA.js.map +0 -1
- package/dist/transports/stdio.cjs +0 -4
- package/dist/transports/stdio.d.cts +0 -40
- package/dist/transports/stdio.d.cts.map +0 -1
- package/dist/transports/stdio.d.ts +0 -40
- package/dist/transports/stdio.d.ts.map +0 -1
- package/dist/transports/stdio.js +0 -4
- package/dist/types-BCSxlxZI.js +0 -57
- package/dist/types-BCSxlxZI.js.map +0 -1
- package/dist/types-BGyk9F4G.d.ts +0 -61
- package/dist/types-BGyk9F4G.d.ts.map +0 -1
- package/dist/types-C9HgNyIE.d.cts +0 -61
- package/dist/types-C9HgNyIE.d.cts.map +0 -1
- package/dist/types-D-BIcaY4.d.ts +0 -91
- package/dist/types-D-BIcaY4.d.ts.map +0 -1
- package/dist/types-Dyacb-A8.d.cts +0 -91
- package/dist/types-Dyacb-A8.d.cts.map +0 -1
- package/dist/types-dghCRFW4.cjs +0 -87
- package/dist/types-dghCRFW4.cjs.map +0 -1
- package/dist/usage-DZ4QDygT.cjs +0 -74
- package/dist/usage-DZ4QDygT.cjs.map +0 -1
- package/dist/usage-Hi-6-LDr.js +0 -68
- package/dist/usage-Hi-6-LDr.js.map +0 -1
- package/dist/version-NjstoynH.js +0 -7
- package/dist/version-NjstoynH.js.map +0 -1
- package/dist/version-_1CmW0BF.cjs +0 -19
- package/dist/version-_1CmW0BF.cjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-40SaJWzQ-Dz27jdMQ.js","names":[],"sources":["../../mcp-core/dist/config-40SaJWzQ.js"],"sourcesContent":["//#region src/tools/support/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\n6. For non-replay datasets, call validateSearch on the candidate request and fix failures before returning\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 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 substringMatch or query filters from the request before dropping or renaming fields\n7. Use datasetAttributes substringMatch, query, and attributeTypes for targeted lookup when broad field discovery is truncated\n8. For non-replay datasets, call validateSearch after constructing the candidate request. If invalid, fix and validate again in this same pass\n9. NEVER replace a structured field:value filter with message/log.body/full-text matching. If an explicit field is unavailable on the dataset, keep it and let validation fail instead of inventing a weaker query\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\nTIME SERIES (data over time):\n- When the user asks for a metric OVER TIME (\"over time\", \"per hour\", \"by day\", \"trend\", \"time series\"), set the \\`timeSeries\\` field instead of returning an error.\n- \\`timeSeries.yAxis\\` = the aggregate to plot (e.g. \"count()\", \"count_unique(user)\", \"sum(span.duration)\"). Put the aggregate here, NOT in \\`fields\\`.\n- \\`timeSeries.interval\\` = a bucket size like \"1h\" or \"1d\" ONLY when the user names a granularity (\"per hour\" → \"1h\", \"daily\" → \"1d\"). Otherwise leave it null so Sentry picks a sensible bucket for the time range — never require the user to specify it.\n- Leave \\`timeSeries\\` null for normal queries and single-total aggregates.\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\n6. For non-replay datasets, validateSearch the candidate and only return after it passes (or after you cannot fix it without weakening structured filters)\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: \"Deployment environment name (omit unless the user names one)\",\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\t\"user.email\",\n\t\t\t\"user.id\"\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-40SaJWzQ.js.map"],"mappings":";AACA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8PtB,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;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"}
|
package/dist/config-DeGbV11k.cjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const require_config_40SaJWzQ = require('./config-40SaJWzQ-Bxau3bPR.cjs');
|
|
2
|
-
|
|
3
|
-
exports.BASE_COMMON_FIELDS = require_config_40SaJWzQ.BASE_COMMON_FIELDS;
|
|
4
|
-
exports.DATASET_EXAMPLES = require_config_40SaJWzQ.DATASET_EXAMPLES;
|
|
5
|
-
exports.DATASET_FIELDS = require_config_40SaJWzQ.DATASET_FIELDS;
|
|
6
|
-
exports.NUMERIC_FIELDS = require_config_40SaJWzQ.NUMERIC_FIELDS;
|
|
7
|
-
exports.RECOMMENDED_FIELDS = require_config_40SaJWzQ.RECOMMENDED_FIELDS;
|
package/dist/config-NGx6OsOU.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { BASE_COMMON_FIELDS, DATASET_EXAMPLES, DATASET_FIELDS, NUMERIC_FIELDS, RECOMMENDED_FIELDS, TRACE_METRICS_SAMPLE_IDENTITY_FIELDS, systemPrompt } from "./config-40SaJWzQ-Dz27jdMQ.js";
|
|
2
|
-
|
|
3
|
-
export { BASE_COMMON_FIELDS, DATASET_EXAMPLES, DATASET_FIELDS, NUMERIC_FIELDS, RECOMMENDED_FIELDS };
|
|
@@ -1,452 +0,0 @@
|
|
|
1
|
-
//#region ../mcp-core/dist/events-datasets-bC65QyVa.js
|
|
2
|
-
const PUBLIC_EVENTS_DATASETS = [
|
|
3
|
-
"spans",
|
|
4
|
-
"errors",
|
|
5
|
-
"logs",
|
|
6
|
-
"metrics",
|
|
7
|
-
"profiles"
|
|
8
|
-
];
|
|
9
|
-
function isMetricsDataset(dataset) {
|
|
10
|
-
return dataset === "metrics" || dataset === "tracemetrics";
|
|
11
|
-
}
|
|
12
|
-
function isProfilesDataset(dataset) {
|
|
13
|
-
return dataset === "profiles";
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Sentry's product-facing Explore schemas already call this dataset "metrics",
|
|
17
|
-
* but the current `/events/` and `/trace-items/attributes/` APIs still expect
|
|
18
|
-
* the legacy `tracemetrics` identifier. Keep MCP aligned with the UI-facing
|
|
19
|
-
* schema and swap only at the transport boundary until the upstream API name
|
|
20
|
-
* catches up.
|
|
21
|
-
*/
|
|
22
|
-
function normalizeEventsDataset(dataset) {
|
|
23
|
-
return dataset === "metrics" ? "tracemetrics" : dataset;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region ../mcp-core/dist/url-utils-8DkYoi3G.js
|
|
28
|
-
/**
|
|
29
|
-
* Recognizes Sentry-owned hosts, including single-tenant deployments.
|
|
30
|
-
*/
|
|
31
|
-
function isSentryHost(host) {
|
|
32
|
-
return host === "sentry.io" || host.endsWith(".sentry.io");
|
|
33
|
-
}
|
|
34
|
-
/** Hosts that use the public SaaS control host and organization web subdomains. */
|
|
35
|
-
function isPublicSentryHost(host) {
|
|
36
|
-
return isSentryHost(host) && !host.endsWith(".my.sentry.io");
|
|
37
|
-
}
|
|
38
|
-
function deriveSelectedFields(fields, aggregateFunctions, groupByFields) {
|
|
39
|
-
if (fields && fields.length > 0) return fields;
|
|
40
|
-
return Array.from(new Set([...groupByFields ?? [], ...aggregateFunctions ?? []]));
|
|
41
|
-
}
|
|
42
|
-
function getSentryWebBaseUrl(host, organizationSlug, path, protocol = "https") {
|
|
43
|
-
const isSaas = isPublicSentryHost(host);
|
|
44
|
-
const webHost = isSaas ? "sentry.io" : host;
|
|
45
|
-
return isSaas ? `${protocol}://${organizationSlug}.${webHost}${path}` : `${protocol}://${host}/organizations/${organizationSlug}${path}`;
|
|
46
|
-
}
|
|
47
|
-
function normalizeTraceMetric(metric) {
|
|
48
|
-
if (!metric?.name || !metric.type) return null;
|
|
49
|
-
return {
|
|
50
|
-
name: metric.name,
|
|
51
|
-
type: metric.type,
|
|
52
|
-
unit: metric.unit && metric.unit !== "-" ? metric.unit : void 0
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function extractTraceMetricFromAggregate(field) {
|
|
56
|
-
const match = field.match(/^[^(]+\((.*)\)$/);
|
|
57
|
-
if (!match) return null;
|
|
58
|
-
const args = match[1].split(",").map((arg) => arg.trim()).filter((arg) => arg.length > 0);
|
|
59
|
-
if (args.length < 4) return null;
|
|
60
|
-
return normalizeTraceMetric({
|
|
61
|
-
name: args[1],
|
|
62
|
-
type: args[2],
|
|
63
|
-
unit: args[3]
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
function extractTraceMetricFromQuery(query) {
|
|
67
|
-
const extractValue = (field) => {
|
|
68
|
-
const quotedMatch = query.match(new RegExp(`${field}:"([^"]+)"`, "i"));
|
|
69
|
-
if (quotedMatch?.[1]) return quotedMatch[1];
|
|
70
|
-
const unquotedMatch = query.match(new RegExp(`${field}:([^\\s]+)`, "i"));
|
|
71
|
-
return unquotedMatch?.[1] ?? null;
|
|
72
|
-
};
|
|
73
|
-
return normalizeTraceMetric({
|
|
74
|
-
name: extractValue("metric\\.name") ?? "",
|
|
75
|
-
type: extractValue("metric\\.type") ?? "",
|
|
76
|
-
unit: extractValue("metric\\.unit") ?? void 0
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
function dedupeTraceMetrics(metrics) {
|
|
80
|
-
const deduped = /* @__PURE__ */ new Map();
|
|
81
|
-
for (const metric of metrics) {
|
|
82
|
-
const normalizedMetric = normalizeTraceMetric(metric);
|
|
83
|
-
if (!normalizedMetric) continue;
|
|
84
|
-
const key = `${normalizedMetric.name}|${normalizedMetric.type}|${normalizedMetric.unit ?? ""}`;
|
|
85
|
-
deduped.set(key, normalizedMetric);
|
|
86
|
-
}
|
|
87
|
-
return [...deduped.values()];
|
|
88
|
-
}
|
|
89
|
-
function buildMetricQueryState(params) {
|
|
90
|
-
return JSON.stringify({
|
|
91
|
-
metric: params.metric,
|
|
92
|
-
query: params.query,
|
|
93
|
-
aggregateFields: [...params.yAxes.map((yAxis) => ({ yAxes: [yAxis] })), ...(params.groupByFields ?? []).map((field) => ({ groupBy: field }))],
|
|
94
|
-
aggregateSortBys: params.aggregateSortBys ?? [],
|
|
95
|
-
mode: params.mode
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
function getTraceMetricsExploreUrl(host, organizationSlug, options, protocol = "https") {
|
|
99
|
-
const { query, projectId, statsPeriod, start, end, sort, aggregateFunctions, groupByFields, traceMetrics } = options;
|
|
100
|
-
const urlParams = new URLSearchParams();
|
|
101
|
-
if (projectId) urlParams.set("project", projectId);
|
|
102
|
-
if (start && end) {
|
|
103
|
-
urlParams.set("start", start);
|
|
104
|
-
urlParams.set("end", end);
|
|
105
|
-
} else urlParams.set("statsPeriod", statsPeriod || "24h");
|
|
106
|
-
const aggregateFields = aggregateFunctions ?? [];
|
|
107
|
-
const aggregateGroupByFields = groupByFields ?? [];
|
|
108
|
-
const isAggregateQuery = aggregateFields.length > 0;
|
|
109
|
-
const sortField = sort?.startsWith("-") ? sort.slice(1) : sort;
|
|
110
|
-
const sortKind = sort?.startsWith("-") ? "desc" : "asc";
|
|
111
|
-
if (isAggregateQuery) {
|
|
112
|
-
const metricQueries = /* @__PURE__ */ new Map();
|
|
113
|
-
for (const aggregateField of aggregateFields) {
|
|
114
|
-
const metric = extractTraceMetricFromAggregate(aggregateField);
|
|
115
|
-
if (!metric) continue;
|
|
116
|
-
const key = `${metric.name}|${metric.type}|${metric.unit ?? ""}`;
|
|
117
|
-
const existing = metricQueries.get(key);
|
|
118
|
-
if (existing) existing.yAxes.push(aggregateField);
|
|
119
|
-
else metricQueries.set(key, {
|
|
120
|
-
metric,
|
|
121
|
-
yAxes: [aggregateField]
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
for (const { metric, yAxes } of metricQueries.values()) {
|
|
125
|
-
const aggregateSortBys = sortField && (yAxes.includes(sortField) || aggregateGroupByFields.includes(sortField)) ? [{
|
|
126
|
-
field: sortField,
|
|
127
|
-
kind: sortKind
|
|
128
|
-
}] : [];
|
|
129
|
-
urlParams.append("metric", buildMetricQueryState({
|
|
130
|
-
metric,
|
|
131
|
-
query,
|
|
132
|
-
mode: "aggregate",
|
|
133
|
-
yAxes,
|
|
134
|
-
groupByFields: aggregateGroupByFields,
|
|
135
|
-
aggregateSortBys
|
|
136
|
-
}));
|
|
137
|
-
}
|
|
138
|
-
} else {
|
|
139
|
-
const sampleMetrics = dedupeTraceMetrics([...traceMetrics ?? [], extractTraceMetricFromQuery(query)]);
|
|
140
|
-
for (const metric of sampleMetrics) urlParams.append("metric", buildMetricQueryState({
|
|
141
|
-
metric,
|
|
142
|
-
query,
|
|
143
|
-
mode: "samples",
|
|
144
|
-
yAxes: ["sum(value)"],
|
|
145
|
-
aggregateSortBys: [{
|
|
146
|
-
field: "sum(value)",
|
|
147
|
-
kind: "desc"
|
|
148
|
-
}]
|
|
149
|
-
}));
|
|
150
|
-
}
|
|
151
|
-
return `${getSentryWebBaseUrl(host, organizationSlug, "/explore/metrics/", protocol)}?${urlParams.toString()}`;
|
|
152
|
-
}
|
|
153
|
-
function getProfilingExplorerUrl(host, organizationSlug, options, protocol = "https") {
|
|
154
|
-
const { query, projectId, statsPeriod, start, end, sort, fields, aggregateFunctions, groupByFields } = options;
|
|
155
|
-
const urlParams = new URLSearchParams();
|
|
156
|
-
if (query) urlParams.set("query", query);
|
|
157
|
-
if (projectId) urlParams.set("project", projectId);
|
|
158
|
-
if (sort) urlParams.set("sort", sort);
|
|
159
|
-
for (const field of deriveSelectedFields(fields, aggregateFunctions, groupByFields)) urlParams.append("field", field);
|
|
160
|
-
if (start && end) {
|
|
161
|
-
urlParams.set("start", start);
|
|
162
|
-
urlParams.set("end", end);
|
|
163
|
-
} else urlParams.set("statsPeriod", statsPeriod || "24h");
|
|
164
|
-
return `${getSentryWebBaseUrl(host, organizationSlug, "/explore/profiling/", protocol)}?${urlParams.toString()}`;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Generates a Sentry issue URL.
|
|
168
|
-
* @param host The Sentry host (may include regional subdomain for API access)
|
|
169
|
-
* @param organizationSlug Organization identifier
|
|
170
|
-
* @param issueId Issue identifier (e.g., "PROJECT-123")
|
|
171
|
-
* @returns The complete issue URL
|
|
172
|
-
*/
|
|
173
|
-
function getIssueUrl(host, organizationSlug, issueId, protocol = "https") {
|
|
174
|
-
return getSentryWebBaseUrl(host, organizationSlug, `/issues/${issueId}`, protocol);
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Generates a Sentry dashboard URL.
|
|
178
|
-
* @param host The Sentry host (may include regional subdomain for API access)
|
|
179
|
-
* @param organizationSlug Organization identifier
|
|
180
|
-
* @param dashboardId Dashboard ID
|
|
181
|
-
* @param options Optional dashboard view query parameters
|
|
182
|
-
* @param protocol Protocol to use when building the web URL
|
|
183
|
-
* @returns The complete dashboard URL
|
|
184
|
-
*/
|
|
185
|
-
function getDashboardUrl(host, organizationSlug, dashboardId, options = {}, protocol = "https") {
|
|
186
|
-
const encodedDashboardId = encodeURIComponent(dashboardId);
|
|
187
|
-
const params = new URLSearchParams();
|
|
188
|
-
if (options.projectId !== null && options.projectId !== void 0) params.set("project", String(options.projectId));
|
|
189
|
-
if (options.statsPeriod) params.set("statsPeriod", options.statsPeriod);
|
|
190
|
-
const queryString = params.toString();
|
|
191
|
-
return `${getSentryWebBaseUrl(host, organizationSlug, `/dashboard/${encodedDashboardId}/`, protocol)}${queryString ? `?${queryString}` : ""}`;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Generates a Sentry preprod snapshot URL.
|
|
195
|
-
* @param host The Sentry host (may include regional subdomain for API access)
|
|
196
|
-
* @param organizationSlug Organization identifier
|
|
197
|
-
* @param snapshotId Preprod snapshot artifact ID
|
|
198
|
-
* @returns The complete snapshot URL
|
|
199
|
-
*/
|
|
200
|
-
function getPreprodSnapshotUrl(host, organizationSlug, snapshotId, protocol = "https") {
|
|
201
|
-
return getSentryWebBaseUrl(host, organizationSlug, `/preprod/snapshots/${snapshotId}/`, protocol);
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Generates a Sentry cron monitor URL.
|
|
205
|
-
* @param host The Sentry host (may include regional subdomain for API access)
|
|
206
|
-
* @param organizationSlug Organization identifier
|
|
207
|
-
* @param monitorSlug Monitor slug
|
|
208
|
-
* @param projectSlug Optional project slug to disambiguate monitors with the same slug
|
|
209
|
-
* @returns The complete monitor URL
|
|
210
|
-
*/
|
|
211
|
-
function getMonitorUrl(host, organizationSlug, monitorSlug, protocol = "https", projectSlug) {
|
|
212
|
-
const monitorPath = (projectSlug ? [projectSlug, monitorSlug] : [monitorSlug]).map((segment) => encodeURIComponent(segment)).join("/");
|
|
213
|
-
return getSentryWebBaseUrl(host, organizationSlug, `/crons/${monitorPath}/`, protocol);
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Generates a Sentry release URL.
|
|
217
|
-
* @param host The Sentry host (may include regional subdomain for API access)
|
|
218
|
-
* @param organizationSlug Organization identifier
|
|
219
|
-
* @param releaseVersion Release version identifier
|
|
220
|
-
* @returns The complete release URL
|
|
221
|
-
*/
|
|
222
|
-
/**
|
|
223
|
-
* Generates a Sentry uptime monitor URL.
|
|
224
|
-
*
|
|
225
|
-
* Uses the monitors UI path (`/monitors/{id}/`), which is the current home for
|
|
226
|
-
* uptime detectors in Sentry.
|
|
227
|
-
*/
|
|
228
|
-
function getUptimeMonitorUrl(host, organizationSlug, uptimeMonitorId, protocol = "https") {
|
|
229
|
-
const encodedId = encodeURIComponent(String(uptimeMonitorId));
|
|
230
|
-
return getSentryWebBaseUrl(host, organizationSlug, `/monitors/${encodedId}/`, protocol);
|
|
231
|
-
}
|
|
232
|
-
function getReleaseUrl(host, organizationSlug, releaseVersion, protocol = "https") {
|
|
233
|
-
const encodedReleaseVersion = encodeURIComponent(releaseVersion);
|
|
234
|
-
return getSentryWebBaseUrl(host, organizationSlug, `/releases/${encodedReleaseVersion}/`, protocol);
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Generates a Sentry issues search URL.
|
|
238
|
-
* @param host The Sentry host (may include regional subdomain for API access)
|
|
239
|
-
* @param organizationSlug Organization identifier
|
|
240
|
-
* @param query Optional search query
|
|
241
|
-
* @param projectSlugOrId Optional project slug or ID
|
|
242
|
-
* @returns The complete issues search URL
|
|
243
|
-
*/
|
|
244
|
-
function getIssuesSearchUrl(host, organizationSlug, query, projectSlugOrId, protocol = "https") {
|
|
245
|
-
let url = getSentryWebBaseUrl(host, organizationSlug, "/issues/", protocol);
|
|
246
|
-
const params = new URLSearchParams();
|
|
247
|
-
if (projectSlugOrId) params.append("project", projectSlugOrId);
|
|
248
|
-
if (query) params.append("query", query);
|
|
249
|
-
const queryString = params.toString();
|
|
250
|
-
if (queryString) url += `?${queryString}`;
|
|
251
|
-
return url;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Generates a Sentry replay search URL.
|
|
255
|
-
* @param host The Sentry host (may include regional subdomain for API access)
|
|
256
|
-
* @param organizationSlug Organization identifier
|
|
257
|
-
* @param options Replay search options
|
|
258
|
-
* @returns The complete replay search URL
|
|
259
|
-
*/
|
|
260
|
-
function getReplaysSearchUrl(host, organizationSlug, options = {}, protocol = "https") {
|
|
261
|
-
const { query, projectSlugOrId, environment, sort, statsPeriod, start, end } = options;
|
|
262
|
-
let url = getSentryWebBaseUrl(host, organizationSlug, "/explore/replays/", protocol);
|
|
263
|
-
const params = new URLSearchParams();
|
|
264
|
-
if (projectSlugOrId) params.append("project", projectSlugOrId);
|
|
265
|
-
if (query) params.append("query", query);
|
|
266
|
-
if (environment) {
|
|
267
|
-
const environments = Array.isArray(environment) ? environment : [environment];
|
|
268
|
-
for (const value of environments) params.append("environment", value);
|
|
269
|
-
}
|
|
270
|
-
if (sort) params.append("sort", sort);
|
|
271
|
-
if (start && end) {
|
|
272
|
-
params.append("start", start);
|
|
273
|
-
params.append("end", end);
|
|
274
|
-
} else if (statsPeriod) params.append("statsPeriod", statsPeriod);
|
|
275
|
-
const queryString = params.toString();
|
|
276
|
-
if (queryString) url += `?${queryString}`;
|
|
277
|
-
return url;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Generates a Sentry trace URL for performance investigation.
|
|
281
|
-
* @param host The Sentry host (may include regional subdomain for API access)
|
|
282
|
-
* @param organizationSlug Organization identifier
|
|
283
|
-
* @param traceId Trace identifier
|
|
284
|
-
* @returns The complete trace URL
|
|
285
|
-
*/
|
|
286
|
-
function getTraceUrl(host, organizationSlug, traceId, protocol = "https") {
|
|
287
|
-
return getSentryWebBaseUrl(host, organizationSlug, `/explore/traces/trace/${traceId}`, protocol);
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Generates a Sentry replay URL.
|
|
291
|
-
* @param host The Sentry host (may include regional subdomain for API access)
|
|
292
|
-
* @param organizationSlug Organization identifier
|
|
293
|
-
* @param replayId Replay identifier
|
|
294
|
-
* @returns The complete replay URL
|
|
295
|
-
*/
|
|
296
|
-
function getReplayUrl(host, organizationSlug, replayId, protocol = "https") {
|
|
297
|
-
return getSentryWebBaseUrl(host, organizationSlug, `/explore/replays/${replayId}/`, protocol);
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Generates a Sentry AI conversation URL.
|
|
301
|
-
* @param host The Sentry host
|
|
302
|
-
* @param organizationSlug Organization identifier
|
|
303
|
-
* @param conversationId AI conversation identifier
|
|
304
|
-
* @returns The complete AI conversation URL
|
|
305
|
-
*/
|
|
306
|
-
function getAIConversationUrl(host, organizationSlug, conversationId, protocol = "https") {
|
|
307
|
-
return getSentryWebBaseUrl(host, organizationSlug, `/explore/conversations/${encodeURIComponent(conversationId)}/`, protocol);
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Extract a single non-negated AI conversation ID from a Sentry search query
|
|
311
|
-
* that filters on `gen_ai.conversation.id`. Returns undefined when the query
|
|
312
|
-
* does not contain exactly one such filter or contains a negated filter.
|
|
313
|
-
*/
|
|
314
|
-
function extractConversationIdFromSearchQuery(query) {
|
|
315
|
-
if (!query) return void 0;
|
|
316
|
-
if (/!gen_ai\.conversation\.id:|\bNOT\s+(?:\(\s*)?gen_ai\.conversation\.id:/i.test(query)) return void 0;
|
|
317
|
-
const pattern = /gen_ai\.conversation\.id:(?:"([^"]+)"|([^\s)]+))/g;
|
|
318
|
-
const matches = [...query.matchAll(pattern)];
|
|
319
|
-
if (matches.length !== 1) return void 0;
|
|
320
|
-
const conversationId = matches[0][1] ?? matches[0][2];
|
|
321
|
-
if (conversationId.startsWith("[")) return void 0;
|
|
322
|
-
return conversationId;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Generates a Sentry AI conversations list URL with optional search filters.
|
|
326
|
-
*/
|
|
327
|
-
function getAIConversationsUrl(host, organizationSlug, options = {}, protocol = "https") {
|
|
328
|
-
const urlParams = new URLSearchParams();
|
|
329
|
-
if (options.query) urlParams.set("query", options.query);
|
|
330
|
-
for (const projectId of options.project ?? []) urlParams.append("project", projectId);
|
|
331
|
-
const environments = Array.isArray(options.environment) ? options.environment : options.environment ? [options.environment] : [];
|
|
332
|
-
for (const environmentName of environments) urlParams.append("environment", environmentName);
|
|
333
|
-
if (options.start && options.end) {
|
|
334
|
-
urlParams.set("start", options.start);
|
|
335
|
-
urlParams.set("end", options.end);
|
|
336
|
-
} else if (options.statsPeriod) urlParams.set("statsPeriod", options.statsPeriod);
|
|
337
|
-
const baseUrl = getSentryWebBaseUrl(host, organizationSlug, "/explore/conversations/", protocol);
|
|
338
|
-
const queryString = urlParams.toString();
|
|
339
|
-
return queryString ? `${baseUrl}?${queryString}` : baseUrl;
|
|
340
|
-
}
|
|
341
|
-
function getProfileUrl(host, organizationSlug, projectSlug, profileId, protocol = "https") {
|
|
342
|
-
return getSentryWebBaseUrl(host, organizationSlug, `/explore/profiling/profile/${projectSlug}/${profileId}/flamegraph/`, protocol);
|
|
343
|
-
}
|
|
344
|
-
function getContinuousProfileUrl(host, organizationSlug, projectSlug, options, protocol = "https") {
|
|
345
|
-
const url = new URL(getSentryWebBaseUrl(host, organizationSlug, `/explore/profiling/profile/${projectSlug}/flamegraph/`, protocol));
|
|
346
|
-
url.searchParams.set("profilerId", options.profilerId);
|
|
347
|
-
url.searchParams.set("start", options.start);
|
|
348
|
-
url.searchParams.set("end", options.end);
|
|
349
|
-
return url.toString();
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* Internal validation function that checks if a SENTRY_HOST value contains only hostname (no protocol).
|
|
353
|
-
* Throws an error if validation fails instead of exiting the process.
|
|
354
|
-
*
|
|
355
|
-
* @param host The hostname to validate
|
|
356
|
-
* @throws {Error} If the host contains a protocol
|
|
357
|
-
*/
|
|
358
|
-
function _validateSentryHostInternal(host) {
|
|
359
|
-
if (host.startsWith("http://") || host.startsWith("https://")) throw new Error("SENTRY_HOST should only contain a hostname (e.g., sentry.example.com). Use SENTRY_URL if you want to provide a full URL.");
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* Internal validation function that checks if a SENTRY_URL value is a valid HTTPS URL and extracts the hostname.
|
|
363
|
-
* Throws an error if validation fails instead of exiting the process.
|
|
364
|
-
*
|
|
365
|
-
* @param url The HTTPS URL to validate and parse
|
|
366
|
-
* @returns The extracted hostname from the URL
|
|
367
|
-
* @throws {Error} If the URL is invalid or not HTTPS
|
|
368
|
-
*/
|
|
369
|
-
function _validateAndParseSentryUrlInternal(url) {
|
|
370
|
-
if (!url.startsWith("https://")) throw new Error("SENTRY_URL must be a full HTTPS URL (e.g., https://sentry.example.com).");
|
|
371
|
-
try {
|
|
372
|
-
const parsedUrl = new URL(url);
|
|
373
|
-
return parsedUrl.host;
|
|
374
|
-
} catch (error) {
|
|
375
|
-
throw new Error("SENTRY_URL must be a valid HTTPS URL (e.g., https://sentry.example.com).");
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Validates that a SENTRY_HOST value contains only hostname (no protocol).
|
|
380
|
-
* Throws an error instead of exiting the process (for testing).
|
|
381
|
-
*
|
|
382
|
-
* @param host The hostname to validate
|
|
383
|
-
* @throws {Error} If the host contains a protocol
|
|
384
|
-
*/
|
|
385
|
-
function validateSentryHostThrows(host) {
|
|
386
|
-
_validateSentryHostInternal(host);
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Validates that a SENTRY_URL value is a valid HTTPS URL and extracts the hostname.
|
|
390
|
-
* Throws an error instead of exiting the process (for testing).
|
|
391
|
-
*
|
|
392
|
-
* @param url The HTTPS URL to validate and parse
|
|
393
|
-
* @returns The extracted hostname from the URL
|
|
394
|
-
* @throws {Error} If the URL is invalid or not HTTPS
|
|
395
|
-
*/
|
|
396
|
-
function validateAndParseSentryUrlThrows(url) {
|
|
397
|
-
return _validateAndParseSentryUrlInternal(url);
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Validates that the provided OpenAI base URL is a valid HTTP(S) URL and returns a normalized string.
|
|
401
|
-
*
|
|
402
|
-
* @param url The URL to validate and normalize
|
|
403
|
-
* @returns The normalized URL string
|
|
404
|
-
* @throws {Error} If the URL is empty, invalid, or uses an unsupported protocol
|
|
405
|
-
*/
|
|
406
|
-
function validateOpenAiBaseUrlThrows(url) {
|
|
407
|
-
const trimmed = url.trim();
|
|
408
|
-
if (trimmed.length === 0) throw new Error("OPENAI base URL must not be empty.");
|
|
409
|
-
let parsed;
|
|
410
|
-
try {
|
|
411
|
-
parsed = new URL(trimmed);
|
|
412
|
-
} catch (error) {
|
|
413
|
-
throw new Error("OPENAI base URL must be a valid HTTP or HTTPS URL (e.g., https://example.com/v1).", { cause: error });
|
|
414
|
-
}
|
|
415
|
-
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") throw new Error("OPENAI base URL must use http or https scheme (e.g., https://example.com/v1).");
|
|
416
|
-
return parsed.toString();
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
//#endregion
|
|
420
|
-
//#region ../mcp-core/dist/scopes.js
|
|
421
|
-
const SCOPES = {
|
|
422
|
-
"org:read": "Read organization data",
|
|
423
|
-
"project:write": "Write project data",
|
|
424
|
-
"team:write": "Write team data",
|
|
425
|
-
"event:write": "Write event data",
|
|
426
|
-
"alerts:write": "Write alert rules"
|
|
427
|
-
};
|
|
428
|
-
|
|
429
|
-
//#endregion
|
|
430
|
-
//#region src/auth/constants.ts
|
|
431
|
-
/**
|
|
432
|
-
* Public OAuth app registered on sentry.io for the stdio device code flow.
|
|
433
|
-
* No client secret — device code grant is a public client flow.
|
|
434
|
-
* The Cloudflare transport uses a separate OAuth app with a secret.
|
|
435
|
-
* Override via SENTRY_CLIENT_ID environment variable.
|
|
436
|
-
* See docs/operations/stdio-auth.md for the full credential architecture.
|
|
437
|
-
*/
|
|
438
|
-
const DEFAULT_SENTRY_CLIENT_ID = "0acbeba7d07d58076dd7dbde8cea2fed8ab525ce3713bda604988009ab35d765";
|
|
439
|
-
const DEVICE_CODE_ENDPOINT = "/oauth/device/code/";
|
|
440
|
-
const TOKEN_ENDPOINT = "/oauth/token/";
|
|
441
|
-
const DEVICE_CODE_SCOPES = Object.keys(SCOPES).join(" ");
|
|
442
|
-
/** Interval increment on slow_down response (RFC 8628). */
|
|
443
|
-
const SLOW_DOWN_INCREMENT_SEC = 5;
|
|
444
|
-
/**
|
|
445
|
-
* OAuth endpoints live on sentry.io regardless of regional host.
|
|
446
|
-
* Always use this as the host for device code and token requests.
|
|
447
|
-
*/
|
|
448
|
-
const OAUTH_HOST = "sentry.io";
|
|
449
|
-
|
|
450
|
-
//#endregion
|
|
451
|
-
export { DEFAULT_SENTRY_CLIENT_ID, DEVICE_CODE_ENDPOINT, DEVICE_CODE_SCOPES, OAUTH_HOST, PUBLIC_EVENTS_DATASETS, SLOW_DOWN_INCREMENT_SEC, TOKEN_ENDPOINT, extractConversationIdFromSearchQuery, getAIConversationUrl, getAIConversationsUrl, getContinuousProfileUrl, getDashboardUrl, getIssueUrl, getIssuesSearchUrl, getMonitorUrl, getPreprodSnapshotUrl, getProfileUrl, getProfilingExplorerUrl, getReleaseUrl, getReplayUrl, getReplaysSearchUrl, getTraceMetricsExploreUrl, getTraceUrl, getUptimeMonitorUrl, isMetricsDataset, isProfilesDataset, isPublicSentryHost, isSentryHost, normalizeEventsDataset, validateAndParseSentryUrlThrows, validateOpenAiBaseUrlThrows, validateSentryHostThrows };
|
|
452
|
-
//# sourceMappingURL=constants-CGu8w21D.js.map
|