Overview

The Electron SDK collects data from two sources:

  • Renderer processes are monitored by the Browser SDK. Views, actions, resources, errors, and other renderer events follow the Browser data collected reference.
  • The main process is monitored by the Electron SDK, which generates RUM events, and by dd-trace-js, which generates traces.

Every event has attributes. See the Shared attributes section. Quantifiable attributes can be used for measurements related to the event, while non-quantifiable attributes can be used to filter and group telemetry in analytics (group by). You can further enrich your data by adding global context.

Main process RUM events

Event typeRetentionDescription
Session30 daysA session represents a continuous usage period in your application. All RUM events generated during the session, from the main process and the renderer processes, share the same session.id.
Error30 daysAn error represents an exception or problem in the main process, such as an uncaught Node.js error or a native crash.
Resource15 daysA resource represents a network request made by the main process.
Vital15 daysA vital represents a custom duration vital or an operation step recorded in the main process.

Main process events are not attached to a view.

Execution context

An execution context is a unit of code execution, such as an operating system process of your application. Events carry the following attributes to identify the process that generated them:

Attribute nameTypeDescription
execution_context.idstringUnique identifier (UUID) of the execution context.
execution_context.typestringType of the execution context: main-process or renderer-process.
execution_context.namestringName of the execution context. See the following table.

The name of the main process is Main Process. The name of a renderer process is derived from the URL of its window, after the page is loaded:

Window URLName
External host (for example, https://example.com)Origin and path. Query, fragment, and credentials are dropped.
localhost or a custom protocol such as app://Path, query, and hash.
file://Filename, followed by any query and hash.

Names are truncated to 200 characters. You can modify execution_context.name in beforeSendRum.

To filter events by process in the RUM Explorer, use the execution_context.type facet. For example, @execution_context.type:main-process shows only events generated by the main process.

Main process traces

The Electron SDK uses and configures dd-trace-js, so tracing requires no additional setup. The SDK generates traces for the following main process activity:

  • Network requests
  • Command execution

To control how many traces are kept, see Trace sampling rules.

Shared attributes

The following attributes are attached to events from the main process and the renderer processes.

Common core attributes

Attribute nameTypeDescription
application.idstringThe RUM application ID.
dateintegerStart of the event in milliseconds from epoch.
servicestringThe unified service name for this application. Main process events report the service set in the Electron SDK init. Renderer events report the service set in the Browser SDK init.
envstringThe environment tag (for example, production or staging), set with the env initialization parameter.
versionstringThe application version. Main process events report the version set in the Electron SDK init. Renderer events report the version set in the Browser SDK init.
typestringThe type of the event (for example, session, error, or resource).

For the initialization parameters, see Initialization parameters. To choose service and version values that match your uploaded source maps, see Prepare your source maps.

Operating system

Datadog derives the following attributes from the user agent that the SDK sends with its uploads. The SDK builds this user agent from the operating system, its version, and the CPU architecture.

Attribute nameTypeDescription
os.namestringThe OS name, as reported in the user agent.
os.versionstringThe OS version, as reported in the user agent. Linux user agents do not include the OS version.
os.version_majorstringThe OS major version, as reported in the user agent.

Device

Datadog derives the following attribute from the same user agent.

Attribute nameTypeDescription
device.typestringThe device type, as reported in the user agent.

Geolocation

Datadog resolves geolocation attributes (geo.country, geo.city, and others) from the client IP address. To stop collecting them, change the setting in your application details.

User and account attributes

Events from the main process and the renderer processes include the user (usr.id, usr.name, usr.email) and account (acc.id, acc.name) information you set. See User and account information.

Global context

Attributes set with the global context are sent in the context field of events. Renderer processes keep their own global context, set with the Browser SDK. Both are merged on renderer events, and the renderer value wins when a key is in both. See Global context.

Data storage

The SDK stores events on disk before uploading them to Datadog. Events are preserved across application restarts, so data collected before an unexpected shutdown is sent on the next launch.

The tracking consent decides what the SDK keeps and sends. While consent is 'pending', the SDK keeps data on disk until the end user decides. It deletes data kept while consent is pending if no decision is made before the next launch. When consent is 'not-granted', the SDK does not store new data.

Further reading