Implement Phase 9: Prometheus Metrics (v0.9.0)
All checks were successful
Create Release Package / build-release (push) Successful in 1m8s
All checks were successful
Create Release Package / build-release (push) Successful in 1m8s
- Add Prometheus metrics integration via wp-prometheus hooks - Create Grafana dashboard JSON with 24 panels - Add metrics settings tab with enable/disable toggle - Expose inventory, booking, occupancy, revenue, and guest metrics Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
61
README.md
61
README.md
@@ -21,6 +21,7 @@ WP BnB Management enables WordPress to act as a full management system for B&B h
|
||||
- **Contact Form 7 Integration**: Accept booking requests and inquiries through CF7 forms
|
||||
- **Dashboard**: Comprehensive admin dashboard with statistics and charts
|
||||
- **Reports**: Detailed reports with CSV and PDF export
|
||||
- **Prometheus Metrics**: Expose operational metrics for monitoring with Grafana
|
||||
|
||||
### Requirements
|
||||
|
||||
@@ -383,6 +384,66 @@ add_action( 'wp_bnb_before_booking_create', function( $booking_data ) {
|
||||
} );
|
||||
```
|
||||
|
||||
## Prometheus Metrics
|
||||
|
||||
The plugin integrates with [WP Prometheus](https://src.bundespruefstelle.ch/magdev/wp-prometheus) to expose operational metrics for monitoring with Prometheus and Grafana.
|
||||
|
||||
### Enabling Metrics
|
||||
|
||||
1. Install and activate the WP Prometheus plugin
|
||||
2. Navigate to **WP BnB → Settings → Metrics**
|
||||
3. Enable "Expose BnB metrics via Prometheus"
|
||||
4. Metrics will be available at your site's `/metrics/` endpoint
|
||||
|
||||
### Available Metrics
|
||||
|
||||
**Inventory Metrics:**
|
||||
|
||||
- `wp_bnb_buildings_total` - Total number of buildings
|
||||
- `wp_bnb_rooms_total{status}` - Rooms by status (available, occupied, maintenance, inactive)
|
||||
- `wp_bnb_services_total{status}` - Services by status (active, inactive)
|
||||
- `wp_bnb_total_capacity_beds` - Total bed capacity across all rooms
|
||||
|
||||
**Booking Metrics:**
|
||||
|
||||
- `wp_bnb_bookings_total{status}` - Bookings by status (pending, confirmed, checked_in, checked_out, cancelled)
|
||||
- `wp_bnb_checkins_today` - Check-ins scheduled for today
|
||||
- `wp_bnb_checkouts_today` - Check-outs scheduled for today
|
||||
- `wp_bnb_bookings_upcoming_7days` - Bookings starting in next 7 days
|
||||
- `wp_bnb_booking_avg_duration_nights` - Average booking duration
|
||||
|
||||
**Occupancy Metrics:**
|
||||
|
||||
- `wp_bnb_occupancy_rate_current` - Current room occupancy rate (percentage)
|
||||
- `wp_bnb_occupancy_rate_this_month` - Monthly occupancy rate (percentage)
|
||||
- `wp_bnb_rooms_currently_occupied` - Rooms currently occupied
|
||||
|
||||
**Revenue Metrics:**
|
||||
|
||||
- `wp_bnb_revenue_this_month{currency}` - Revenue for current month
|
||||
- `wp_bnb_revenue_ytd{currency}` - Revenue year to date
|
||||
- `wp_bnb_booking_avg_value{currency}` - Average booking value
|
||||
- `wp_bnb_services_revenue_this_month{currency}` - Services revenue this month
|
||||
|
||||
**Guest Metrics:**
|
||||
|
||||
- `wp_bnb_guests_total` - Total registered guests
|
||||
- `wp_bnb_guests_by_status{status}` - Guests by status (active, blocked, vip)
|
||||
- `wp_bnb_guests_repeat` - Guests with more than one booking
|
||||
- `wp_bnb_guests_new_this_month` - New guests this month
|
||||
|
||||
### Grafana Dashboard
|
||||
|
||||
A pre-configured Grafana dashboard is included at `assets/grafana/wp-bnb-dashboard.json`. If WP Prometheus is installed, the dashboard is automatically registered and available for export.
|
||||
|
||||
The dashboard includes:
|
||||
|
||||
- Occupancy gauges with color-coded thresholds
|
||||
- Bookings, rooms, and guests pie charts by status
|
||||
- Revenue and guest statistics panels
|
||||
- Today's check-ins/check-outs
|
||||
- Trend indicators
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
### Do I need a license to use this plugin?
|
||||
|
||||
Reference in New Issue
Block a user