Skip to main content

OpenTelemetry Integration Set Up

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.

New to Multiplayer​


If you’re new to Multiplayer we recommend following this 2-minute set up:

  • Create a workspace, project, and team
  • Visualize your system architecture with a platform (import an existing diagram image or manually add your platform components)
  • Invite your team

For optimal results with Auto-Documentation, we also recommend to:

New to OpenTelemetry​


What is OpenTelemetry​

OpenTelemetry (OTel) is an observability framework and toolkit designed to create and manage telemetry data such as traces, metrics, and logs. It’s a vendor- and tool-agnostic, open source Cloud Native Computing Foundation (CNCF) project, born out of the need to standardize how to instrument code and send telemetry data to an observability backend.

Get Started with OpenTelemetry​

Instrumenting OTel in your application requires five minutes. Here are the steps:

  • Import the OpenTelemetry API and SDK
  • Configure the OpenTelemetry API
  • Configure the OpenTelemetry SDK
  • Create Telemetry Data

OTel provides language specific “getting started” guides for C++, .NET, Erlang/Elixir, Go, Java, JavaScript / Typescript, PHP, Python, Ruby, Rust, Swift, etc.

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"
  • Two unique tokens will be created for your OTel configuration.

ℹ️ The same OTel config panel is available when navigating from the "Debugger" tab, since both Auto-Documentation and Debugger leverage the same 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.

Add the OTel tokens to your software​

Multiplayer automatically generated two tokens:

  • OpenTelemetry Frontend Token (Debugger)
  • OpenTelemetry Backend Token (Auto-Documentation)

We recommend setting both so that you can fully leverage the full suite of Multiplayer features for managing distributed systems.

(1) Add the environment variable for the OpenTelemetry Frontend Token (Debugger)

  1. Install the Platform Debugger npm library: https://www.npmjs.com/package/@multiplayer-app/session-debugger

You can install the Multiplayer Platform Debugger using npm or yarn:

`npm install @multiplayer-app/session-debugger

or

yarn add @multiplayer-app/session-debugger`

  1. Import the Debugger

import debuggerInstance from "@multiplayer-app/session-debugger";

  1. Copy the Multiplayer OpenTelemetry Frontend Token (Debugger)

  2. Use the following code to initialize the debugger with your application details:

debuggerInstance.init({ version: "{YOUR_APPLICATION_VERSION}", application: "{YOUR_APPLICATION_NAME}", environment: "{YOUR_APPLICATION_ENVIRONMENT}", apiKey: "{OpenTelemetry_Frontend_Token}", });

Replace the placeholders with your application’s version, name, environment, and the copied OpenTelemetry Frontend Token (Debugger).

  1. Add User Metadata

To track user-specific metadata in session replays, add the following:

window["mpSessionDebuggerMetadata"] = { userId: "{userId}", userName: "{userName}", };

Replace the placeholders with the actual user information (e.g., user ID and username).

(2) Add the environment variable for the OpenTelemetry Backend Token (Auto-Documentation)

Your approach to implementing the Multiplayer OTel integration will be slightly different depending on how you use OTel.

Using OTel for a single observability backend (i.e. Multiplayer)

If you’ll be using OTel to send telemetry data to a single observability backend (i.e. only to Multiplayer), add these environment variables:

OTEL_EXPORTER_OTLP_HEADERS="Authorization={{OpenTelemetry_Backend_Token}}"

  • OTEL_EXPORTER_OTLP_TRACES_ENDPOINT - OTel Docs

OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://api.multiplayer.app/v1/traces

  • OTEL_EXPORTER_OTLP_LOGS_ENDPOINT - OTel Docs

OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://api.multiplayer.app/v1/logs

Using OTel for multiple observability backends

If you’ll be using OTel to send telemetry data to multiple observability backends, you would need to follow these steps.

Confirm Your Set Up​

Once you click "Done", we will proceed with the Multiplayer OTel integration and start adding 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.