# tracebook

tracebook is a web application that allows users to browse, search, and analyze trace files stored in an S3 bucket. It integrates with the Perfetto UI for in-depth trace analysis.

The goal is to make it easy to share traces.

## How It Works

1. **Listing Traces**: The app fetches a list of trace files from a specified S3 bucket.

2. **Searching**: Users can search through the list of traces using a search bar.

3. **Viewing Traces**: When a user selects a trace, the app fetches the trace data from S3.

4. **Integration with Perfetto**: The selected trace is then opened in the Perfetto UI, which is loaded in a new window.

5. **Sharing**: Users can generate shareable links for specific traces.

6. **Downloading**: Traces can be downloaded directly from the interface.

7. **S3 Path Copying**: The app allows copying of the S3 path for each trace.

The app uses Next.js for the frontend and backend, AWS SDK for S3 interactions, and integrates with the Perfetto UI for trace analysis.

## Uploading Traces

To add a trace, simply upload it to s3 in the `traces` directory. Please organize it in a subdirectory. For example:

```
aws s3 cp /app/suno/diffusion_profiling/traces/iteration_20/rank0_trace.json.gz s3://suno-data/traces/diffusion/sample.json.gz
```

## Getting Started

### Prerequisites

- Node.js (version 12 or later)
- An AWS account with S3 access

### Environment Setup

Create a `.env.local` file in the project root with the following variables:

```

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=us-east-1
S3_BUCKET_NAME=suno-data

```

Install dependencies:

```

npm install

```

Run the app:

```

npm run dev

```

```

```
