Export data to InfluxDB or JSON

You can export scenario data to an InfluxDB database, or to files in JSON format.

About exporting data to InfluxDB

InfluxDB is a time series database that can store large volumes of time series data, and perform real-time analysis on that data.

Data from your scenario runs can be exported to an external InfluxDB database, enabling you to use the data in applications other than Analysis. The data is output to a running InfluxDB server, versions 1.8 or 2.x.

Using an external database enables data mashing with other tools and data vendors, and using third-party dashboards, such as Grafana, to easily visualize the data. A customized Grafana dashboard is available—download the LoadRunner dashboard from Grafana dashboards.

To enable the data export, you must set up a working connection to the InfluxDB server. For details, see Connect to an external InfluxDB server.

You can export the online run summary data, and/or the raw results data:

  • The online summary data is the same data displayed in the Controller graphs. You can configure Controller to export this data in real time to InfluxDB. The data is then automatically exported whenever you run a scenario.

  • The raw results data is the raw data collated from the load generators. You can configure Controller to export this collated data during runtime, or trigger export at the end of a scenario run. For details, see Export raw data to InfluxDB .

    You can also configure the connection to the InfluxDB server and raw data export from the command line. For details, see Export raw data to InfluxDB from the command line.

Note:  

  • Exporting online run data is supported from version 24.3.

  • In your InfluxDB configuration file, we recommend you set max-values-per-tag= 0 to allow for unlimited values per tag. For details, refer to the InfluxDB product documentation.

Back to top

Connect to an external InfluxDB server

You must set up a working connection to the InfluxDB server in order to export data.

To configure the connection to the InfluxDB server:

  1. Prerequisites:

    • Secure Communication. To enable secure communication with your InfluxDB server, you need to use either a self-signed or trusted CA signed certificate. Copy the InfluxDB server certificate to the Controller machine.

      For details on configuring InfluxDB to work with HTTPS, see the InfluxDB documentation.

    • InfluxDB 2.x. By default, the online data export works with InfluxDB version 1.8. To work with InfluxDB version 2.x, you must first run the following InfluxDB commands from the command line interface.

      The same defined database name, username, and password should then be used in the Online Data Export Settings dialog box.

      Copy code
      influx.exe v1 auth create --username User --password Password --token YourToken --org YourOrg --read-bucket bucketId --write-bucket bucketId              
      influx.exe v1 dbrp create --bucket-id bucketId --rp DEFAULT_RP --db DatabaseName --default --token YourToken  --org YourOrg
  2. In Controller, select Results > Influx Settings, and select the relevant option:

    • Raw Data Export Settings

    • Online Data Export Settings

      Version support: Online data is export is supported from version 24.3.

  3. In the displayed Data Export Settings dialog box, configure the connection to the InfluxDB server.

    User interface elements are described below. The parameters vary, depending on the data type to export, and the selected InfluxDB version.

    UI Elements

    Description

    Influx version

    Select one of supported versions.

    Server URL

    Define the URL or IP address of the external database server, and include the port number.

    For example: http://my-influx-url:8086

    HTTPS URLs are supported, as long as the appropriate certificates have been installed.

    Database name

    The name of the database server.

    Note: For online data on InfluxDB version 2.x, the database name must be the same as used for the bucket you created for the server.

    Username and Password

    These settings must be completed if the InfluxDB server requires authentication; otherwise, they can remain blank.

    Note: For online data on InfluxDB version 2.x, the username and password must be the same as used for the bucket you created for the server.

    Proxy Authentication

    Enter proxy server details, if relevant.

    Organization ID The ID used in InfluxDB for your organization.
    API Token The InfluxDB token that provides authentication to write to your bucket.
    Bucket name The name of the InfluxDB bucket where the data is stored.
  4. Click Test Connection to make sure the details are correct.
  5. Save the settings. The settings remain in effect until changed.

The connection is now ready to export online data whenever you run a scenario.

To export raw data, see Export raw data to InfluxDB .

Tip: To stop automatic export of online data, use the Clear button in the Online Data Export Settings dialog box to remove the settings and break the connection.

Back to top

Export raw data to InfluxDB

Exporting raw data to other formats is useful when, for example, the run results are too large for Analysis to handle, or when you want to use test data in applications developed for your specific needs.

