Newer Version Available

This content describes an older version of this product. View Latest

MetricsDataFile

Represents a data file containing usage metrics on all installations of a managed package in a Salesforce instance. This object is available in API version 30.0 and later.

Supported Calls

query(), delete()

Fields

Field Name Details
MetricsDataFile
Type
base64
Properties
Filter, Query, Sort
Description
A text file containing the usage data encoded in Base 64.
MetricsDataFileContentType
Type
string
Properties
Filter, Query, Sort
Description
The format of the data file. Currently, the only allowed value is text/csv.
MetricsDataFileLength
Type
int
Properties
Filter, Query, Sort
Description
The size of the data file in bytes.
MetricsRunDate
Type
dateTime
Properties
Filter, Query, Sort
Description
The date when the usage metrics collection job was run.
MetricsEndDate
Type
dateTime
Properties
Filter, Query, Sort
Description
The end time and date for the data collection.
MetricsStartDate
Type
dateTime
Properties
Filter, Query, Sort
Description
The start time and date for the data collection.
MetricsType
Type
picklist
Properties
Filter, Query, Sort
Description
The type of data being collected. The possible values are CustomObject and Visualforce.
NamespacePrefix
Type
string
Properties
Filter, Query, Sort
Description
The namespace prefix of the package for which data is being collected.
SendingInstance
Type
string
Properties
Filter, Query, Sort
Description
The server instance from which this data was collected, for example, “na8.”

Usage

Use this object to access customer usage metrics for a managed package. Each record contains one day’s data, on either custom objects or Visualforce pages, for all organizations in a Salesforce instance that have the package installed. The following data is collected each day.

  • Custom objects — the number of records stored in each custom object.
  • Visualforce pages — the number of times each Visualforce page was accessed, the number of unique users who accessed it, and the average loading time (in milliseconds).

The custom objects data is a snapshot that reflects the state of the organization at the time the database was sampled, while the Visualforce data covers usage over a 24-hour period.

This feature is intended for API access only. The owner of the package must write a secondary process to retrieve the metrics data from the reporting organization, and export it to another system for analysis.

The usage metrics data for all production organizations in a given instance is merged and written into a text file, in a specified format, once a day. If an instance doesn’t have any organizations with the package installed or any organizations that accessed Visualforce pages in the package, a blank record is created for that day, with MetricsDataFileLength set to zero.

In a record for custom objects, each row of the text file contains usage data in the following order.
  • Organization ID
  • Organization name
  • Organization edition
  • Organization status
  • Name of the custom object
  • Number of records of the custom object on the specified day
The custom object count is a snapshot captured once each day. Here’s a section of a sample data file for custom objects. It shows there were 3500 and 1500 records in the Alpha and Beta custom objects, respectively, in the specified customer organization on the specified day.
1"00Dxx0000001gbk","org1","Enterprise Edition","TRIAL","Alpha", "3500"
2"00Dxx0000001gbk","org1","Enterprise Edition","TRIAL","Beta", "1500"
In a record for Visualforce pages, each row of the text file contains usage data in the following order.
  • Organization ID
  • Organization name
  • Organization edition
  • Organization status
  • Package version number
  • Name of the Visualforce page
  • Number of times the page was accessed
  • Number of unique users who accessed the page
  • Average loading time of the page, in milliseconds

The Visualforce counts for each organization measure the number of times the page was viewed in the duration between the start and end times. Here’s a section of a sample data file for Visualforce pages.

1"00Dxx0000001gbk","org1","Enterprise Edition","TRIAL","1.0","/apex/gm12__f1","1","1","66.0"
2"00Dxx0000001gbk","org1","Enterprise Edition","TRIAL","1.0","/apex/gm12__f2","1","1","128.0"
3"00Dxx0000001gbk","org1","Enterprise Edition","TRIAL","1.0","/apex/gm12__f3","1","1","107.0"
4"00Dxx0000001gbf","org1","Enterprise Edition","TRIAL","1.0","/apex/gm12__f1","5","1","73.6"
5"00Dxx0000001gbf","org1","Enterprise Edition","TRIAL","1.0","/apex/gm12__f2","1","1","72.0"
6"00Dxx0000001gbf","org1","Enterprise Edition","TRIAL","1.0","/apex/gm12__f3","7","1","50.8"