Bug 857144

Summary: Display of epoch_milliseconds, epoch_seconds values support
Product: [Other] RHQ Project Reporter: Elias Ross <genman>
Component: Core UIAssignee: RHQ Project Maintainer <rhq-maint>
Status: NEW --- QA Contact: Mike Foley <mfoley>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.4CC: hrupp, jkremser
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Elias Ross 2012-09-13 12:33:59 EDT
It appears setting the units for a measurement to 'epoch_milliseconds' doesn't format the value as an actual date/time when the value is displayed. Instead is displayed a large number.
 
  	<metric property="lastProcessDate"
          	dataType="measurement"
          	description="last processing date"
          	units="epoch_seconds"
          	displayType="summary"
          	category="performance" />

I'm guessing there is some code missing in here to do the format:

enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/MeasurementConverterClient.java

I do see some code in:

enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/util/MonitorUtils.java

but it seems like this is no longer used?
Comment 1 Jirka Kremser 2012-09-20 12:35:31 EDT
Could you please describe your use case? What plugin is it? Did you consider using the dataType="trait" attribute?
Comment 2 Elias Ross 2012-09-20 12:38:44 EDT
This is my own plugin.

My particular use case is this metric:

      <metric property="hbaseLastProcessDate"
              dataType="measurement"
              description="HBase last processing date"
              units="epoch_milliseconds"/>

I have a component that loads data periodically (say, every minute),
but regularly into HBase. This metric tracks the last time data was
completely loaded. I get this from parsing an actual string from a
file, e.g.:

'201209122216'

As a trait, the value would change very frequently. RHQ would store a
new value for the trait, as a String, every time the metric was
polled.

But as a measurement, RHQ would instead store a 'double'. Storing as a
metric allows for a few different things as well:

1. Change formatting depending on the browser & user local time zone.
2. See trending. Ideally, the 'last time' would increase at a steady rate.
3. Alarm if the value does not change.
4. Alarm if the value is, say, 1 hour ago and the threshold is 10 minutes.

Alternatively, the metric could be defined as a relative time value:

      <metric property="hbaseLastProcessSecondsAgo"
              dataType="measurement"
              description="For HBase, how many seconds ago was the
data processed"
              units="seconds"/>

I don't really mind switching to relative time, but it seems
reasonable to support this in the UI.