The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
devtesting updated to be self runnable
ddux2e85b654dc71
diff --git a/examples/devtesting-embedded/frontend/index.html b/examples/devtesting-embedded/frontend/index.htmlnew file mode 100644index 00000000..e583d0bf--- /dev/null+++ b/examples/devtesting-embedded/frontend/index.html@@ -0,0 +1,45 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Distributed Trace Test (vite dev)</title>+ <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>+ <style>+ body { font-family: system-ui, -apple-system, sans-serif; max-width: 700px; margin: 40px auto; padding: 0 20px; }+ h1 { margin-bottom: 8px; }+ p { color: #555; line-height: 1.5; }+ code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 13px; }+ .buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }+ .btn { color: #fff; border: none; padding: 10px 18px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 600; }+ .btn:hover { opacity: 0.9; }+ .btn-error { background: #dc2626; }+ .btn-success { background: #16a34a; }+ .btn-logs { background: #2563eb; }+ .btn-network { background: #7c3aed; }+ .btn-clear { background: #6b7280; }+ #log { background: #111; color: #0f0; padding: 16px; border-radius: 8px; font-family: monospace; font-size: 13px; min-height: 200px; white-space: pre-wrap; }+ </style>+</head>+<body>+ <h1>Distributed Trace Test</h1>+ <p>+ Served by vite dev (HMR enabled). Calls to <code>/api/test-*</code>+ are proxied to the Go demo router on <code>localhost:8080</code>.+ The SDK posts to <code>localhost:8082/api/report</code> directly+ (cross-origin, CORS-allowed).+ </p>++ <div class="buttons">+ <button class="btn btn-error" id="btn-error">Call Backend Error Endpoint</button>+ <button class="btn btn-success" id="btn-success">Call Backend Success Endpoint</button>+ <button class="btn btn-logs" id="btn-logs">Emit Console Logs</button>+ <button class="btn btn-network" id="btn-network">Fire Network Requests</button>+ <button class="btn btn-clear" id="btn-clear">Clear Log</button>+ </div>++ <div id="log">Waiting for actions...</div>++ <script type="module" src="/src/app.js"></script>+</body>+</html>diff --git a/examples/devtesting-embedded/frontend/package.json b/examples/devtesting-embedded/frontend/package.jsonindex 7204d244..9f9a564a 100644--- a/examples/devtesting-embedded/frontend/package.json+++ b/examples/devtesting-embedded/frontend/package.json@@ -4,7 +4,8 @@"type": "module","scripts": {"build": "vite build",- "dev": "vite build --watch"+ "dev": "vite build --watch",+ "dev:serve": "vite"},"dependencies": {"@tracewayapp/jquery": "file:../../../../js-client/packages/jquery"diff --git a/examples/devtesting-embedded/frontend/src/app.js b/examples/devtesting-embedded/frontend/src/app.jsindex aafcd26e..2a1de3ed 100644--- a/examples/devtesting-embedded/frontend/src/app.js+++ b/examples/devtesting-embedded/frontend/src/app.js@@ -1,8 +1,4 @@-import {- init,- setAttribute,- setAttributes,-} from "@tracewayapp/jquery";+import { init, setAttribute, setAttributes } from "@tracewayapp/jquery";init("frontend-dev-token@http://localhost:8082/api/report", {recordAllSessions: true,@@ -50,7 +46,10 @@ $(function () {(traceId || "not present"),);if (jqXHR.status >= 400) {- addLog("Exception auto-captured by @tracewayapp/jquery with distributedTraceId=" + traceId);+ addLog(+ "Exception auto-captured by @tracewayapp/jquery with distributedTraceId=" ++ traceId,+ );}},});@@ -84,16 +83,21 @@ $(function () {});$("#btn-network").on("click", function () {- addLog("Firing 4 network requests (mix of fetch + jQuery, success + 404) ...");+ addLog(+ "Firing 4 network requests (mix of fetch + jQuery, success + 404) ...",+ );- fetch("/api/test-success")- .then(function (r) { addLog("fetch GET /api/test-success -> " + r.status); });+ fetch("/api/test-success").then(function (r) {+ addLog("fetch GET /api/test-success -> " + r.status);+ });- fetch("/api/test-log-levels")- .then(function (r) { addLog("fetch GET /api/test-log-levels -> " + r.status); });+ fetch("/api/test-log-levels").then(function (r) {+ addLog("fetch GET /api/test-log-levels -> " + r.status);+ });- fetch("/api/does-not-exist")- .then(function (r) { addLog("fetch GET /api/does-not-exist -> " + r.status); });+ fetch("/api/does-not-exist").then(function (r) {+ addLog("fetch GET /api/does-not-exist -> " + r.status);+ });$.ajax({url: "/api/test-spans-with-logs",diff --git a/examples/devtesting-embedded/frontend/vite.config.js b/examples/devtesting-embedded/frontend/vite.config.jsindex a96e800d..f8b6428c 100644--- a/examples/devtesting-embedded/frontend/vite.config.js+++ b/examples/devtesting-embedded/frontend/vite.config.js@@ -1,6 +1,10 @@import { defineConfig } from "vite";import { resolve } from "path";+// `vite build` (used by `npm run build` / `npm run dev`) keeps the existing+// library-mode bundling so the Go binary's go:embed snapshot of static/app.js+// keeps working. `vite` (used by `npm run dev:serve`) ignores `build.lib` and+// boots a regular dev server that picks up index.html at the project root.export default defineConfig({build: {lib: {@@ -12,4 +16,18 @@ export default defineConfig({outDir: resolve(__dirname, "../static"),emptyOutDir: false,},+ server: {+ port: 5180,+ strictPort: true,+ proxy: {+ // Forward demo test endpoints (/api/test-error, /api/test-success, etc.)+ // to the Go demo router. The SDK posts to an absolute URL on :8082 so+ // it bypasses this proxy entirely; only relative /api/* calls from the+ // page hit it.+ "/api": {+ target: "http://localhost:8080",+ changeOrigin: true,+ },+ },+ },});