Skip to main content

Configure OpenTelemetry

๐Ÿ“Œ If you have any questions shoot us an email or join us on Discord! ๐Ÿ’œ

Overviewโ€‹


Multiplayer leverages OpenTelemetry for two features:

  • System Auto-Documentation: When enabled, it automatically discovers all components, APIs, dependencies, platforms, and environments within your software system and lists them within the System Dashboard.
  • Platform Debugger: Record and share deep session replays that include relevant data from frontend screens to distributed traces metrics and logs from your backend platform.

โ„น๏ธ These two features share the same set up window and the following OpenTelemetry configuration steps.

1. Set up the OpenTelemetry Integrationโ€‹


  • Open your project
  • In the left-side menu, click "System" to open the System Dashboard
  • Click "Enable Auto-Docs + Debugger"
  • Name your integration
  • Hit "Create"
  • An OpenTelemetry (OTel) token will be created for your OTel integration

If you would like Auto-Documentation to automatically create newly detected components that are not currently present in your Multiplayer project, select:

  • The name of the platform from the drop down menu where the new components will be auto-created
  • Toggle on "Auto-add"

โ„น๏ธ If a platform is not selected, the new components are added to the project (i.e. Components tab) but not linked to a specific Platform. If the platform is selected the components are created in the project and also added to the platform. โ„น๏ธ

Once you click โ€œConfirmโ€, we will proceed with the Multiplayer OTel integration and start automatically documenting your system and adding backend data (e.g. traces and logs) to your Platform Debugger sessions.

Please note that if you close the set up window before finishing the set up (or before copying the generated tokens), you will no longer be able to see the Otel tokens. You need to delete the integration and start again to generate new OTel tokens.

2. Configuring OTelโ€‹


  1. Install session debugger library with following command:
  npm i -S @multiplayer-app/session-debugger
  1. Initialize session debugger library:
  // NOTE: this import should be done before all other imports in your main file.
import SessionDebugger from "@multiplayer-app/session-debugger";

SessionDebugger.init({
version: "<web-app-version>",
application: "<web-app-name>",
environment: "<web-app-environment>",
apiKey: "<multiplayer-key>",
canvasEnabled: true,
showWidget: true,
ignoreUrls: [
/https:\/\/domain\.to\.ignore\/.*/, // can be regex or string
/https:\/\/another\.domain\.to\.ignore\/.*/,
],
// NOTE: if frontend domain doesn't match to backend one, set backend domain to `propagateTraceHeaderCorsUrls` parameter
propagateTraceHeaderCorsUrls: [
new RegExp("https://your.backend.api.domain", "i"), // can be regex or string
new RegExp("https://another.backend.api.domain", "i")
],
schemifyDocSpanPayload: true,
maskDebSpanPayload: true,
docTraceRatio: 0.15 // 15% of traces will be sent for auto-documentation
});

Next Stepsโ€‹


You did it! Whatโ€™s next?