Gravity_Forms\Gravity_Forms\Abilities\GF_Abilities_Telemetry
Counts ability executions for the weekly telemetry snapshot.
Keeps one set of running totals per ability: calls, errors bucketed by error code, permission denials, and summed duration. The totals only grow, like the email and REST API counters in GFCommon, and the telemetry server computes period deltas. Nothing from the input or the result is stored, and nothing is counted unless the site has enabled data collection.
Counters use a plain read, add, write on one option. Concurrent requests can lose an increment, which is the same ceiling the GFCommon counters accept.
Since: 3.2.2
Source: includes/abilities/class-gf-abilities-telemetry.php:21
Details
- Kind:
class - Namespace:
Gravity_Forms\Gravity_Forms\Abilities
Methods
| Method | Description |
|---|---|
register_snapshot_hook() | Add the abilities section to the telemetry snapshot. |
register_execution_hooks() | Count ability executions when the site allows data collection. |
is_data_collection_allowed() | Whether the site has enabled data collection on the Settings page. |
before_execute() | Start the execution timer. |
after_execute() | Count a finished execution, its duration, and its error code. |
permission_denied() | Count a denied execution attempt. |
add_snapshot_callback() | Register the snapshot callback with the telemetry service. |
get_snapshot_data() | Get the abilities section of the telemetry snapshot. |
Method Reference
register_snapshot_hook()
public function register_snapshot_hook()
Add the abilities section to the telemetry snapshot.
Registered even when MCP is off, so the snapshot reports that state.
Returns
void
Since: 3.2.2
Source: includes/abilities/class-gf-abilities-telemetry.php:55
register_execution_hooks()
public function register_execution_hooks()
Count ability executions when the site allows data collection.
Returns
void
Since: 3.2.2
Source: includes/abilities/class-gf-abilities-telemetry.php:66
is_data_collection_allowed()
public function is_data_collection_allowed()
Whether the site has enabled data collection on the Settings page.
Returns
bool
Since: 3.2.2
Source: includes/abilities/class-gf-abilities-telemetry.php:83
before_execute()
public function before_execute( $ability_name, $input, $ability )
Start the execution timer.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$ability_name | string | The registered ability name. | |
$input | array | The input passed to the ability. | |
$ability | object | The ability instance being executed. |
Returns
void
Since: 3.2.2
Source: includes/abilities/class-gf-abilities-telemetry.php:98
after_execute()
public function after_execute( $ability_name, $input, $result, $ability )
Count a finished execution, its duration, and its error code.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$ability_name | string | The registered ability name. | |
$input | array | The input passed to the ability. | |
$result | mixed | The execution result, a WP_Error on failure. | |
$ability | object | The ability instance that was executed. |
Returns
void
Since: 3.2.2
Source: includes/abilities/class-gf-abilities-telemetry.php:114
permission_denied()
public function permission_denied( $ability_name )
Count a denied execution attempt.
Denials never reach after_execute, so they are not part of "calls".
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$ability_name | string | The registered ability name. |
Returns
void
Since: 3.2.2
Source: includes/abilities/class-gf-abilities-telemetry.php:144
add_snapshot_callback()
public function add_snapshot_callback( $callbacks )
Register the snapshot callback with the telemetry service.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$callbacks | array | Callbacks that each return snapshot data. |
Returns
array
Since: 3.2.2
Source: includes/abilities/class-gf-abilities-telemetry.php:161
get_snapshot_data()
public function get_snapshot_data()
Get the abilities section of the telemetry snapshot.
Returns
array— Empty when data collection is off.
Since: 3.2.2
Source: includes/abilities/class-gf-abilities-telemetry.php:174