Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 958992

Summary: oo-admin-usage refers to usage costs / rates / billing
Product: OpenShift Container Platform Reporter: Alex Dellapenta <adellape>
Component: NodeAssignee: chris alfonso <calfonso>
Status: CLOSED ERRATA QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 1.2.0CC: bleanhar, calfonso, gpei, hbrock, libra-onpremise-devel, mmasters
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
The output for the oo-admin-usage command included information about a user's plan, regardless of whether plans were enabled for that user (which they are not, by default). This was confusing for users because plans are not currently featured in OpenShift Enterprise. With this fix, the oo-admin-usage command has been updated to ignore reporting plan information if that feature is not enabled for a given user. The oo-admin-usage command man page has also been updated to describe the ENABLE_USAGE_TRACKING_DATASTORE setting in /etc/openshift/broker.conf and include examples for all available options.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-05 17:16:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alex Dellapenta 2013-05-02 22:11:01 UTC
Description of problem:

The oo-admin-usage script is meant to display usage data for a particular user, which includes calculating a usage cost based on usage duration and usage rate. As such the --help output and man page mention costs, rates, billing, etc. This makes sense in Online, where there would be defined usage rates and the billing provider would presumably be Red Hat, but how is this meant to work with Enterprise? AFAIK the ability (or at least the advertised/intended ability) to configure usage rates or perform any sort of billing activities for users is absent in Enterprise.

The output also refers to the user's "Plan", which currently (whether 'oo-admin-ctl-user --allowplanupgrade' has been set to 'true' or 'false' for the user) always shows as blank since I don't believe "plans" are a concept in Enterprise.

Version-Release number of selected component (if applicable):

http://buildvm-devops.usersys.redhat.com/puddle/build/OpenShiftEnterprise/1.2/2013-05-01.4/

How reproducible:

Always

Steps to Reproduce:
1. Create user and some applications for said user (>3 to avoid any potential reporting issue wrt "3 free gears").
2. Set 'oo-admin-ctl-user --allowplanupgrade' to either 'true' or 'false' (the only "plan"-related setting I've come across for users in OSE, which is the only reason I mention it).
3. Run 'oo-admin-usage -l <user>'.
  
Actual results:

[root@broker ~]# oo-admin-usage -l alexd

Usage for alexd (Plan: )
------------------------------------------
No usage data found


Expected results:

Not really even sure. Just the number of apps a user has creates and the amount of time they've been running? At the very least, the "(Plan: )" could be removed  from the output, along with any mention of costs/rates/billing providers in --help and man page as well.

Additional info:

Sans any costs- or rates-related metrics, if the admin is just trying to find basic usage data about a user, it seems like the oo-stats script provides plenty. Maybe oo-admin-usage doesn't make sense for Enterprise?

Comment 2 Alex Dellapenta 2013-05-10 20:56:18 UTC
For the record, after setting ENABLE_USAGE_TRACKING_DATASTORE="true" in /etc/openshift/broker.conf and adding tracked storage to some apps, I'm getting usage data with this script:

======

[root@broker ~]# oo-admin-usage -l alexd

Usage for alexd (Plan: )
------------------------------------------
#1
 Usage Type: GEAR_USAGE (small)
    Gear ID: 518bcaa26892dfcb74000001 (MyApp1)
   Duration: 1 days and 4 hours (2013-05-09 12:11:23 - PRESENT)

#2
 Usage Type: GEAR_USAGE (small)
    Gear ID: 518bcb876892dfcb74000017 (MyApp2)
   Duration: 1 days and 4 hours (2013-05-09 12:15:10 - PRESENT)

Note: The cost displayed is based on the usage duration and the usage rate. It does not take into account any unbilled usage by the billing provider.

======

The only outstanding weirdness is showing "(Plan: )" after the user name and the "Note:" at the bottom. Looks like the Cost line doesn't show up at all if there's nothing to calculate (versus when there is, as seen in https://tcms.engineering.redhat.com/case/241841/). Could maybe the "(Plan: )" and "Note:" bits be omitted if either Plan is blank or costs aren't displayed, respectively?

Also just for fun, here's the output I'm getting from oo-admin-ctl-usage:

======

[root@broker ~]# oo-admin-ctl-usage --list
Errors/Warnings will be logged to terminal
2013-05-10 16:48:52 -0400 INFO:: 
---------- STARTED ----------

User: alexd
	Gear: 518bcaa26892dfcb74000001, UsageType: GEAR_USAGE, Usage: 2.388422262765278
	Gear: 518bcb876892dfcb74000017, UsageType: GEAR_USAGE, Usage: 2.388422262765278
2013-05-10 16:48:52 -0400 INFO:: 
---------- ENDED, #Errors: 0, #Warnings: 0 ----------

Comment 3 Brenton Leanhardt 2013-05-15 14:59:23 UTC
My vote is to fix this post 1.2.  The only current issue I see is that "Plan" is confusing.  We'll likely have some cosmetic and OSE feature requests for usage monitoring so we can fix it up at that time.

Comment 4 Brenton Leanhardt 2013-07-11 14:03:26 UTC
Let's add some examples here.  People are asking how to use this and we need to improve the documentation.

Comment 5 chris alfonso 2013-07-18 18:49:41 UTC
Just to summarize what's needed here:
1. don't show Plan or the Note if the user isn't in a plan
2. add a man page reference for the ENABLE_USAGE_TRACKING_DATASTORE setting in the broker.conf
3. add man page usage examples for other switches

Comment 6 chris alfonso 2013-07-18 19:51:51 UTC
https://github.com/openshift/enterprise-server/pull/111

No further examples are needed in the man page since each argument is demonstrated. If you can think of a different example that's needed, please let me know and we can add it.

Comment 8 Gaoyun Pei 2013-07-22 09:10:35 UTC
Verify this bug on puddle: 1.2/2013-07-19.1

Checked the man page of oo-admin-usage, "Usage statistics will only be collected if the ENABLE_USAGE_TRACKING_DATASTORE setting in /etc/openshift/broker.conf is set to true."  was added to the DESCRIPTION.

When I show user's usage by oo-admin-usage, it doesn't contain Plan anymore:
[root@broker ~]# oo-admin-usage -l jialiu

Usage for jialiu
------------------------------------------
#1
 Usage Type: GEAR_USAGE (small)
    Gear ID: 51eca8499f13737226000267 (phpapp)
   Duration: 5 hours and 33 minutes (2013-07-21 20:34:42 - PRESENT)

#2
 Usage Type: GEAR_USAGE (small)
    Gear ID: 51ecd1639f1373ae690008cf (ruby19app)
   Duration: 2 hours and 37 minutes (2013-07-21 23:30:05 - PRESENT)

Note: The cost displayed is based on the usage duration and the usage rate. It does not take into account any unbilled usage by the billing provider.

Comment 11 Miciah Dashiel Butler Masters 2013-08-01 22:57:50 UTC
"Confusing UI for users." "This was confusing for users [...]."

Would users ever have seen the confusing output? oo-admin-usage is a tool for administrators.

Comment 12 errata-xmlrpc 2013-08-05 17:16:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1138.html