@multiplayer-app/session-recorder-common 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -1
- package/README.md +36 -8
- package/docs/img/header-js.png +0 -0
- package/package.json +1 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<a href="https://github.com/multiplayer-app/multiplayer-session-recorder-javascript">
|
|
5
|
+
<img src="https://img.shields.io/github/stars/multiplayer-app/multiplayer-session-recorder-javascript?style=social&label=Star&maxAge=2592000" alt="GitHub stars">
|
|
6
|
+
</a>
|
|
7
|
+
<a href="https://github.com/multiplayer-app/multiplayer-session-recorder-javascript/blob/main/LICENSE">
|
|
8
|
+
<img src="https://img.shields.io/github/license/multiplayer-app/multiplayer-session-recorder-javascript" alt="License">
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://multiplayer.app">
|
|
11
|
+
<img src="https://img.shields.io/badge/Visit-multiplayer.app-blue" alt="Visit Multiplayer">
|
|
12
|
+
</a>
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
<div>
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://x.com/trymultiplayer">
|
|
18
|
+
<img src="https://img.shields.io/badge/Follow%20on%20X-000000?style=for-the-badge&logo=x&logoColor=white" alt="Follow on X" />
|
|
19
|
+
</a>
|
|
20
|
+
<a href="https://www.linkedin.com/company/multiplayer-app/">
|
|
21
|
+
<img src="https://img.shields.io/badge/Follow%20on%20LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" alt="Follow on LinkedIn" />
|
|
22
|
+
</a>
|
|
23
|
+
<a href="https://discord.com/invite/q9K3mDzfrx">
|
|
24
|
+
<img src="https://img.shields.io/badge/Join%20our%20Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join our Discord" />
|
|
25
|
+
</a>
|
|
26
|
+
</p>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
# Multiplayer Full Stack Session Recorder Common
|
|
2
30
|
|
|
3
31
|
This package provides implementations of the OpenTelemetry API for trace and metrics. It's intended for use both on the server and in the browser.
|
|
4
32
|
|
|
@@ -36,7 +64,7 @@ import {
|
|
|
36
64
|
ATTR_MULTIPLAYER_GRPC_REQUEST_MESSAGE,
|
|
37
65
|
ATTR_MULTIPLAYER_GRPC_RESPONSE_MESSAGE,
|
|
38
66
|
ATTR_MULTIPLAYER_MESSAGING_MESSAGE_BODY,
|
|
39
|
-
} from '@multiplayer-app/session-recorder-
|
|
67
|
+
} from '@multiplayer-app/session-recorder-common'
|
|
40
68
|
```
|
|
41
69
|
|
|
42
70
|
### Setup opentelemetry for capturing http request/response body
|
|
@@ -46,7 +74,7 @@ Session Recorder hooks for nodejs http instrumentation for injecting http reques
|
|
|
46
74
|
```javascript
|
|
47
75
|
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'
|
|
48
76
|
import { type Instrumentation } from '@opentelemetry/instrumentation'
|
|
49
|
-
import { SessionRecorderHttpInstrumentationHooks } from '@multiplayer-app/session-recorder-
|
|
77
|
+
import { SessionRecorderHttpInstrumentationHooks } from '@multiplayer-app/session-recorder-common'
|
|
50
78
|
|
|
51
79
|
export const instrumentations: Instrumentation[] = getNodeAutoInstrumentations({
|
|
52
80
|
'@opentelemetry/instrumentation-http': {
|
|
@@ -98,7 +126,7 @@ export const instrumentations: Instrumentation[] = getNodeAutoInstrumentations({
|
|
|
98
126
|
|
|
99
127
|
```javascript
|
|
100
128
|
import { BatchSpanProcessor, WebTracerProvider } from '@opentelemetry/sdk-trace-web'
|
|
101
|
-
import { SessionRecorderHttpTraceExporterBrowser } from '@multiplayer-app/session-recorder-
|
|
129
|
+
import { SessionRecorderHttpTraceExporterBrowser } from '@multiplayer-app/session-recorder-common'
|
|
102
130
|
|
|
103
131
|
const collectorOptions = {
|
|
104
132
|
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is https://api.multiplayer.app/v1/traces
|
|
@@ -129,7 +157,7 @@ provider.register()
|
|
|
129
157
|
|
|
130
158
|
```javascript
|
|
131
159
|
import { BatchSpanProcessor, WebTracerProvider } from '@opentelemetry/sdk-trace-web'
|
|
132
|
-
import { SessionRecorderIdGenerator, SessionRecorderHttpTraceExporterBrowser } from '@multiplayer-app/session-recorder-
|
|
160
|
+
import { SessionRecorderIdGenerator, SessionRecorderHttpTraceExporterBrowser } from '@multiplayer-app/session-recorder-common'
|
|
133
161
|
|
|
134
162
|
const idGenerator = new SessionRecorderIdGenerator({ autoDocTracesRatio: 0.05 })
|
|
135
163
|
|
|
@@ -164,7 +192,7 @@ Session Recorder sampler will always sample traces with appropriate prefixes, ot
|
|
|
164
192
|
|
|
165
193
|
```javascript
|
|
166
194
|
import { BatchSpanProcessor, WebTracerProvider } from '@opentelemetry/sdk-trace-web'
|
|
167
|
-
import { SessionRecorderTraceIdRatioBasedSampler, SessionRecorderHttpTraceExporterBrowser } from '@multiplayer-app/session-recorder-
|
|
195
|
+
import { SessionRecorderTraceIdRatioBasedSampler, SessionRecorderHttpTraceExporterBrowser } from '@multiplayer-app/session-recorder-common'
|
|
168
196
|
|
|
169
197
|
const collectorOptions = {
|
|
170
198
|
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is https://api.multiplayer.app/v1/traces
|
|
@@ -192,7 +220,7 @@ const provider = new WebTracerProvider({
|
|
|
192
220
|
### Helper for capturing exception in session recording
|
|
193
221
|
|
|
194
222
|
```javascript
|
|
195
|
-
import { SessionRecorderSdk } from '@multiplayer-app/session-recorder-
|
|
223
|
+
import { SessionRecorderSdk } from '@multiplayer-app/session-recorder-common'
|
|
196
224
|
|
|
197
225
|
const error = new Error('Some text here')
|
|
198
226
|
|
|
@@ -202,7 +230,7 @@ SessionRecorderSdk.captureException(error)
|
|
|
202
230
|
### Helpers for adding content to session recording
|
|
203
231
|
|
|
204
232
|
```javascript
|
|
205
|
-
import { SessionRecorderSdk } from '@multiplayer-app/session-recorder-
|
|
233
|
+
import { SessionRecorderSdk } from '@multiplayer-app/session-recorder-common'
|
|
206
234
|
|
|
207
235
|
SessionRecorderSdk.setAttribute('{{SOME_KEY}}', '{{SOME_VALUE}}')
|
|
208
236
|
|
|
Binary file
|