You've already forked wp-prometheus
feat: Add WooCommerce, cron, and transient metrics (v0.2.0)
All checks were successful
Create Release Package / build-release (push) Successful in 56s
All checks were successful
Create Release Package / build-release (push) Successful in 56s
- WooCommerce integration metrics (products, orders, revenue, customers) - Cron job metrics (events by hook, overdue count, next run timestamp) - Transient cache metrics (total, expiring, expired) - Support for WooCommerce HPOS storage - Updated settings page with new metric categories - Updated translations and documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -447,6 +447,46 @@ class Settings {
|
||||
<td><?php esc_html_e( 'Counter', 'wp-prometheus' ); ?></td>
|
||||
<td><?php esc_html_e( 'Database queries by endpoint', 'wp-prometheus' ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>wordpress_cron_events_total</code></td>
|
||||
<td><?php esc_html_e( 'Gauge', 'wp-prometheus' ); ?></td>
|
||||
<td><?php esc_html_e( 'Scheduled cron events by hook', 'wp-prometheus' ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>wordpress_cron_overdue_total</code></td>
|
||||
<td><?php esc_html_e( 'Gauge', 'wp-prometheus' ); ?></td>
|
||||
<td><?php esc_html_e( 'Number of overdue cron events', 'wp-prometheus' ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>wordpress_cron_next_run_timestamp</code></td>
|
||||
<td><?php esc_html_e( 'Gauge', 'wp-prometheus' ); ?></td>
|
||||
<td><?php esc_html_e( 'Unix timestamp of next scheduled cron', 'wp-prometheus' ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>wordpress_transients_total</code></td>
|
||||
<td><?php esc_html_e( 'Gauge', 'wp-prometheus' ); ?></td>
|
||||
<td><?php esc_html_e( 'Total transients by type', 'wp-prometheus' ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>wordpress_woocommerce_products_total</code></td>
|
||||
<td><?php esc_html_e( 'Gauge', 'wp-prometheus' ); ?></td>
|
||||
<td><?php esc_html_e( 'WooCommerce products by status and type', 'wp-prometheus' ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>wordpress_woocommerce_orders_total</code></td>
|
||||
<td><?php esc_html_e( 'Gauge', 'wp-prometheus' ); ?></td>
|
||||
<td><?php esc_html_e( 'WooCommerce orders by status', 'wp-prometheus' ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>wordpress_woocommerce_revenue_total</code></td>
|
||||
<td><?php esc_html_e( 'Gauge', 'wp-prometheus' ); ?></td>
|
||||
<td><?php esc_html_e( 'WooCommerce revenue by period', 'wp-prometheus' ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>wordpress_woocommerce_customers_total</code></td>
|
||||
<td><?php esc_html_e( 'Gauge', 'wp-prometheus' ); ?></td>
|
||||
<td><?php esc_html_e( 'WooCommerce customers by type', 'wp-prometheus' ); ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -514,6 +554,8 @@ class Settings {
|
||||
'wordpress_posts_total' => __( 'Total Posts by Type and Status', 'wp-prometheus' ),
|
||||
'wordpress_comments_total' => __( 'Total Comments by Status', 'wp-prometheus' ),
|
||||
'wordpress_plugins_total' => __( 'Total Plugins (active/inactive)', 'wp-prometheus' ),
|
||||
'wordpress_cron_events_total' => __( 'Cron Events (scheduled tasks, overdue, next run)', 'wp-prometheus' ),
|
||||
'wordpress_transients_total' => __( 'Transients (total, expiring, expired)', 'wp-prometheus' ),
|
||||
);
|
||||
|
||||
$runtime_metrics = array(
|
||||
@@ -522,6 +564,13 @@ class Settings {
|
||||
'wordpress_db_queries_total' => __( 'Database Queries Total (by endpoint)', 'wp-prometheus' ),
|
||||
);
|
||||
|
||||
$woocommerce_metrics = array(
|
||||
'wordpress_woocommerce_products_total' => __( 'WooCommerce Products (by status and type)', 'wp-prometheus' ),
|
||||
'wordpress_woocommerce_orders_total' => __( 'WooCommerce Orders (by status)', 'wp-prometheus' ),
|
||||
'wordpress_woocommerce_revenue_total' => __( 'WooCommerce Revenue (all time, today, month)', 'wp-prometheus' ),
|
||||
'wordpress_woocommerce_customers_total' => __( 'WooCommerce Customers (registered, guest)', 'wp-prometheus' ),
|
||||
);
|
||||
|
||||
echo '<fieldset>';
|
||||
echo '<legend class="screen-reader-text"><span>' . esc_html__( 'Static Metrics', 'wp-prometheus' ) . '</span></legend>';
|
||||
echo '<p><strong>' . esc_html__( 'Static Metrics', 'wp-prometheus' ) . '</strong></p>';
|
||||
@@ -551,6 +600,23 @@ class Settings {
|
||||
<?php
|
||||
}
|
||||
|
||||
// WooCommerce metrics (only show if WooCommerce is active).
|
||||
if ( class_exists( 'WooCommerce' ) ) {
|
||||
echo '<br><p><strong>' . esc_html__( 'WooCommerce Metrics', 'wp-prometheus' ) . '</strong></p>';
|
||||
echo '<p class="description" style="margin-bottom: 10px;">' . esc_html__( 'Metrics specific to WooCommerce stores. Only available when WooCommerce is active.', 'wp-prometheus' ) . '</p>';
|
||||
|
||||
foreach ( $woocommerce_metrics as $key => $label ) {
|
||||
?>
|
||||
<label style="display: block; margin-bottom: 5px;">
|
||||
<input type="checkbox" name="wp_prometheus_enabled_metrics[]"
|
||||
value="<?php echo esc_attr( $key ); ?>"
|
||||
<?php checked( in_array( $key, $enabled, true ) ); ?>>
|
||||
<?php echo esc_html( $label ); ?>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
echo '</fieldset>';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user