Class DevModeUsageStatistics

java.lang.Object
com.vaadin.base.devserver.stats.DevModeUsageStatistics

public class DevModeUsageStatistics extends Object
Singleton for collecting development time usage metrics

All statistics gathering methods in this class are static for easy caller code and they immediately update the stored JSON on disk.

For internal use only. May be renamed or removed in a future release.

Since:
Author:
Vaadin Ltd
  • Method Details

    • init

      public static DevModeUsageStatistics init(File projectFolder, StatisticsStorage storage, StatisticsSender sender)
      Initialize the statistics module.

      This should only ever be called in development mode.

      Parameters:
      projectFolder - the folder of the current project
      storage - the statistics storage to use
      sender - the statistics sender to use
      Returns:
      the created instance or null if telemetry is not used
    • handleBrowserData

      public static void handleBrowserData(elemental.json.JsonObject data)
      Stores telemetry data received from the browser.
      Parameters:
      data - the data from the browser
    • collectEvent

      public static void collectEvent(String name)
      Increments specified event count in the current project data.

      Good for logging statistics of recurring events.

      Parameters:
      name - Name of the event.
    • collectEvent

      public static void collectEvent(String name, double value)
      Update a value in usage statistics. Also, automatically aggregates min, max and average of the value.

      Good for logging statistics about chancing values over time.

      Parameters:
      name - Name of the field to update.
      value - The new value to store.
    • set

      public void set(String name, String value)
      Set value of string value in current project statistics data.
      Parameters:
      name - name of the field to set.
      value - the new string value to set.
    • setGlobal

      public void setGlobal(String name, String value)
      Set value of string field in current statistics data.
      Parameters:
      name - name of the field to set.
      value - the new string value to set.