Skip to content

Commit b2fbe84

Browse files
chore: switch to unscope, rename docs
1 parent 12dca3b commit b2fbe84

File tree

3 files changed

+20
-49
lines changed

3 files changed

+20
-49
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Telemetry-first job analytics: SDK ingestion + real-time, read‑only dashboard
55
## What it is now
66

77
- Backend: Fastify API that accepts job signatures and execution telemetry, stores in Redis Stack, and broadcasts realtime via Socket.IO. Auth with API keys.
8-
- SDK: `@chronos-synapse/sdk` to register jobs and send batched execution events. Primary API is `ChronosRunner`.
8+
- SDK: `chronos-synapse-sdk` to register jobs and send batched execution events. Primary API is `ChronosRunner`.
99
- Frontend: Next.js 14 dashboard (read-only) for jobs, executions, analytics, and profile.
1010

1111
## Core architecture
@@ -23,13 +23,13 @@ Telemetry-first job analytics: SDK ingestion + real-time, read‑only dashboard
2323
Install (local):
2424

2525
```bash
26-
npm install @chronos-synapse/sdk
26+
npm install chronos-synapse-sdk
2727
```
2828

2929
Use `ChronosRunner`:
3030

3131
```ts
32-
import ChronosRunner from '@chronos-synapse/sdk';
32+
import ChronosRunner from 'chronos-synapse-sdk';
3333

3434
const runner = new ChronosRunner({
3535
apiKey: process.env.CHRONOS_API_KEY!,

frontend/src/app/dashboard/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ export default function DashboardPage() {
281281
</div>
282282
<h3 className='font-medium text-neutral-900 mb-2'>Install the SDK</h3>
283283
<p className='text-sm text-neutral-600'>
284-
Add @chronos-synapse/sdk to your application and register your jobs.
284+
Add <code>chronos-synapse-sdk</code> and register jobs to see them here.
285285
</p>
286286
</div>
287287
<div className='text-center p-4'>

sdk/README.md

Lines changed: 16 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# @chronos-synapse/sdk
1+
# chronos-synapse-sdk
22

33
Chronos SDK Runner for registering jobs and running them on server triggers with rich telemetry (ingestion, metrics, realtime).
44

@@ -10,19 +10,26 @@ Chronos SDK Runner for registering jobs and running them on server triggers with
1010
## Installation
1111

1212
```bash
13-
npm install @chronos-synapse/sdk
13+
npm install chronos-synapse-sdk
1414
# or
15-
yarn add @chronos-synapse/sdk
15+
yarn add chronos-synapse-sdk
1616
```
1717

1818
## Quick Start (Runner)
1919

2020
```ts
21-
import ChronosRunner from '@chronos-synapse/sdk';
21+
import ChronosRunner from 'chronos-synapse-sdk';
2222

2323
const runner = new ChronosRunner({
24+
// endpoint is optional; defaults to http://localhost:3001. You can override via env CHRONOS_API_URL/CHRONOS_ENDPOINT or config.
25+
endpoint: process.env.CHRONOS_API_URL,
26+
// API key is REQUIRED
2427
apiKey: process.env.CHRONOS_API_KEY!,
25-
captureConsole: true,
28+
// Optional tuning
29+
batchSize: 50,
30+
flushIntervalMs: 2000,
31+
captureConsole: true, // capture stdout/stderr during job runs
32+
maxLogBytes: 10000, // truncation limit for logs/snippets
2633
});
2734

2835
// Register your job(s)
@@ -34,14 +41,7 @@ await runner['client'].registerJobs([
3441
schedule: '0 * * * *',
3542
runMode: 'recurring',
3643
},
37-
// One-time: can provide a cron (fires on first matching minute only), or leave schedule '' and provide runAt
38-
{
39-
id: 'job:migrate-once',
40-
name: 'One-time Migration',
41-
schedule: '*/2 * * * *',
42-
runMode: 'once',
43-
},
44-
// Alternatively one-time at a fixed time via runAt (ISO or epoch ms) with empty schedule
44+
// One-time via runAt (ISO or epoch ms) with empty schedule
4545
{
4646
id: 'job:launch-once',
4747
name: 'Launch',
@@ -52,24 +52,13 @@ await runner['client'].registerJobs([
5252
]);
5353

5454
runner.register('job:daily-report', async () => {
55-
// Your work here
56-
await new Promise((r) => setTimeout(r, 150));
57-
if (Math.random() < 0.3) throw new Error('simulated failure');
55+
/* ... */
5856
});
59-
60-
runner.register('job:migrate-once', async () => {
61-
// Your work here
62-
await new Promise((r) => setTimeout(r, 150));
63-
if (Math.random() < 0.3) throw new Error('simulated failure');
64-
});
65-
6657
runner.register('job:launch-once', async () => {
67-
// Your work here
68-
await new Promise((r) => setTimeout(r, 150));
69-
if (Math.random() < 0.3) throw new Error('simulated failure');
58+
/* ... */
7059
});
7160

72-
// Start listening for triggers
61+
// Start listening for triggers (emitted by the Chronos server)
7362
runner.start();
7463
```
7564

@@ -114,24 +103,6 @@ The SDK truncates large fields by default (configurable via `maxLogBytes`).
114103
- Set env: `export CHRONOS_API_URL=http://localhost:3001; export CHRONOS_API_KEY=...`
115104
- Run runner test: `npm run start:runner`
116105

117-
## Advanced (optional) – Low-level API
118-
119-
If you need direct control of telemetry, you can still enqueue events manually. You are responsible for `execId` generation and timing fields.
120-
121-
```ts
122-
// Access the internal client via runner['client'] (advanced only)
123-
runner['client'].enqueueExecution({
124-
execId: `job:daily-report:${Date.now()}`,
125-
jobId: 'job:daily-report',
126-
status: 'success',
127-
startedAt: new Date().toISOString(),
128-
finishedAt: new Date().toISOString(),
129-
durationMs: 742,
130-
exitCode: 0,
131-
});
132-
await runner['client'].flush();
133-
```
134-
135106
## Telemetry Fields
136107

137108
| Field | Source | Default/Example |

0 commit comments

Comments
 (0)