The raw data from the run results can be exported to InfluxDB at the end of a scenario run, or collated and exported during runtime. Exporting data at runtime reduces the time spent collating and exporting data at the end of a scenario run.

You can set up the data export in the UI, or from the command line. For details on the latter, see Export raw data to InfluxDB from the command line.

For details on the raw data that is exported to InfluxDB, see Raw data storage tables.

To export raw data to InfluxDB from UI:

  1. Set up the connection to the InfluxDB server. For details, see Connect to an external InfluxDB server.

  1. To collate the raw data at runtime, in the Collate Settings dialog box select Automatically export results to InfluxDB. For details, see Collate scenario run results.
  2. To export the raw data at the end of a scenario run, in the Controller menu, select Results > Export to Influx.

    A notification pane opens. During the export, status and messages are displayed in this pane. When the export is complete, click Close.

Back to top

Export raw data to InfluxDB from the command line

You can export raw results data to InfluxDB from the command line.

Enter the following on the command line:

Copy code
LrRawResultsExporter -source_dir <folder_path>
     [-to_influx -influx_url <server url> -database <database name>] [-user <username> -password <password>]
     [-proxy_server <server url> -proxy_user <username> -proxy_password <password>]
     [-target_dir <folder_path> -to_json] 

Parameters:

Option Description

-source_dir

The location of the source file (.lrr) containing the scenario run results.
-to_influx Instructs the Exporter to export the raw data to InfluxDB.
-database The InfluxDB database name.
-influx_url

The InfluxDB server address, including the port number.

HTTPS URLs are supported, as long as the appropriate certificates have been installed.

-password The InfluxDB password.
-username The InfluxDB user name.
-proxy_url The proxy server address, including the port number.
-proxy_user The proxy username. Include if proxy requires authentication.
-proxy_password The proxy password. Include if proxy requires authentication.
-to_json Exports the data to the target directory in JSON format (see Export data to JSON). Data can be exported simultaneously to both JSON and InfluxDB.

For details on the raw data that is exported to InfluxDB, see Raw data storage tables.

Back to top

Raw data storage tables

The raw data exported to InfluxDB is stored in the database in the following tables:

Table Description
Error The error events that occurred during the scenario run.
Transaction Complete transaction information.
TransactionBreakdown Transaction breakdown information.
VuserCount Vuser count during the scenario run.
DataPoint Datapoint information recorded during the script run.
MonitorDataPoint Datapoint information recorded by monitors during the run.
TransactionBreakdownTruClient TruClient transaction breakdown information, containing client-side measurements.

Back to top

Export data to JSON

Exporting test results in JSON format enables you to use the data in applications other than Analysis.

The data exported to JSON is output to a folder, and contained in a set of files:

RunInfo.txt

Contains information about the scenario run that generated the processed raw results.

offline.txt Contains the offline monitor data recorded by the monitors set up in the scenario run.
offlineMetadata.txt Contains additional metadata for the offline monitor datapoints stored in offline.txt.
*.eve As in the original .eve files, these files contain all the information recorded from the run: transaction data, transaction breakdown data (including for TruClient), errors (script errors only), and web-related data points.

To export raw data in JSON format, enter the following on the command line:

Copy code
LrRawResultsExporter -source_dir <folder_path>
-target_dir <folder_path> -to_json [-f]

Parameters:

Option Description

‑source_dir

The location of the source file (.lrr) containing the scenario run results.
-target_dir -to_json Instructs the Exporter to export the raw data to JSON files in the specified target folder.

-f

Forces the execution of the application, automatically overwriting the target directory if it already exists.

Back to top

Excluding time zone information from exported data

By default, the result time zone information is included in the exported raw results data.

When exporting to InfluxDB or JSON, you can configure the export to exclude the time zone information.

To exclude the timezone:

  1. Open the <LoadRunner Professional root folder>\Analysis\LrRawResultsExporter.ini file. If the file does not exist, create a file by the name LrRawResultsExporter.ini in that location.

  2. Add the following line: IncludeResultTimeZone=0.

This setting is effective for:

  • Controller. If you set this configuration and then select Export to InfluxDB from the Controller user interface, the exported data will not contain the time zone difference. For details, see Export data to InfluxDB or JSON.

  • Raw Results Exporter. If you use the command line Raw Results Exporter tool to export raw data to Influx or JSON, the exported data will not contain the time zone difference. For details, see Export data to InfluxDB or JSON.

Back to top

See also: