Plugin Directory

Changeset 2009680


Ignore:
Timestamp:
01/10/2019 08:27:11 AM (7 years ago)
Author:
rossigee
Message:

Fix to handle 'wc-' prefix (v0.0.4).

Location:
woo-prometheus-metrics/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • woo-prometheus-metrics/trunk/readme.txt

    r1961997 r2009680  
    55* Requires at least: 4.7.2
    66* Tested up to: 4.9.5
    7 * Stable tag: 0.0.2
     7* Stable tag: 0.0.4
    88* License: GPLv2
    99
     
    1313
    1414* `woocommerce_product_count` - a count of products listed.
    15 * `woocommerce_order_count` - a count of orders on the system.
    16 
    17 For later version, we might also provide order counts broken down by status.
     15* `woocommerce_order_count` - a count of orders on the system, by 'status'.
     16* `woocommerce_user_count` - a count of users on the system.
    1817
    1918We gather the metrics with the following section of Prometheus configuration:
  • woo-prometheus-metrics/trunk/woo-prometheus-metrics.php

    r2000813 r2009680  
    55Plugin URI: https://wordpress.org/plugins/woo-prometheus-metrics
    66Description: Plugin to monitor the count of products and orders on a Woocommerce site.
    7 Version: 0.0.3
     7Version: 0.0.4
    88Author: Ross Golder <ross@golder.org>
    99Author URI: http://www.golder.org/
     
    7777  $order_counts = array();
    7878  foreach($order_statuses as $order_status) {
    79     $order_counts[$order_status] = wc_orders_count($order_status);
     79    $s = substr($order_status, 3); // Drop the 'wc-' prefix
     80    $order_counts[$s] = wc_orders_count($s);
    8081  }
    8182
Note: See TracChangeset for help on using the changeset viewer.