tracer-sh 0.2.0 → 0.2.2
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 +11 -1
- package/bin/tracer.mjs +58 -0
- package/package.json +7 -2
- package/packages/server/dist/{chunk-ANVLQIEK.js → chunk-OTYSD6PF.js} +1 -0
- package/packages/server/dist/{domain-knowledge-5JOEEXGN.js → domain-knowledge-5ZUPRLNB.js} +1 -1
- package/packages/server/dist/index.js +545 -54
- package/packages/web/dist/assets/{SearchableSelect-Dguq3D_c.js → SearchableSelect-CGq3RJiX.js} +1 -1
- package/packages/web/dist/assets/{Settings-BRNO62Ki.js → Settings-CSYYBQF1.js} +1 -1
- package/packages/web/dist/assets/{highlighted-body-OFNGDK62-C8dxSyKj.js → highlighted-body-OFNGDK62-CnIKGHSu.js} +1 -1
- package/packages/web/dist/assets/index-_7TPlTNo.js +48 -0
- package/packages/web/dist/assets/{mermaid-GHXKKRXX-ga384H0G.js → mermaid-GHXKKRXX-D9p_GS3a.js} +3 -3
- package/packages/web/dist/index.html +1 -1
- package/packages/web/dist/assets/index-CFCII-7S.js +0 -48
package/README.md
CHANGED
|
@@ -66,9 +66,19 @@ tracer-sh
|
|
|
66
66
|
|
|
67
67
|
Open `http://localhost:3579`, go to **Settings** to add your API keys and choose an LLM — done.
|
|
68
68
|
|
|
69
|
+
## Headless / CLI
|
|
70
|
+
|
|
71
|
+
Run an investigation from the terminal and get back the final analysis — so other tools and agents (including Claude Code) can drive Tracer:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
tracer-sh analyze "Why did checkout error rate spike after 14:00 UTC?"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Continue a prior run with `--session <id>`; pass `--json` for the full response (session id, queries, usage). Requires a running server.
|
|
78
|
+
|
|
69
79
|
## Supported Providers
|
|
70
80
|
|
|
71
|
-
**Data:** New Relic (NRQL
|
|
81
|
+
**Data:** New Relic (NRQL), Google Cloud (Logs, Traces, Metrics, Errors), PostHog (HogQL)
|
|
72
82
|
|
|
73
83
|
**LLM:** Anthropic (Claude), Google (Gemini)
|
|
74
84
|
|
package/bin/tracer.mjs
CHANGED
|
@@ -10,6 +10,64 @@ const serverPath = resolve(__dirname, "../packages/server/dist/index.js");
|
|
|
10
10
|
// Must match RESTART_EXIT_CODE in packages/server/src/updater.ts
|
|
11
11
|
const RESTART_EXIT_CODE = 75;
|
|
12
12
|
|
|
13
|
+
// `tracer analyze "<message>" [--session <id>] [--provider <name>] [--json]`
|
|
14
|
+
// Runs the investigation agent on the already-running local server and prints
|
|
15
|
+
// the final analysis. Lets other local agents (e.g. Claude Code) drive Tracer.
|
|
16
|
+
if (process.argv[2] === "analyze") {
|
|
17
|
+
await runAnalyze(process.argv.slice(3));
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function runAnalyze(args) {
|
|
22
|
+
let message;
|
|
23
|
+
let sessionId;
|
|
24
|
+
let provider;
|
|
25
|
+
let asJson = false;
|
|
26
|
+
|
|
27
|
+
for (let i = 0; i < args.length; i++) {
|
|
28
|
+
const a = args[i];
|
|
29
|
+
if (a === "--json") asJson = true;
|
|
30
|
+
else if (a === "--session" || a === "-s") sessionId = args[++i];
|
|
31
|
+
else if (a === "--provider" || a === "-p") provider = args[++i];
|
|
32
|
+
else if (message === undefined) message = a;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!message) {
|
|
36
|
+
console.error('Usage: tracer-sh analyze "<message>" [--session <id>] [--provider <name>] [--json]');
|
|
37
|
+
process.exit(2);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const host = process.env.TRACER_HOST || "127.0.0.1";
|
|
41
|
+
const port = process.env.TRACER_PORT || "3579";
|
|
42
|
+
const url = `http://${host}:${port}/api/v1/analyze`;
|
|
43
|
+
|
|
44
|
+
let res;
|
|
45
|
+
try {
|
|
46
|
+
res = await fetch(url, {
|
|
47
|
+
method: "POST",
|
|
48
|
+
headers: { "content-type": "application/json" },
|
|
49
|
+
body: JSON.stringify({ message, sessionId, provider }),
|
|
50
|
+
});
|
|
51
|
+
} catch {
|
|
52
|
+
console.error(`Could not reach Tracer at ${url}. Is the server running? Start it with: tracer-sh`);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const data = await res.json().catch(() => ({}));
|
|
57
|
+
|
|
58
|
+
if (!res.ok || data.status === "error") {
|
|
59
|
+
console.error(`Error: ${data.error || res.statusText}`);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (asJson) {
|
|
64
|
+
process.stdout.write(JSON.stringify(data, null, 2) + "\n");
|
|
65
|
+
} else {
|
|
66
|
+
process.stdout.write((data.analysis || "") + "\n");
|
|
67
|
+
console.error(`session ${data.sessionId}${data.model ? ` · ${data.model}` : ""}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
13
71
|
const banner = `
|
|
14
72
|
╔═══════════════════════════════════╗
|
|
15
73
|
║ Tracer Debug Platform ║
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tracer-sh",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Local-first debugging & analysis platform",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -34,7 +34,12 @@
|
|
|
34
34
|
"onlyBuiltDependencies": [
|
|
35
35
|
"better-sqlite3",
|
|
36
36
|
"esbuild"
|
|
37
|
-
]
|
|
37
|
+
],
|
|
38
|
+
"overrides": {
|
|
39
|
+
"mermaid": "^11.15.0",
|
|
40
|
+
"postcss": "^8.5.10",
|
|
41
|
+
"uuid": "^11.1.1"
|
|
42
|
+
}
|
|
38
43
|
},
|
|
39
44
|
"devDependencies": {
|
|
40
45
|
"concurrently": "^9.2.1",
|
|
@@ -12,6 +12,7 @@ HogQL is PostHog's SQL dialect (ClickHouse SQL under the hood). Queries read fro
|
|
|
12
12
|
- \`SELECT ... FROM events\` \u2014 the main table. Standard SQL: \`WHERE\`, \`GROUP BY\`, \`HAVING\`, \`ORDER BY\`, \`LIMIT\`. Unlike NRQL, HogQL HAS \`GROUP BY\` and \`DISTINCT\`.
|
|
13
13
|
- **LIMIT:** the API applies \`LIMIT 100\` when you omit one. For exploration set an explicit small \`LIMIT\` (10); increase to 20-50 only when needed; never start with 100+. Max for a personal-API-key request is 50,000. **OFFSET pagination is rejected** for personal API keys \u2014 paginate with a \`timestamp\` keyset filter instead.
|
|
14
14
|
- Time filtering uses \`timestamp\` with ClickHouse intervals: \`WHERE timestamp >= now() - interval 24 hour\`. Also \`toStartOfDay(now())\`, \`toDateTime('2024-01-15 14:00:00')\`.
|
|
15
|
+
- **Trends over time render as a line chart.** For any "over time" / "trend" / "by hour|day" question, \`GROUP BY\` a time bucket \u2014 \`toStartOfMinute|Hour|Day(timestamp)\` \u2014 select it as the FIRST column alongside your metric(s), and \`ORDER BY\` it. One numeric metric (optionally one breakdown column for multiple lines) plots as a timeseries; otherwise results show as a table. Example: \`SELECT toStartOfHour(timestamp) AS t, count() AS events FROM events WHERE timestamp >= now() - interval 24 hour GROUP BY t ORDER BY t\`.
|
|
15
16
|
|
|
16
17
|
### Properties
|
|
17
18
|
- Event properties: \`properties.$current_url\`, \`properties.$browser\`, or custom \`properties.my_prop\`. PostHog auto-captured properties are prefixed with \`$\`.
|