Skip to content

Commit 7257ac0

Browse files
docs: update spectrum-ts documentation for v1.8.0 (#27)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent c3234c7 commit 7257ac0

4 files changed

Lines changed: 198 additions & 9 deletions

File tree

docs-src/spectrum-ts/custom-events-and-lifecycle.mdx.vel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Use the flat form on `app` when you want a merged feed across platforms; use the
4242
await app.stop();
4343
```
4444

45-
This closes the merged message stream, drains and disposes every custom event stream, and tears down every platform client via its `lifecycle.destroyClient` hook (if one is defined). It's idempotent — calling `stop()` twice is safe.
45+
This closes the merged message stream, drains and disposes every custom event stream, tears down every platform client via its `lifecycle.destroyClient` hook (if one is defined), and flushes any pending telemetry data when [telemetry](/spectrum-ts/getting-started#telemetry) is enabled. It's idempotent — calling `stop()` twice is safe.
4646

4747
### Signal handling
4848

docs-src/spectrum-ts/getting-started.mdx.vel

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,22 @@ for await (const [space, message] of app.messages) {
121121
```
122122

123123
Messages from every provider merge into the single `app.messages` stream. The `message.platform` field identifies the source.
124+
125+
## Telemetry
126+
127+
Spectrum has built-in [OpenTelemetry](https://opentelemetry.io/) instrumentation. Enable it by passing `telemetry: true`:
128+
129+
```ts
130+
const app = await Spectrum({
131+
projectId: process.env.PROJECT_ID!,
132+
projectSecret: process.env.PROJECT_SECRET!,
133+
providers: [imessage.config()],
134+
telemetry: true,
135+
});
136+
```
137+
138+
When enabled, Spectrum traces initialization, provider setup, message send/receive/get flows, space resolution, and custom events. Each span includes attributes like the provider name, space ID, content type, and sender kind.
139+
140+
Traces are sent to the Photon OTLP endpoint by default. Standard `OTEL_EXPORTER_OTLP_*` environment variables override the default endpoint and headers.
141+
142+
Calling `app.stop()` flushes any pending telemetry data before shutting down.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"eslint-plugin-format": "^2.0.1",
2828
"husky": "^9.1.7",
2929
"oxfmt": "^0.44.0",
30-
"spectrum-ts": "1.5.0",
30+
"spectrum-ts": "1.8.0",
3131
"tsx": "^4.21.0",
3232
"typescript": "^5.9.3"
3333
}

pnpm-lock.yaml

Lines changed: 177 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)