Add Grafana dashboard and wp-prometheus integration (v0.7.5)
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:
2026-02-03 11:29:14 +01:00
parent cfd34c9329
commit 57e1b838cc
7 changed files with 2082 additions and 2 deletions

View File

@@ -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',
]);
}
/**