The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
feat: Docs updated for custom metrics and for otel
ddux9dc5a790c26e
diff --git a/docs/pages/client/node-sdk/metrics.mdx b/docs/pages/client/node-sdk/metrics.mdxindex 233ab103..c4aa422d 100644--- a/docs/pages/client/node-sdk/metrics.mdx+++ b/docs/pages/client/node-sdk/metrics.mdx@@ -1,5 +1,7 @@# Metrics+See [Metrics concepts](/learn/metrics) for how metrics appear in the dashboard.+Capture custom metrics to track application-specific values over time.## captureMetricdiff --git a/docs/pages/client/otel/index.mdx b/docs/pages/client/otel/index.mdxindex 05b701fd..07ad7c95 100644--- a/docs/pages/client/otel/index.mdx+++ b/docs/pages/client/otel/index.mdx@@ -1,55 +1,45 @@# OpenTelemetry Integration-Send traces and metrics from any OpenTelemetry-instrumented application to Traceway using the standard OTLP/HTTP protocol.+Send traces and metrics from any OpenTelemetry-instrumented application to Traceway — no vendor SDK required.-## Supported Protocols+[OpenTelemetry](https://opentelemetry.io/) (OTel) is the industry-standard, vendor-neutral framework for collecting telemetry. If your app already uses OTel, you can point it at Traceway with a few lines of config. If you're starting fresh, any OTel SDK will work.-| Protocol | Content-Type |-|----------|-------------|-| Protobuf | `application/x-protobuf` or `application/protobuf` |-| JSON | `application/json` |+## How It Works-Both formats follow the [OTLP/HTTP specification](https://opentelemetry.io/docs/specs/otlp/#otlphttp). Gzip compression is supported via the `Content-Encoding: gzip` header.+1. **Instrument your app** with an OpenTelemetry SDK (or auto-instrumentation).+2. **Export via OTLP/HTTP** — configure the SDK (or an OTel Collector) to send data to your Traceway instance.+3. **Traceway maps the data** — spans become endpoints and traces; metrics appear on your dashboards.-## Endpoints+## Supported Languages-| Method | Path | Description |-|--------|------|-------------|-| POST | `/api/otel/v1/traces` | Ingest spans and trace data |-| POST | `/api/otel/v1/metrics` | Ingest metric data |+Any language with an OTel SDK can export to Traceway. Here are the most common ones:-Maximum request body size is 10MB.+| Language | OTel SDK | Install |+|----------|----------|---------|+| Java | [opentelemetry-java](https://github.com/open-telemetry/opentelemetry-java) | [Agent JAR](https://opentelemetry.io/docs/zero-code/java/agent/) |+| Python | [opentelemetry-python](https://github.com/open-telemetry/opentelemetry-python) | `pip install opentelemetry-sdk` |+| C# / .NET | [opentelemetry-dotnet](https://github.com/open-telemetry/opentelemetry-dotnet) | `dotnet add package OpenTelemetry` |+| Go | [opentelemetry-go](https://github.com/open-telemetry/opentelemetry-go) | `go get go.opentelemetry.io/otel` |+| Node.js | [opentelemetry-js](https://github.com/open-telemetry/opentelemetry-js) | `npm install @opentelemetry/sdk-node` |+| Cloudflare Workers | [workers-sdk](https://developers.cloudflare.com/workers/observability/otel/) | Built-in — see [Cloudflare guide](/client/otel-cloudflare) |-## Authentication+## Configuration-All requests must include a Bearer token in the `Authorization` header. Use your project token from the Traceway dashboard.+| Setting | Value |+|---------|-------|+| **Endpoint** | `https://<your-instance>/api/otel` |+| **Traces path** | `/v1/traces` |+| **Metrics path** | `/v1/metrics` |+| **Auth header** | `Authorization: Bearer <project_token>` |+| **Protocol** | OTLP/HTTP (Protobuf or JSON) |+| **Compression** | Gzip supported (`Content-Encoding: gzip`) |+| **Max body size** | 10 MB |-```-Authorization: Bearer <project_token>-```--## Quick Start with OTel Collector--Configure the OpenTelemetry Collector to export to Traceway:--```yaml-exporters:- otlphttp:- endpoint: "https://your-traceway-instance.com/api/otel"- headers:- Authorization: "Bearer your-project-token"--service:- pipelines:- traces:- exporters: [otlphttp]- metrics:- exporters: [otlphttp]-```+## Quick Start: Direct SDK Export-## Quick Start with OTel SDK+The simplest setup — your app exports directly to Traceway with no extra infrastructure.-Configure an OpenTelemetry SDK to export directly to Traceway. Here's an example using the Node.js SDK:+Here's a Node.js example:```typescriptimport { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";@@ -70,6 +60,33 @@ const metricExporter = new OTLPMetricExporter({});```+The same pattern applies to any language — set the OTLP/HTTP endpoint and the `Authorization` header in your exporter config.++## Quick Start: OTel Collector++If you already run an [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/) or want a central pipeline that fans out to multiple backends, you can route data through it. **This is optional** — the direct SDK export above works without a Collector.++```yaml+exporters:+ otlphttp:+ endpoint: "https://your-traceway-instance.com/api/otel"+ headers:+ Authorization: "Bearer your-project-token"++service:+ pipelines:+ traces:+ exporters: [otlphttp]+ metrics:+ exporters: [otlphttp]+```++## Connection Page++Your Traceway dashboard includes a **Connection** page with a ready-made config snippet and your project token. Go to **Connection** in the sidebar to grab it.+++## Next Steps- [Traces](/client/otel/traces) — how OTel spans map to Traceway conceptsdiff --git a/docs/pages/client/sdk/metrics.mdx b/docs/pages/client/sdk/metrics.mdxindex eecdfd1c..02cb71b2 100644--- a/docs/pages/client/sdk/metrics.mdx+++ b/docs/pages/client/sdk/metrics.mdx@@ -48,7 +48,43 @@ traceway.CaptureMetric("active.users", float64(activeUsers))traceway.CaptureMetric("orders.per_minute", orderRate)```-Custom metrics are not currently displayed on the dashboard.+## CaptureMetricWithTags++Attach key-value tags to a metric point for filtering and grouping in the dashboard:++```go+traceway.CaptureMetricWithTags("queue.depth", float64(len(queue)), map[string]string{+ "queue_name": "emails",+ "priority": "high",+})++traceway.CaptureMetricWithTags("http.external_ms", latency, map[string]string{+ "service": "stripe",+ "region": "us-east-1",+})++traceway.CaptureMetricWithTags("cache.hit_rate", hitRate, map[string]string{+ "cache": "redis",+})+```++## Tags++Tags are key-value pairs attached to individual metric points. In the dashboard, you can:++- **Filter** to specific tag values (e.g. show only `queue_name = emails`)+- **Group by** a tag to split metrics into separate series (e.g. one line per `server_name`)++Common tags:++| Tag | Example |+| -------------- | ------------------------ |+| `server_name` | `"web-1"`, `"web-2"` |+| `region` | `"us-east-1"` |+| `queue_name` | `"emails"`, `"payments"`|+| `environment` | `"production"` |++If you don't need tags, use `CaptureMetric` — it records the same data without any tag metadata.## What to Look Fordiff --git a/docs/pages/learn/_meta.json b/docs/pages/learn/_meta.jsonindex 8559547e..a673cadd 100644--- a/docs/pages/learn/_meta.json+++ b/docs/pages/learn/_meta.json@@ -4,5 +4,6 @@"traces": "Traces","issues": "Issues","attributes": "Attributes",- "spans": "Spans"+ "spans": "Spans",+ "metrics": "Metrics"}diff --git a/docs/pages/learn/data-flow.mdx b/docs/pages/learn/data-flow.mdxindex 88b313df..451bbd63 100644--- a/docs/pages/learn/data-flow.mdx+++ b/docs/pages/learn/data-flow.mdx@@ -21,7 +21,10 @@ Here's how the concepts connect in a typical scheduled/async task:## Metrics Flow-1. **Background** → System **Metrics** collected every 30 seconds (Automatically by the client SDK for your framework)+1. **System metrics collected** → CPU, memory, goroutines, and GC stats are captured automatically every 30 seconds (Automatically by the client SDK)+2. **Custom metrics captured** → Your code calls `CaptureMetric` or `CaptureMetricWithTags` to record application-specific measurements with optional tags+3. **Batched and uploaded** → All metrics are batched, compressed, and sent to Traceway with the next collection frame+4. **Displayed on dashboard** → Metrics appear in configurable widget groups with line charts, area charts, bar charts, single values, and tables — filterable and groupable by tags## After the data collectiondiff --git a/docs/pages/learn/index.mdx b/docs/pages/learn/index.mdxindex c81347b0..4e7a4fa9 100644--- a/docs/pages/learn/index.mdx+++ b/docs/pages/learn/index.mdx@@ -33,4 +33,10 @@ Attributes flow from global scope to per-request scope. [Learn more →](/learn/Spans display as a timeline within a trace in the dashboard. [Learn more →](/learn/spans)+### Metrics++**Metrics** are time-series measurements of your application's health. System metrics (CPU, memory, goroutines) are collected automatically, and you can capture custom metrics with optional tags for filtering and grouping.++Metrics are displayed on a configurable dashboard with widget groups and multiple chart types. [Learn more →](/learn/metrics)+See [Data Flow](/learn/data-flow) for how these concepts connect during request processing, task execution, and metrics collection.diff --git a/docs/pages/learn/metrics.mdx b/docs/pages/learn/metrics.mdxnew file mode 100644index 00000000..90dcd3e4--- /dev/null+++ b/docs/pages/learn/metrics.mdx@@ -0,0 +1,100 @@+# Metrics++Metrics are time-series measurements that track your application's health and behavior over time. The Traceway SDKs automatically collect system metrics (CPU, memory, goroutines), and you can capture custom metrics for anything specific to your application. For OpenTelemetry, the automatic metrics depend on which SDK and instrumentation libraries you use.++## Metric Structure++Each metric point contains:++| Field | Description |+| --------- | ------------------------------------------------- |+| Name | Dot-separated identifier (e.g. `cpu.used_pcnt`) |+| Value | Numeric measurement (`float64`) |+| Tags | Key-value metadata (e.g. `server_name: "web-1"`) |+| Timestamp | When the measurement was taken |++## Automatic vs Custom Metrics++**Automatic metrics** are collected without any code changes. The Traceway Go and Node.js SDKs capture CPU usage, memory consumption, goroutine count (Go), and GC statistics at a regular interval (default: 30 seconds). For OpenTelemetry, the available automatic metrics depend on your SDK and instrumentation libraries — for example, the Go OTel runtime instrumentation provides goroutine and memory metrics, while the Node.js OTel runtime instrumentation provides event loop and heap metrics.++**Custom metrics** are captured in your application code using `CaptureMetric` or `CaptureMetricWithTags`. Use these for business metrics (orders per minute), resource metrics (queue depth), or performance metrics (external API latency).++See the SDK-specific pages for API details: [Go SDK](/client/sdk/metrics) | [Node.js SDK](/client/node-sdk/metrics)++## Tags++Tags are key-value pairs attached to individual metric points. They enable filtering and grouping in the dashboard.++Common tags include:++| Tag | Example Values | Use Case |+| -------------- | ----------------------- | ------------------------------- |+| `server_name` | `web-1`, `web-2` | Compare metrics across servers |+| `region` | `us-east-1`, `eu-west` | Regional breakdowns |+| `queue_name` | `emails`, `payments` | Per-queue monitoring |+| `environment` | `production`, `staging` | Environment comparison |++Tags are captured via `CaptureMetricWithTags` in the Go SDK, or as resource attributes in OpenTelemetry.++## The Metrics Dashboard++The metrics dashboard organizes your data into **widget groups** and **widgets**.++<img src="/metrics.png" alt="Metrics Dashboard" style={{ maxWidth: '100%', height: 'auto', marginTop: '16px', borderRadius: '8px', border: '1px solid #e5e7eb' }} />++### Widget Groups++Widget groups are named tabs that organize related widgets together. When you create a Go or Node.js project, default groups are created automatically with system metric widgets. OpenTelemetry projects start with a blank dashboard — you create groups as needed.++You can create, rename, and delete widget groups from the dashboard.++### Widgets++Widgets are individual chart cards within a group. Each widget displays one or more metric sources as a visualization.++## Widget Types++| Type | Best For |+| ------------ | -------------------------------------------------- |+| Line Chart | Trends over time (CPU usage, request rate) |+| Area Chart | Volume over time with filled area |+| Bar Chart | Comparing values across time intervals |+| Single Value | Current or aggregated value at a glance |+| Table | Tabular view of metric values |++## Widget Configuration++Each widget contains one or more **sources**. Each source specifies:++| Setting | Description |+| ------------ | --------------------------------------------------------------------------- |+| Metric Name | Selected from auto-discovered metrics in your project |+| Aggregation | How values are combined: `avg`, `min`, `max`, `sum`, or `count` |+| Tag Filters | Narrow to specific tag values (e.g. `server_name = web-1`) |+| Group By | Split into separate series per tag value (e.g. one line per `server_name`) |++Multiple sources on the same widget overlay their series on the same chart, useful for comparing related metrics side by side.++<img src="/new-widget-dialog.png" alt="Widget configuration dialog" style={{ maxWidth: '100%', height: 'auto', marginTop: '16px', borderRadius: '8px', border: '1px solid #e5e7eb' }} />++## Time Range++The dashboard supports preset time ranges (5m, 15m, 30m, 1h, 3h, 6h, 12h, 24h, 3d, 7d, 1M, 3M) and custom date/time ranges.++The backend automatically selects the optimal storage resolution based on the selected range:++| Range | Resolution |+| ------------- | --------------- |+| Up to 3 hours | Raw data points |+| 3h to 24h | 1-minute aggregates |+| 24h to 7 days | 1-hour aggregates |+| Over 7 days | 1-day aggregates |++This keeps queries fast regardless of the time window.++## Creating Your First Dashboard++1. **Create a widget group** — Click the **+** button next to the existing tabs and give it a name+2. **Add a widget** — Click **Add Widget**, pick a metric from the dropdown, choose an aggregation, and optionally add tag filters or a group-by+3. **Adjust the time range** — Use the preset buttons or select a custom range to see the data window you need+4. **Interact** — Hover over data points for exact values, drag-select a region to zoom in, and use the widget menu to move, edit, or delete widgetsdiff --git a/docs/public/connection-otel.png b/docs/public/connection-otel.pngnew file mode 100644index 00000000..24f1da3aBinary files /dev/null and b/docs/public/connection-otel.png differdiff --git a/docs/public/metrics.png b/docs/public/metrics.pngindex bef0b17d..aa148551 100644Binary files a/docs/public/metrics.png and b/docs/public/metrics.png differdiff --git a/docs/public/new-widget-dialog.png b/docs/public/new-widget-dialog.pngnew file mode 100644index 00000000..9f3d9b19Binary files /dev/null and b/docs/public/new-widget-dialog.png differdiff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelteindex 421d7f69..0b79e061 100644--- a/frontend/src/routes/+page.svelte+++ b/frontend/src/routes/+page.svelte@@ -27,7 +27,8 @@type ProjectWithToken,isFrontendFramework,isJsFramework,- isCloudflareFramework+ isCloudflareFramework,+ isOtelFramework} from '$lib/state/projects.svelte';import { setSortState } from '$lib/utils/sort-storage';import { Button } from '$lib/components/ui/button';@@ -36,6 +37,7 @@import javascript from 'svelte-highlight/languages/javascript';import bash from 'svelte-highlight/languages/bash';import { themeState } from '$lib/state/theme.svelte';+ import yaml from 'svelte-highlight/languages/yaml';import 'svelte-highlight/styles/github-dark.css';import {getFrameworkCode,@@ -127,8 +129,12 @@const testingRouteCode = $derived(getTestingRouteCode(projectWithToken?.framework));const testingRouteCode2 = $derived(getTestingRouteCode2(projectWithToken?.framework));- const isCloudflare = $derived(projectWithToken ? isCloudflareFramework(projectWithToken.framework) : false);- const cfOtelEndpoint = $derived(projectWithToken ? `${projectWithToken.backendUrl}/api/otel/v1/traces` : '');+ const isCloudflare = $derived(+ projectWithToken ? isCloudflareFramework(projectWithToken.framework) : false+ );+ const cfOtelEndpoint = $derived(+ projectWithToken ? `${projectWithToken.backendUrl}/api/otel/v1/traces` : ''+ );const cfAuthHeader = $derived(projectWithToken ? `Bearer ${projectWithToken.token}` : '');const cfWranglerConfig = $derived(`{"observability": {@@ -150,6 +156,44 @@let copiedCfWrangler = $state(false);let copiedCfDeploy = $state(false);+ const isOtel = $derived(projectWithToken ? isOtelFramework(projectWithToken.framework) : false);+ const otelBaseEndpoint = $derived(+ projectWithToken ? `${projectWithToken.backendUrl}/api/otel` : ''+ );+ const otelAuthHeader = $derived(projectWithToken ? `Bearer ${projectWithToken.token}` : '');+ const otelCollectorConfig = $derived(+ projectWithToken+ ? `exporters:+ otlphttp:+ endpoint: "${projectWithToken.backendUrl}/api/otel"+ headers:+ Authorization: "Bearer ${projectWithToken.token}"++service:+ pipelines:+ traces:+ exporters: [otlphttp]+ metrics:+ exporters: [otlphttp]`+ : ''+ );++ const otelSdks = [+ {+ lang: 'Node.js',+ cmd: 'npm install @opentelemetry/sdk-node @opentelemetry/exporter-trace-otlp-http @opentelemetry/exporter-metrics-otlp-http'+ },+ { lang: 'Python', cmd: 'pip install opentelemetry-sdk opentelemetry-exporter-otlp-proto-http' },+ { lang: 'Go', cmd: 'go get go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp' },+ { lang: 'Java', cmd: "implementation 'io.opentelemetry:opentelemetry-exporter-otlp'" },+ { lang: '.NET', cmd: 'dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol' }+ ];++ let copiedSdkLang = $state<string | null>(null);+ let copiedOtelEndpoint = $state(false);+ let copiedOtelAuth = $state(false);+ let copiedOtelCollector = $state(false);+async function copyCfEndpoint() {await navigator.clipboard.writeText(cfOtelEndpoint);copiedCfEndpoint = true;@@ -174,6 +218,30 @@setTimeout(() => (copiedCfDeploy = false), 2000);}+ async function copySdkInstall(lang: string, cmd: string) {+ await navigator.clipboard.writeText(cmd);+ copiedSdkLang = lang;+ setTimeout(() => (copiedSdkLang = null), 2000);+ }++ async function copyOtelEndpoint() {+ await navigator.clipboard.writeText(otelBaseEndpoint);+ copiedOtelEndpoint = true;+ setTimeout(() => (copiedOtelEndpoint = false), 2000);+ }++ async function copyOtelAuth() {+ await navigator.clipboard.writeText(otelAuthHeader);+ copiedOtelAuth = true;+ setTimeout(() => (copiedOtelAuth = false), 2000);+ }++ async function copyOtelCollector() {+ await navigator.clipboard.writeText(otelCollectorConfig);+ copiedOtelCollector = true;+ setTimeout(() => (copiedOtelCollector = false), 2000);+ }+async function copyInstall() {await navigator.clipboard.writeText(installCommand);copiedInstall = true;@@ -306,14 +374,17 @@<h3 class="font-semibold">Create a Destination</h3></div><p class="mt-1 ml-9 text-sm text-muted-foreground">- In the Cloudflare dashboard, create an OTLP destination with the endpoint and authorization header below.+ In the Cloudflare dashboard, create an OTLP destination with the endpoint and+ authorization header below.</p></div>- <div class="p-4 space-y-4">+ <div class="space-y-4 p-4"><div>- <p class="text-sm font-medium mb-2">OTLP Traces Endpoint</p>+ <p class="mb-2 text-sm font-medium">OTLP Traces Endpoint</p><div class="flex items-center gap-2">- <code class="flex-1 rounded-md bg-muted px-3 py-2 text-sm font-mono break-all">{cfOtelEndpoint}</code>+ <code class="flex-1 rounded-md bg-muted px-3 py-2 font-mono text-sm break-all"+ >{cfOtelEndpoint}</code+ ><Button variant="outline" size="sm" onclick={copyCfEndpoint}>{#if copiedCfEndpoint}<Check class="h-4 w-4 text-green-500" />@@ -324,9 +395,11 @@</div></div><div>- <p class="text-sm font-medium mb-2">Authorization Header</p>+ <p class="mb-2 text-sm font-medium">Authorization Header</p><div class="flex items-center gap-2">- <code class="flex-1 rounded-md bg-muted px-3 py-2 text-sm font-mono break-all">{cfAuthHeader}</code>+ <code class="flex-1 rounded-md bg-muted px-3 py-2 font-mono text-sm break-all"+ >{cfAuthHeader}</code+ ><Button variant="outline" size="sm" onclick={copyCfAuth}>{#if copiedCfAuth}<Check class="h-4 w-4 text-green-500" />@@ -395,7 +468,9 @@</div><div class="p-4"><div class="flex items-center gap-2">- <code class="flex-1 rounded-md bg-muted px-3 py-2 text-sm font-mono break-all">npx wrangler deploy</code>+ <code class="flex-1 rounded-md bg-muted px-3 py-2 font-mono text-sm break-all"+ >npx wrangler deploy</code+ ><Button variant="outline" size="sm" onclick={copyCfDeploy}>{#if copiedCfDeploy}<Check class="h-4 w-4 text-green-500" />@@ -406,148 +481,291 @@</div></div></div>- {:else}- <!-- Step 1: Install -->- <div class="rounded-md border bg-card">- <div class="border-b px-4 py-3">- <div class="flex items-center gap-3">- <div- class="flex h-6 w-6 items-center justify-center rounded-full bg-primary text-sm font-medium text-primary-foreground"- >- 1+ {:else if isOtel}+ <!-- OTel Step 1: Install an OTel SDK -->+ <div class="rounded-md border bg-card">+ <div class="border-b px-4 py-3">+ <div class="flex items-center gap-3">+ <div+ class="flex h-6 w-6 items-center justify-center rounded-full bg-primary text-sm font-medium text-primary-foreground"+ >+ 1+ </div>+ <h3 class="font-semibold">Install an OpenTelemetry SDK</h3></div>- <h3 class="font-semibold">Install the SDK</h3>+ <p class="mt-1 ml-9 text-sm text-muted-foreground">+ Choose the OTel SDK for your language. Any language that supports OTLP/HTTP export+ will work.+ </p>+ </div>+ <div class="space-y-2 p-4">+ {#each otelSdks as sdk}+ <div class="flex items-center gap-2">+ <span class="w-16 shrink-0 text-sm font-medium">{sdk.lang}</span>+ <code class="flex-1 rounded-md bg-muted px-3 py-2 font-mono text-xs break-all"+ >{sdk.cmd}</code+ >+ <Button+ variant="outline"+ size="sm"+ onclick={() => copySdkInstall(sdk.lang, sdk.cmd)}+ >+ {#if copiedSdkLang === sdk.lang}+ <Check class="h-4 w-4 text-green-500" />+ {:else}+ <Copy class="h-4 w-4" />+ {/if}+ </Button>+ </div>+ {/each}+ <p class="ml-16 pt-1 text-xs text-muted-foreground">+ <a+ href="https://opentelemetry.io/docs/languages/"+ target="_blank"+ rel="noopener noreferrer"+ class="underline hover:text-foreground">View all supported languages</a+ >+ </p></div></div>- <div class="p-4">- <div class="relative">- <div class="absolute top-2 right-2 z-10">- <Button variant="outline" size="sm" onclick={copyInstall}>- {#if copiedInstall}- <Check class="mr-2 h-4 w-4 text-green-500" />- Copied!- {:else}- <Copy class="mr-2 h-4 w-4" />- Copy- {/if}- </Button>++ <!-- OTel Step 2: Configure the Exporter -->+ <div class="rounded-md border bg-card">+ <div class="border-b px-4 py-3">+ <div class="flex items-center gap-3">+ <div+ class="flex h-6 w-6 items-center justify-center rounded-full bg-primary text-sm font-medium text-primary-foreground"+ >+ 2+ </div>+ <h3 class="font-semibold">Configure the OTLP Exporter</h3></div>- <div- class="overflow-x-auto rounded-lg text-sm {themeState.isDark- ? 'dark-code'- : 'light-code'}"- >- <Highlight language={bash} code={installCommand} />+ <p class="mt-1 ml-9 text-sm text-muted-foreground">+ Point your OTLP/HTTP exporter at Traceway using the endpoint and token below.+ </p>+ </div>+ <div class="space-y-4 p-4">+ <div>+ <p class="mb-2 text-sm font-medium">OTLP Endpoint</p>+ <p class="mb-2 text-xs text-muted-foreground">+ Your SDK or Collector will append <code+ class="rounded bg-muted px-1 py-0.5 font-mono text-xs">/v1/traces</code+ >+ and+ <code class="rounded bg-muted px-1 py-0.5 font-mono text-xs">/v1/metrics</code> automatically.+ </p>+ <div class="flex items-center gap-2">+ <code class="flex-1 rounded-md bg-muted px-3 py-2 font-mono text-sm break-all"+ >{otelBaseEndpoint}</code+ >+ <Button variant="outline" size="sm" onclick={copyOtelEndpoint}>+ {#if copiedOtelEndpoint}+ <Check class="h-4 w-4 text-green-500" />+ {:else}+ <Copy class="h-4 w-4" />+ {/if}+ </Button>+ </div>+ </div>+ <div>+ <p class="mb-2 text-sm font-medium">Authorization Header</p>+ <div class="flex items-center gap-2">+ <code class="flex-1 rounded-md bg-muted px-3 py-2 font-mono text-sm break-all"+ >{otelAuthHeader}</code+ >+ <Button variant="outline" size="sm" onclick={copyOtelAuth}>+ {#if copiedOtelAuth}+ <Check class="h-4 w-4 text-green-500" />+ {:else}+ <Copy class="h-4 w-4" />+ {/if}+ </Button>+ </div>+ </div>+ <div>+ <p class="mb-2 text-sm font-medium">Example: OTel Collector (optional)</p>+ <div class="relative">+ <div class="absolute top-2 right-2 z-10">+ <Button variant="outline" size="sm" onclick={copyOtelCollector}>+ {#if copiedOtelCollector}+ <Check class="mr-2 h-4 w-4 text-green-500" />+ Copied!+ {:else}+ <Copy class="mr-2 h-4 w-4" />+ Copy+ {/if}+ </Button>+ </div>+ <div+ class="overflow-x-auto rounded-lg text-sm {themeState.isDark+ ? 'dark-code'+ : 'light-code'}"+ >+ <Highlight language={yaml} code={otelCollectorConfig} />+ </div>+ </div></div></div></div>- </div>- <!-- Step 2: Setup Integration -->- <div class="rounded-md border bg-card">- <div class="border-b px-4 py-3">- <div class="flex items-center gap-3">- <div- class="flex h-6 w-6 items-center justify-center rounded-full bg-primary text-sm font-medium text-primary-foreground"- >- 2+ <!-- OTel Step 3: Run Your Application -->+ <div class="rounded-md border bg-card">+ <div class="border-b px-4 py-3">+ <div class="flex items-center gap-3">+ <div+ class="flex h-6 w-6 items-center justify-center rounded-full bg-primary text-sm font-medium text-primary-foreground"+ >+ 3+ </div>+ <h3 class="font-semibold">Run Your Application</h3></div>- <h3 class="font-semibold">- {getFrameworkLabel(projectWithToken.framework)} Integration- </h3>+ <p class="mt-1 ml-9 text-sm text-muted-foreground">+ Start your application with OpenTelemetry instrumentation enabled. The SDK will+ automatically export traces and metrics to Traceway via OTLP/HTTP.+ </p></div>- <p class="mt-1 ml-9 text-sm text-muted-foreground">- Add the Traceway middleware to your application.- </p></div>- <div class="p-4">- <div class="relative">- <div class="absolute top-2 right-2 z-10">- <Button variant="outline" size="sm" onclick={copyCode}>- {#if copiedCode}- <Check class="mr-2 h-4 w-4 text-green-500" />- Copied!- {:else}- <Copy class="mr-2 h-4 w-4" />- Copy- {/if}- </Button>+ {:else}+ <!-- Step 1: Install -->+ <div class="rounded-md border bg-card">+ <div class="border-b px-4 py-3">+ <div class="flex items-center gap-3">+ <div+ class="flex h-6 w-6 items-center justify-center rounded-full bg-primary text-sm font-medium text-primary-foreground"+ >+ 1+ </div>+ <h3 class="font-semibold">Install the SDK</h3></div>- <div- class="overflow-x-auto rounded-lg text-sm {themeState.isDark- ? 'dark-code'- : 'light-code'}"- >- <Highlight language={highlightLanguage} code={sdkCode} />+ </div>+ <div class="p-4">+ <div class="relative">+ <div class="absolute top-2 right-2 z-10">+ <Button variant="outline" size="sm" onclick={copyInstall}>+ {#if copiedInstall}+ <Check class="mr-2 h-4 w-4 text-green-500" />+ Copied!+ {:else}+ <Copy class="mr-2 h-4 w-4" />+ Copy+ {/if}+ </Button>+ </div>+ <div+ class="overflow-x-auto rounded-lg text-sm {themeState.isDark+ ? 'dark-code'+ : 'light-code'}"+ >+ <Highlight language={bash} code={installCommand} />+ </div></div></div></div>- </div>- <!-- Step 3: Add Testing Route -->- <div class="rounded-md border bg-card">- <div class="border-b px-4 py-3">- <div class="flex items-center gap-3">- <div- class="flex h-6 w-6 items-center justify-center rounded-full bg-primary text-sm font-medium text-primary-foreground"- >- 3+ <!-- Step 2: Setup Integration -->+ <div class="rounded-md border bg-card">+ <div class="border-b px-4 py-3">+ <div class="flex items-center gap-3">+ <div+ class="flex h-6 w-6 items-center justify-center rounded-full bg-primary text-sm font-medium text-primary-foreground"+ >+ 2+ </div>+ <h3 class="font-semibold">+ {getFrameworkLabel(projectWithToken.framework)} Integration+ </h3></div>- <h3 class="font-semibold">Add a Test Route</h3>+ <p class="mt-1 ml-9 text-sm text-muted-foreground">+ Add the Traceway middleware to your application.+ </p></div>- <p class="mt-1 ml-9 text-sm text-muted-foreground">- Add this route to verify your integration, then visit <code- class="rounded bg-muted px-1 py-0.5 font-mono text-xs">GET /testing</code- > in your browser.- </p>- </div>- <div class="p-4">- <div class="relative">- <div class="absolute top-2 right-2 z-10">- <Button variant="outline" size="sm" onclick={copyTesting}>- {#if copiedTesting}- <Check class="mr-2 h-4 w-4 text-green-500" />- Copied!- {:else}- <Copy class="mr-2 h-4 w-4" />- Copy- {/if}- </Button>+ <div class="p-4">+ <div class="relative">+ <div class="absolute top-2 right-2 z-10">+ <Button variant="outline" size="sm" onclick={copyCode}>+ {#if copiedCode}+ <Check class="mr-2 h-4 w-4 text-green-500" />+ Copied!+ {:else}+ <Copy class="mr-2 h-4 w-4" />+ Copy+ {/if}+ </Button>+ </div>+ <div+ class="overflow-x-auto rounded-lg text-sm {themeState.isDark+ ? 'dark-code'+ : 'light-code'}"+ >+ <Highlight language={highlightLanguage} code={sdkCode} />+ </div></div>- <div- class="overflow-x-auto rounded-lg text-sm {themeState.isDark- ? 'dark-code'- : 'light-code'}"- >- <Highlight language={highlightLanguage} code={testingRouteCode} />+ </div>+ </div>++ <!-- Step 3: Add Testing Route -->+ <div class="rounded-md border bg-card">+ <div class="border-b px-4 py-3">+ <div class="flex items-center gap-3">+ <div+ class="flex h-6 w-6 items-center justify-center rounded-full bg-primary text-sm font-medium text-primary-foreground"+ >+ 3+ </div>+ <h3 class="font-semibold">Add a Test Route</h3></div>+ <p class="mt-1 ml-9 text-sm text-muted-foreground">+ Add this route to verify your integration, then visit <code+ class="rounded bg-muted px-1 py-0.5 font-mono text-xs">GET /testing</code+ > in your browser.+ </p></div>+ <div class="p-4">+ <div class="relative">+ <div class="absolute top-2 right-2 z-10">+ <Button variant="outline" size="sm" onclick={copyTesting}>+ {#if copiedTesting}+ <Check class="mr-2 h-4 w-4 text-green-500" />+ Copied!+ {:else}+ <Copy class="mr-2 h-4 w-4" />+ Copy+ {/if}+ </Button>+ </div>+ <div+ class="overflow-x-auto rounded-lg text-sm {themeState.isDark+ ? 'dark-code'+ : 'light-code'}"+ >+ <Highlight language={highlightLanguage} code={testingRouteCode} />+ </div>+ </div>- <div class="flex justify-center p-2 italic">or</div>+ <div class="flex justify-center p-2 italic">or</div>- <div class="relative">- <div class="absolute top-2 right-2 z-10">- <Button variant="outline" size="sm" onclick={copyTesting2}>- {#if copiedTesting2}- <Check class="mr-2 h-4 w-4 text-green-500" />- Copied!- {:else}- <Copy class="mr-2 h-4 w-4" />- Copy- {/if}- </Button>- </div>- <div- class="overflow-x-auto rounded-lg text-sm {themeState.isDark- ? 'dark-code'- : 'light-code'}"- >- <Highlight language={highlightLanguage} code={testingRouteCode2} />+ <div class="relative">+ <div class="absolute top-2 right-2 z-10">+ <Button variant="outline" size="sm" onclick={copyTesting2}>+ {#if copiedTesting2}+ <Check class="mr-2 h-4 w-4 text-green-500" />+ Copied!+ {:else}+ <Copy class="mr-2 h-4 w-4" />+ Copy+ {/if}+ </Button>+ </div>+ <div+ class="overflow-x-auto rounded-lg text-sm {themeState.isDark+ ? 'dark-code'+ : 'light-code'}"+ >+ <Highlight language={highlightLanguage} code={testingRouteCode2} />+ </div></div></div></div>- </div>-{/if}<!-- Bottom Check Again --><div class="rounded-md border bg-card">@@ -558,9 +776,14 @@<Unplug class="h-6 w-6 text-destructive" /></div><p class="mb-4 text-sm text-muted-foreground">- Once you've completed the steps above and triggered the <code- class="rounded bg-muted px-1 py-0.5 font-mono text-xs">/testing</code- > endpoint, click below to verify.+ {#if isOtel || isCloudflare}+ Once you've completed the steps above and sent some traffic through your+ application, click below to verify.+ {:else}+ Once you've completed the steps above and triggered the <code+ class="rounded bg-muted px-1 py-0.5 font-mono text-xs">/testing</code+ > endpoint, click below to verify.+ {/if}</p><Button variant="outline" onclick={checkAgain} disabled={checking}>{#if checking}diff --git a/frontend/src/routes/connection/+page.svelte b/frontend/src/routes/connection/+page.svelteindex cde0602b..b8277070 100644--- a/frontend/src/routes/connection/+page.svelte+++ b/frontend/src/routes/connection/+page.svelte@@ -8,7 +8,13 @@} from '$lib/components/ui/card';import { Button } from '$lib/components/ui/button';import { Copy, Check, KeyRound } from 'lucide-svelte';- import { projectsState, type ProjectWithToken, isJsFramework, isOtelFramework, isCloudflareFramework } from '$lib/state/projects.svelte';+ import {+ projectsState,+ type ProjectWithToken,+ isJsFramework,+ isOtelFramework,+ isCloudflareFramework+ } from '$lib/state/projects.svelte';import { authState } from '$lib/state/auth.svelte';import { LoadingCircle } from '$lib/components/ui/loading-circle';import FrameworkIcon from '$lib/components/framework-icon.svelte';@@ -16,6 +22,7 @@import go from 'svelte-highlight/languages/go';import javascript from 'svelte-highlight/languages/javascript';import bash from 'svelte-highlight/languages/bash';+ import yaml from 'svelte-highlight/languages/yaml';import { themeState } from '$lib/state/theme.svelte';import 'svelte-highlight/styles/github-dark.css';import {@@ -31,19 +38,42 @@let copiedCommand = $state(false);let generatingToken = $state(false);let copiedOtelEndpoint = $state(false);- let copiedOtelToken = $state(false);+ let copiedOtelAuth = $state(false);+ let copiedOtelCollector = $state(false);let copiedCfEndpoint = $state(false);let copiedCfAuth = $state(false);let copiedCfWrangler = $state(false);let copiedCfDeploy = $state(false);const isOtel = $derived(projectWithToken ? isOtelFramework(projectWithToken.framework) : false);- const isCloudflare = $derived(projectWithToken ? isCloudflareFramework(projectWithToken.framework) : false);- const otelEndpoint = $derived(projectWithToken ? `${projectWithToken.backendUrl}/api/report` : '');- const otelToken = $derived(projectWithToken?.token ?? '');- const cloudflareOtelEndpoint = $derived(projectWithToken ? `${projectWithToken.backendUrl}/api/otel/v1/traces` : '');+ const isCloudflare = $derived(+ projectWithToken ? isCloudflareFramework(projectWithToken.framework) : false+ );+ const otelEndpoint = $derived(projectWithToken ? `${projectWithToken.backendUrl}/api/otel` : '');+ const otelAuthHeader = $derived(projectWithToken ? `Bearer ${projectWithToken.token}` : '');+ const otelCollectorConfig = $derived(+ projectWithToken+ ? `exporters:+ otlphttp:+ endpoint: "${projectWithToken.backendUrl}/api/otel"+ headers:+ Authorization: "Bearer ${projectWithToken.token}"++service:+ pipelines:+ traces:+ exporters: [otlphttp]+ metrics:+ exporters: [otlphttp]`+ : ''+ );+ const cloudflareOtelEndpoint = $derived(+ projectWithToken ? `${projectWithToken.backendUrl}/api/otel/v1/traces` : ''+ );const cloudflareAuthHeader = $derived(projectWithToken ? `Bearer ${projectWithToken.token}` : '');- const wranglerConfig = $derived(projectWithToken ? `{+ const wranglerConfig = $derived(+ projectWithToken+ ? `{"observability": {"traces": {"enabled": true,@@ -56,7 +86,9 @@]}}-}` : '');+}`+ : ''+ );const sdkCode = $derived(projectWithToken@@ -78,7 +110,8 @@const isJs = $derived(projectWithToken ? isJsFramework(projectWithToken.framework) : false);const isReadonly = $derived(- authState.getRoleForOrganization(projectsState.currentProject?.organizationId ?? 0) === 'readonly'+ authState.getRoleForOrganization(projectsState.currentProject?.organizationId ?? 0) ===+ 'readonly');const sourceMapToken = $derived(projectWithToken?.sourceMapToken ?? null);@@ -152,10 +185,16 @@setTimeout(() => (copiedOtelEndpoint = false), 2000);}- async function copyOtelToken() {- await navigator.clipboard.writeText(otelToken);- copiedOtelToken = true;- setTimeout(() => (copiedOtelToken = false), 2000);+ async function copyOtelAuth() {+ await navigator.clipboard.writeText(otelAuthHeader);+ copiedOtelAuth = true;+ setTimeout(() => (copiedOtelAuth = false), 2000);+ }++ async function copyOtelCollector() {+ await navigator.clipboard.writeText(otelCollectorConfig);+ copiedOtelCollector = true;+ setTimeout(() => (copiedOtelCollector = false), 2000);}</script>@@ -171,18 +210,24 @@<CardHeader><CardTitle class="flex items-center gap-2"><FrameworkIcon framework={projectWithToken.framework} />- OpenTelemetry Integration+ Configure the OTLP Exporter</CardTitle><CardDescription>- Point your OTLP exporter at Traceway+ Point your OTLP/HTTP exporter at Traceway using the endpoint and token below.</CardDescription></CardHeader><CardContent><div class="space-y-6"><div>- <p class="text-sm font-medium mb-2">Step 1 — Endpoint URL</p>+ <p class="mb-1 text-sm font-medium">OTLP Endpoint</p>+ <p class="mb-2 text-xs text-muted-foreground">+ Your SDK or Collector will append <code class="text-xs">/v1/traces</code> and+ <code class="text-xs">/v1/metrics</code> automatically.+ </p><div class="flex items-center gap-2">- <code class="flex-1 rounded-md bg-muted px-3 py-2 text-sm font-mono break-all">{otelEndpoint}</code>+ <code class="flex-1 rounded-md bg-muted px-3 py-2 font-mono text-sm break-all"+ >{otelEndpoint}</code+ ><Button variant="outline" size="sm" onclick={copyOtelEndpoint}>{#if copiedOtelEndpoint}<Check class="h-4 w-4 text-green-500" />@@ -193,11 +238,13 @@</div></div><div>- <p class="text-sm font-medium mb-2">Step 2 — Token</p>+ <p class="mb-2 text-sm font-medium">Authorization Header</p><div class="flex items-center gap-2">- <code class="flex-1 rounded-md bg-muted px-3 py-2 text-sm font-mono break-all">{otelToken}</code>- <Button variant="outline" size="sm" onclick={copyOtelToken}>- {#if copiedOtelToken}+ <code class="flex-1 rounded-md bg-muted px-3 py-2 font-mono text-sm break-all"+ >{otelAuthHeader}</code+ >+ <Button variant="outline" size="sm" onclick={copyOtelAuth}>+ {#if copiedOtelAuth}<Check class="h-4 w-4 text-green-500" />{:else}<Copy class="h-4 w-4" />@@ -205,6 +252,29 @@</Button></div></div>+ <div>+ <p class="mb-2 text-sm font-medium">Example: OTel Collector (optional)</p>+ <div class="relative">+ <div class="absolute top-2 right-2 z-10">+ <Button variant="outline" size="sm" onclick={copyOtelCollector}>+ {#if copiedOtelCollector}+ <Check class="mr-2 h-4 w-4 text-green-500" />+ Copied!+ {:else}+ <Copy class="mr-2 h-4 w-4" />+ Copy+ {/if}+ </Button>+ </div>+ <div+ class="overflow-x-auto rounded-lg text-sm {themeState.isDark+ ? 'dark-code'+ : 'light-code'}"+ >+ <Highlight language={yaml} code={otelCollectorConfig} />+ </div>+ </div>+ </div></div></CardContent></Card>@@ -222,10 +292,14 @@<CardContent><div class="space-y-6"><div>- <p class="text-sm font-medium mb-2">Step 1 — OTLP Traces Endpoint</p>- <p class="text-xs text-muted-foreground mb-2">Enter this URL when creating your OTLP destination in the Cloudflare dashboard.</p>+ <p class="mb-2 text-sm font-medium">Step 1 — OTLP Traces Endpoint</p>+ <p class="mb-2 text-xs text-muted-foreground">+ Enter this URL when creating your OTLP destination in the Cloudflare dashboard.+ </p><div class="flex items-center gap-2">- <code class="flex-1 rounded-md bg-muted px-3 py-2 text-sm font-mono break-all">{cloudflareOtelEndpoint}</code>+ <code class="flex-1 rounded-md bg-muted px-3 py-2 font-mono text-sm break-all"+ >{cloudflareOtelEndpoint}</code+ ><Button variant="outline" size="sm" onclick={copyCfEndpoint}>{#if copiedCfEndpoint}<Check class="h-4 w-4 text-green-500" />@@ -236,10 +310,14 @@</div></div><div>- <p class="text-sm font-medium mb-2">Step 2 — Authorization Header</p>- <p class="text-xs text-muted-foreground mb-2">Add this as an authorization header in your OTLP destination settings.</p>+ <p class="mb-2 text-sm font-medium">Step 2 — Authorization Header</p>+ <p class="mb-2 text-xs text-muted-foreground">+ Add this as an authorization header in your OTLP destination settings.+ </p><div class="flex items-center gap-2">- <code class="flex-1 rounded-md bg-muted px-3 py-2 text-sm font-mono break-all">{cloudflareAuthHeader}</code>+ <code class="flex-1 rounded-md bg-muted px-3 py-2 font-mono text-sm break-all"+ >{cloudflareAuthHeader}</code+ ><Button variant="outline" size="sm" onclick={copyCfAuth}>{#if copiedCfAuth}<Check class="h-4 w-4 text-green-500" />@@ -250,8 +328,10 @@</div></div><div>- <p class="text-sm font-medium mb-2">Step 3 — wrangler.jsonc</p>- <p class="text-xs text-muted-foreground mb-2">Enable observability traces in your wrangler.jsonc configuration file.</p>+ <p class="mb-2 text-sm font-medium">Step 3 — wrangler.jsonc</p>+ <p class="mb-2 text-xs text-muted-foreground">+ Enable observability traces in your wrangler.jsonc configuration file.+ </p><div class="relative"><div class="absolute top-2 right-2 z-10"><Button variant="outline" size="sm" onclick={copyCfWrangler}>@@ -274,9 +354,11 @@</div></div><div>- <p class="text-sm font-medium mb-2">Step 4 — Deploy</p>+ <p class="mb-2 text-sm font-medium">Step 4 — Deploy</p><div class="flex items-center gap-2">- <code class="flex-1 rounded-md bg-muted px-3 py-2 text-sm font-mono break-all">npx wrangler deploy</code>+ <code class="flex-1 rounded-md bg-muted px-3 py-2 font-mono text-sm break-all"+ >npx wrangler deploy</code+ ><Button variant="outline" size="sm" onclick={copyCfDeploy}>{#if copiedCfDeploy}<Check class="h-4 w-4 text-green-500" />@@ -290,143 +372,142 @@</CardContent></Card>{:else}- <Card>- <CardHeader>- <CardTitle class="flex items-center gap-2">- <FrameworkIcon framework={projectWithToken.framework} />- {getFrameworkLabel(projectWithToken.framework)} Integration- </CardTitle>- <CardDescription>- Add Traceway to your application with just a few lines of code.- </CardDescription>- </CardHeader>- <CardContent>- <div class="relative">- <div class="absolute top-2 right-2 z-10">- <Button variant="outline" size="sm" onclick={copyCode}>- {#if copiedCode}- <Check class="mr-2 h-4 w-4 text-green-500" />- Copied!- {:else}- <Copy class="mr-2 h-4 w-4" />- Copy- {/if}- </Button>- </div>- <div- class="overflow-x-auto rounded-lg text-sm {themeState.isDark- ? 'dark-code'- : 'light-code'}"- >- <Highlight language={highlightLanguage} code={sdkCode} />- </div>- </div>- </CardContent>- </Card>-- <Card>- <CardHeader>- <CardTitle>Installation</CardTitle>- <CardDescription- >Install the required packages{isJs ? '' : ' using go get'}.</CardDescription- >- </CardHeader>- <CardContent>- <div class="relative">- <div class="absolute top-2 right-2 z-10">- <Button variant="outline" size="sm" onclick={copyInstall}>- {#if copiedInstall}- <Check class="mr-2 h-4 w-4 text-green-500" />- Copied!- {:else}- <Copy class="mr-2 h-4 w-4" />- Copy- {/if}- </Button>- </div>- <div- class="overflow-x-auto rounded-lg text-sm {themeState.isDark- ? 'dark-code'- : 'light-code'}"- >- <Highlight language={bash} code={installCommand} />- </div>- </div>- </CardContent>- </Card>- {#if isJs && !isReadonly}<Card><CardHeader><CardTitle class="flex items-center gap-2">- <KeyRound class="h-5 w-5" />- Source Map Upload+ <FrameworkIcon framework={projectWithToken.framework} />+ {getFrameworkLabel(projectWithToken.framework)} Integration</CardTitle><CardDescription>- Upload source maps to see original file names and line numbers in stack traces- from minified code.+ Add Traceway to your application with just a few lines of code.</CardDescription></CardHeader><CardContent>- {#if sourceMapToken}- <div class="space-y-4">- <div>- <p class="text-sm font-medium mb-2">Upload Token</p>- <div class="flex items-center gap-2">- <code- class="flex-1 rounded-md bg-muted px-3 py-2 text-sm font-mono break-all"- >{sourceMapToken}</code- >- <Button variant="outline" size="sm" onclick={copyToken}>- {#if copiedToken}- <Check class="h-4 w-4 text-green-500" />- {:else}- <Copy class="h-4 w-4" />- {/if}- </Button>- </div>- </div>- <div>- <p class="text-sm font-medium mb-2">Usage</p>- <div class="relative">- <div class="absolute top-2 right-2 z-10">- <Button variant="outline" size="sm" onclick={copyUploadCommand}>- {#if copiedCommand}- <Check class="mr-2 h-4 w-4 text-green-500" />- Copied!+ <div class="relative">+ <div class="absolute top-2 right-2 z-10">+ <Button variant="outline" size="sm" onclick={copyCode}>+ {#if copiedCode}+ <Check class="mr-2 h-4 w-4 text-green-500" />+ Copied!+ {:else}+ <Copy class="mr-2 h-4 w-4" />+ Copy+ {/if}+ </Button>+ </div>+ <div+ class="overflow-x-auto rounded-lg text-sm {themeState.isDark+ ? 'dark-code'+ : 'light-code'}"+ >+ <Highlight language={highlightLanguage} code={sdkCode} />+ </div>+ </div>+ </CardContent>+ </Card>++ <Card>+ <CardHeader>+ <CardTitle>Installation</CardTitle>+ <CardDescription+ >Install the required packages{isJs ? '' : ' using go get'}.</CardDescription+ >+ </CardHeader>+ <CardContent>+ <div class="relative">+ <div class="absolute top-2 right-2 z-10">+ <Button variant="outline" size="sm" onclick={copyInstall}>+ {#if copiedInstall}+ <Check class="mr-2 h-4 w-4 text-green-500" />+ Copied!+ {:else}+ <Copy class="mr-2 h-4 w-4" />+ Copy+ {/if}+ </Button>+ </div>+ <div+ class="overflow-x-auto rounded-lg text-sm {themeState.isDark+ ? 'dark-code'+ : 'light-code'}"+ >+ <Highlight language={bash} code={installCommand} />+ </div>+ </div>+ </CardContent>+ </Card>+ {#if isJs && !isReadonly}+ <Card>+ <CardHeader>+ <CardTitle class="flex items-center gap-2">+ <KeyRound class="h-5 w-5" />+ Source Map Upload+ </CardTitle>+ <CardDescription>+ Upload source maps to see original file names and line numbers in stack traces from+ minified code.+ </CardDescription>+ </CardHeader>+ <CardContent>+ {#if sourceMapToken}+ <div class="space-y-4">+ <div>+ <p class="mb-2 text-sm font-medium">Upload Token</p>+ <div class="flex items-center gap-2">+ <code class="flex-1 rounded-md bg-muted px-3 py-2 font-mono text-sm break-all"+ >{sourceMapToken}</code+ >+ <Button variant="outline" size="sm" onclick={copyToken}>+ {#if copiedToken}+ <Check class="h-4 w-4 text-green-500" />{:else}- <Copy class="mr-2 h-4 w-4" />- Copy+ <Copy class="h-4 w-4" />{/if}</Button></div>- <div- class="overflow-x-auto rounded-lg text-sm {themeState.isDark- ? 'dark-code'- : 'light-code'}"- >- <Highlight language={bash} code={uploadCommand} />+ </div>+ <div>+ <p class="mb-2 text-sm font-medium">Usage</p>+ <div class="relative">+ <div class="absolute top-2 right-2 z-10">+ <Button variant="outline" size="sm" onclick={copyUploadCommand}>+ {#if copiedCommand}+ <Check class="mr-2 h-4 w-4 text-green-500" />+ Copied!+ {:else}+ <Copy class="mr-2 h-4 w-4" />+ Copy+ {/if}+ </Button>+ </div>+ <div+ class="overflow-x-auto rounded-lg text-sm {themeState.isDark+ ? 'dark-code'+ : 'light-code'}"+ >+ <Highlight language={bash} code={uploadCommand} />+ </div></div></div></div>- </div>- {:else}- <p class="text-sm text-muted-foreground mb-4">- Generate an upload token to start uploading source maps as part of your build- process.- </p>- <Button onclick={generateToken} disabled={generatingToken}>- {#if generatingToken}- <LoadingCircle class="mr-2 h-4 w-4" />- Generating...- {:else}- <KeyRound class="mr-2 h-4 w-4" />- Generate Upload Token- {/if}- </Button>- {/if}- </CardContent>- </Card>- {/if}+ {:else}+ <p class="mb-4 text-sm text-muted-foreground">+ Generate an upload token to start uploading source maps as part of your build+ process.+ </p>+ <Button onclick={generateToken} disabled={generatingToken}>+ {#if generatingToken}+ <LoadingCircle class="mr-2 h-4 w-4" />+ Generating...+ {:else}+ <KeyRound class="mr-2 h-4 w-4" />+ Generate Upload Token+ {/if}+ </Button>+ {/if}+ </CardContent>+ </Card>+ {/if}{/if}{:else}<Card>