Skip to content

Commit

Permalink
docs: demo console report in the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
maraisr committed Aug 1, 2023
1 parent 87c7943 commit 360d35c
Showing 1 changed file with 39 additions and 12 deletions.
51 changes: 39 additions & 12 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ import { configure, tracer, report } from 'rian';
import { exporter } from 'rian/exporter.otel.http';

// ~> configure the environment, all tracers will inherit this
configure('my-service' {
'service.version': 'DEV'
configure('my-service', {
'service.version': 'DEV',
});

// ~> create a tracer โ€” typically "per request" or "per operation".
Expand Down Expand Up @@ -95,20 +95,47 @@ http.listen((req, executionCtx) => {
executionCtx.defer(() => report(otel_exporter));
return handler(req);
});
```

You only need to `report` in your application once somewhere. All spans are collected into the same "bucket".

<details><summary>Example output</summary>

/*
And we end up with something like this in our reporting tool:
Using: [examples/basic.ts](examples/basic.ts)

[ GET /data ......................................... (1.2ms) ] { request }
[ db::read .... (0.5ms) ] [ process records .... (0.5ms) ]
^ ^ ^ ^
{ user_id } ev { id: 1 } | |
ev { id: 2 } |
ev { id: 3 }
*/
```
โ•ญโ”€ basic
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ 95 ms โ”‚ โ”ฃโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ซ โ”‚โ—— setup
โ”‚ 41 ms โ”‚ โ”ฃโ”โ”โ”โ”โ”ซ โ”‚โ—— bootstrap
โ”‚ 32 ms โ”‚ โ”ฃโ”โ”โ”โ”ซ โ”‚โ—— building
โ”‚ 59 ms โ”‚ โ”ฃโ”โ”โ”โ”โ”โ”ซ โ”‚โ—— precompile
โ”‚ 80 ms โ”‚ โ”ฃโ”โ”โ”โ”โ”โ”โ”โ”โ”ซ โ”‚โ—— verify
โ”‚ 75 ms โ”‚ โ”ฃโ”โ”โ”โ”โ”โ”โ”โ”ซ โ”‚โ—— spawn thread
โ”‚ 371 ms โ”‚ โ”ฃโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ”ซ โ”‚โ—— doesnt finish
โ”‚ 347 ms โ”‚ โ”ฃโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ซ โ”‚โ—— running
โ”‚ 341 ms โ”‚ โ”ฃโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ซ โ”‚โ—— e2e
โ”‚ 38 ms โ”‚ โ”ฃโ”โ”โ”โ”ซ โ”‚โ—— snapshot
โ”‚ 13 ms โ”‚ โ”ฃโ”โ”ซ โ”‚โ—— url for page /my-product/sleโ€ฆ
โ”‚ โ•ฐโ”ผโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ผโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ผโ•ฏ
โ”‚ 0 ms 318.500 ms 637 ms
โ”‚
โ”‚ one โ””โ”˜ unit is less than: 10.443 ms
โ”‚ total time: 637 ms
โ•ฐโ”€
โ•ญโ”€ thread #1
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ 20 ms โ”‚ โ”ฃโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ซ โ”‚โ—— setup
โ”‚ 63 ms โ”‚ โ”ฃโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ซ โ”‚โ—— bootstrap
โ”‚ โ•ฐโ”ผโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ผโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ดโ”ผโ•ฏ
โ”‚ 0 ms 31.500 ms 63 ms
โ”‚
โ”‚ one โ””โ”˜ unit is less than: 1.016 ms
โ”‚ total time: 63 ms
โ•ฐโ”€
```

You only need to `report` in your application once somewhere. All spans are collected into the same "bucket".
</details>

## ๐Ÿ”Ž API

Expand Down

0 comments on commit 360d35c

Please sign in to comment.