Telemetry

Send anonymous diagnostics and metrics from editors and collaboration servers to OpenTelemetry, Prometheus, Sentry, or your own logger, without sending document content.

@docx-editor.dev/telemetry is available in version 2.29.0 and later.

@docx-editor.dev/telemetry sends anonymous diagnostics and metrics to your monitoring tools. It covers single-user editors, collaboration clients, and collaboration servers.

Configure exporters to send data, and choose which areas to record. Built-in diagnostics contain codes, booleans, bucketed sizes and counts, and timings. They exclude document text, file names, part names, author names, font names, and room names. You control any attributes you add and any data your monitoring SDKs collect.

Rendering diagram…

flowchart LR
  E[Editor] -- diagnostics --> T[createTelemetry]
  S[Collaboration server] --> R[withCollaborationTelemetry or roomTelemetry]
  T --> X[Exporters]
  R --> X
  X --> O[OpenTelemetry SDK]
  X --> P[Prometheus /metrics]
  X --> Y[Sentry]
  X --> C[Your callback]

Choose an exporter

NeedUseEntry point
Metrics and traces in any backend that accepts OTLP, such as Datadog, Grafana, Honeycomb, or New RelicOpenTelemetry, through your own SDK@docx-editor.dev/telemetry/otel
A scrape endpoint for Prometheus or Grafana AgentPrometheus text format@docx-editor.dev/telemetry/prometheus
Grouped error issues for editor and server-agent failuresSentry@docx-editor.dev/telemetry/sentry
A log service over HTTP, such as Better Stack, Axiom, or Datadog LogsAn HTTP exporter and a route on your server@docx-editor.dev/telemetry and @docx-editor.dev/telemetry/ingest
Any other tool, such as Datadog RUM, PostHog, or your loggerA callback@docx-editor.dev/telemetry

Metrics use the OpenTelemetry model. Prometheus metric names replace dots with underscores and include units: docx_editor.collab.room.load.duration in seconds becomes docx_editor_collab_room_load_duration_seconds.

Install

npm install @docx-editor.dev/telemetry @docx-editor.dev/core

Install the peer dependencies for the integrations you use:

  • OpenTelemetry: @opentelemetry/api.
  • Room telemetry: yjs and @docx-editor.dev/pro.
  • Hocuspocus: @hocuspocus/server 4.6 or later.

The Sentry exporter uses your app's Sentry SDK. The Prometheus exporter has no dependencies. Editor apps also need @docx-editor.dev/react or @docx-editor.dev/vue. Add @docx-editor.dev/pro for review and collaboration.

Privacy

  • The package never sends data by itself. It sends only to the exporters you configure.
  • Diagnostics use fixed sets of codes, booleans, bucketed sizes and counts, and timings. Document text, file and part names, author names, font names, and exception messages are never included.
  • The engine builds each event this way, and the package checks each event again before an exporter receives it.
  • You control identifiers in attributes, resource, and metricLabels. You also control what your Sentry and OpenTelemetry SDKs collect.

For fields and validation rules, see Privacy. To review your settings, see Privacy review checklist.

Where to start

Review data collection, set up your editor, then choose a destination. Use the other guides for specific tasks.

  1. Privacy: what is sent and what is never sent. Start here for a privacy review, then complete the Privacy review checklist.
  2. Set up an editor: create the client, register its module, and choose what to record.
  3. Send the data to your backend:
  4. Optional:
  5. Monitor your app with Dashboards. For metric names and labels, see Metrics.

For every diagnostic code and its hint, see Diagnostics. For complete setups, see the single-user example, the collaboration example, and the dashboards stack.