Skip to content

Commit c12b9fc

Browse files
authored
test: add local debugging endpoint and react demo (#755)
1 parent ee6251e commit c12b9fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+13051
-2
lines changed

.eslintrc.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module.exports = {
22
env: {
33
browser: true
44
},
5-
ignorePatterns: ['playwright*.config.ts', '**/*.spec.ts'],
5+
ignorePatterns: ['playwright*.config.ts', '**/*.spec.ts', 'examples/**'],
66
extends: [
77
'plugin:@typescript-eslint/recommended',
88
'plugin:@typescript-eslint/recommended-requiring-type-checking',
@@ -171,7 +171,6 @@ module.exports = {
171171
indent: 'off',
172172
'jsdoc/check-alignment': 'error',
173173
'jsdoc/check-indentation': 'error',
174-
'jsdoc/newline-after-description': 'error',
175174
'linebreak-style': 'off',
176175
'max-classes-per-file': ['error', 1],
177176
'new-parens': 'off',

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ Thank you for your interest in contributing to our project. Whether it's a bug r
44

55
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution.
66

7+
## Local Development Tools
8+
9+
The `Examples/` directory contains tools to help developers locally debug RUM telemetry without any dependencies:
10+
11+
- **aws-rum-web-ui** - Captures and visualizes RUM payloads via a local server and React UI
12+
- **spa-react-demo** - Single Page Application example demonstrating RUM integration in a React app
13+
14+
These tools are designed for local debugging and testing of RUM telemetry collection.
15+
716
## Reporting Bugs/Feature Requests
817

918
We welcome you to use the GitHub issue tracker to report bugs or suggest features.

Examples/aws-rum-web-ui/.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
25+
26+
*.jsonl
27+
recordingids.json

Examples/aws-rum-web-ui/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# AWS RUM Web UI
2+
3+
A local debugging tool for capturing and visualizing AWS RUM telemetry without any dependencies.
4+
5+
## Purpose
6+
7+
This tool helps developers locally debug RUM telemetry by:
8+
9+
- Capturing RUM requests via a local Express server
10+
- Visualizing payloads in a React UI with AWS Cloudscape Design System
11+
- Inspecting session replay events and metadata
12+
- Monitoring real-time telemetry data
13+
14+
## Quick Start
15+
16+
```bash
17+
npm install
18+
npm run dev
19+
```
20+
21+
This starts:
22+
23+
- Server on port 3000 (captures RUM requests)
24+
- React UI on port 5173 (visualizes logs)
25+
26+
## Usage
27+
28+
1. Configure your RUM client endpoint to `http://localhost:3000`
29+
2. Open `http://localhost:5173` to view captured telemetry
30+
3. Logs are stored in `server/logs.jsonl`
31+
32+
## API Endpoints
33+
34+
- `POST /appmonitors/:appmonitorId` - Capture RUM payloads
35+
- `GET /api/logs` - Retrieve all captured logs

Examples/aws-rum-web-ui/SCRIPTS.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# AwsRumWebUI Development Scripts
2+
3+
## Available Commands
4+
5+
### `npm run dev`
6+
7+
Start both the server and client in development mode (with existing logs)
8+
9+
### `npm run dev:clean`
10+
11+
**Clean start** - Removes all log files and starts fresh
12+
13+
- Deletes `events.jsonl`
14+
- Deletes `requests.jsonl`
15+
- Deletes `sessionreplay.jsonl`
16+
- Resets `recordingids.json`
17+
- Then starts the dev server
18+
19+
### `npm run clean`
20+
21+
Clean up log files without starting the server
22+
23+
### `npm run server`
24+
25+
Start only the backend server (port 3000)
26+
27+
### `npm run client`
28+
29+
Start only the frontend client (port 5173)
30+
31+
## Log Files Location
32+
33+
All log files are stored in `server/api/`:
34+
35+
- `events.jsonl` - Individual RUM events
36+
- `requests.jsonl` - Raw HTTP requests
37+
- `sessionreplay.jsonl` - Session replay events
38+
- `recordingids.json` - Index of recording IDs
39+
40+
## Usage Examples
41+
42+
```bash
43+
# Start fresh (recommended for testing)
44+
npm run dev:clean
45+
46+
# Continue with existing logs
47+
npm run dev
48+
49+
# Just clean logs without starting
50+
npm run clean
51+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import js from '@eslint/js';
2+
import globals from 'globals';
3+
import reactHooks from 'eslint-plugin-react-hooks';
4+
import reactRefresh from 'eslint-plugin-react-refresh';
5+
import tseslint from 'typescript-eslint';
6+
import { defineConfig, globalIgnores } from 'eslint/config';
7+
8+
export default defineConfig([
9+
globalIgnores(['dist']),
10+
{
11+
files: ['**/*.{ts,tsx}'],
12+
extends: [
13+
js.configs.recommended,
14+
tseslint.configs.recommended,
15+
reactHooks.configs.flat.recommended,
16+
reactRefresh.configs.vite
17+
],
18+
languageOptions: {
19+
ecmaVersion: 2020,
20+
globals: globals.browser
21+
}
22+
}
23+
]);

Examples/aws-rum-web-ui/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/aws-cloudwatch.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>AWS RUM Web UI</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)