You've already forked wc-licensed-product
Add Grafana dashboard and wp-prometheus integration (v0.7.5)
All checks were successful
Create Release Package / build-release (push) Successful in 1m9s
All checks were successful
Create Release Package / build-release (push) Successful in 1m9s
- Add example Grafana dashboard with 24 panels for license metrics - Register dashboard with wp-prometheus via hook - Add dashboard documentation with PromQL examples and alerting rules - Update README with monitoring section Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -43,6 +43,29 @@ final class PrometheusController
|
||||
}
|
||||
|
||||
add_action('wp_prometheus_collect_metrics', [$this, 'collectMetrics']);
|
||||
add_action('wp_prometheus_register_dashboards', [$this, 'registerDashboard']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Grafana dashboard with wp-prometheus
|
||||
*
|
||||
* @param object $provider The dashboard provider object
|
||||
*/
|
||||
public function registerDashboard(object $provider): void
|
||||
{
|
||||
$dashboardFile = WC_LICENSED_PRODUCT_PLUGIN_DIR . 'docs/grafana-dashboard.json';
|
||||
|
||||
if (!file_exists($dashboardFile)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$provider->register_dashboard('wc-licensed-product', [
|
||||
'title' => __('WC Licensed Product - License Metrics', 'wc-licensed-product'),
|
||||
'description' => __('Monitor license status, downloads, API usage, and validation errors.', 'wc-licensed-product'),
|
||||
'icon' => 'dashicons-admin-network',
|
||||
'file' => $dashboardFile,
|
||||
'plugin' => 'WC Licensed Product',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user