HotupdaterHot Updater
Integration Plugins

Datadog

The `withDatadog()` plugin for hot-updater enables automatic sourcemap upload to Datadog during the update bundle build process.

Prerequisites

  • Datadog Account: Sign up here if you don't have one.
  • Auth Token: Generate a token from your Datadog dashboard. This must be defined as the environment variable DATADOG_API_KEY.
  • Datadog host: in order to communicate with Datadog, you need to specify the host to which the Auth token refers using the environment variable DATADOG_HOST (e.g., DATADOG_HOST=datadoghq.eu)
  • Install the plugin:
npm install @hot-updater/datadog-plugin @datadog/datadog-ci --save-dev

Step 1: Wrap Your Build Plugin

Use withDatadog() to wrap any compatible build plugin such as bare.

Once wrapped, sourcemaps will automatically be uploaded to Datadog when running the hot-updater deploy process.

hot-updater.config.ts
import { bare } from "@hot-updater/bare";
import { withDatadog } from "@hot-updater/datadog-plugin";
import { defineConfig } from "hot-updater";
import { config } from "dotenv";

config({ path: ".env.hotupdater" });

export default defineConfig({
  build: withDatadog(
    bare({
      enableHermes: false, // or true, depending if you want to use it
      sourcemap: true, // Required for sourcemap upload
    }),
    {
      buildNumber: "build number",       // The build number through which Datadog will sort the uploaded sourcemaps belonging to the same version
      releaseVersion: "release version",    // This is the release version that must match the release version used to stream logs from the app
      service: "service", // The datadog service to which the sourcemaps belong
    },
  ),
  // .. your other config
});
hot-updater.config.ts
import { withDatadog } from "@hot-updater/datadog-plugin";
import { defineConfig } from "hot-updater";
import { expo } from "@hot-updater/expo";

export default defineConfig({
  build: withDatadog(
    expo({
      sourcemap: true, // Required for sourcemap upload
    }),
    {
      buildNumber: "build number",       // The build number through which Datadog will sort the uploaded sourcemaps belonging to the same version
      releaseVersion: "release version",    // This is the release version that must match the release version used to stream logs from the app
      service: "service", // The datadog service to which the sourcemaps belong
    },
  ),
  // .. your other config
});
hot-updater.config.ts
import { withDatadog } from "@hot-updater/datadog-plugin";
import { defineConfig } from "hot-updater";
import { rock } from "@hot-updater/rock";

export default defineConfig({
  build: withDatadog(
    rock({
      sourcemap: true, // Required for sourcemap upload
    }),
    {
      buildNumber: "build number",       // The build number through which Datadog will sort the uploaded sourcemaps belonging to the same version
      releaseVersion: "release version",    // This is the release version that must match the release version used to stream logs from the app
      service: "service", // The datadog service to which the sourcemaps belong
    },
  ),
  // .. your other config
});

Automatic Upload

When withDatadog() wraps your build plugin, all generated sourcemaps are uploaded to Datadog automatically during the hot-updater deploy process.

Step 3: Deploy

Now, every time you deploy, sourcemaps will be automatically uploaded to Datadog.

npx hot-updater deploy -i