[yast-devel] status modul - xml
Hi, I'm trying to gave the status rest-service a nicer xml format, but I faced some problems by sending the times of the values. Inside a browser the xml- tree looks like that: <status> <metricgroup group_name="memory"> <metric name="memory-used"> <label type="value"> <value dateTime="1250178710">1.4260408320e+09</value> <value dateTime="1250178600">1.4165012480e+09</value> <value dateTime="1250178590">1.4164602880e+09</value> .... But when the webclient fetches the data with @client.find(...), it misses the dateTime attributes: #<YaST::ServiceResource::Proxies::Status:0x7f5c68fd0c98 @prefix_options={}, @attributes={"metricgroup"=>[#<YaST::ServiceResource::Proxies::Status::Metricgroup:0x7f5c68f22288 @prefix_options={}, @attributes={"group_name"=>"memory", "metric"=>[#<YaST::ServiceResource::Proxies::Status::Metricgroup::Metric:0x7f5c68f1fb28 @prefix_options={}, @attributes={"label"=>#<YaST::ServiceResource::Proxies::Status::Metricgroup::Metric::Label:0x7f5c68f1f038 @prefix_options={}, @attributes={"values"=> ["1.4095081472e+09", "1.4097989632e+09", ..... "1.4097973248e+09"], "type"=>"value"}>, "name"=>"memory-used"}>, ... It seems that the last branch of an xml-tree (or elements with content?) can't have any attributes. Is this the expected behaviour or maybe a bug? Björn -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On 08/13/2009 06:40 PM, Bjoern Geuken wrote:
Hi,
I'm trying to gave the status rest-service a nicer xml format, but I faced some problems by sending the times of the values. Inside a browser the xml- tree looks like that:
<status> <metricgroup group_name="memory"> <metric name="memory-used"> <label type="value"> <value dateTime="1250178710">1.4260408320e+09</value> <value dateTime="1250178600">1.4165012480e+09</value> <value dateTime="1250178590">1.4164602880e+09</value> ....
But when the webclient fetches the data with @client.find(...), it misses the dateTime attributes:
#<YaST::ServiceResource::Proxies::Status:0x7f5c68fd0c98 @prefix_options={}, @attributes={"metricgroup"=>[#<YaST::ServiceResource::Proxies::Status::Metricgroup:0x7f5c68f22288 @prefix_options={}, @attributes={"group_name"=>"memory", "metric"=>[#<YaST::ServiceResource::Proxies::Status::Metricgroup::Metric:0x7f5c68f1fb28 @prefix_options={}, @attributes={"label"=>#<YaST::ServiceResource::Proxies::Status::Metricgroup::Metric::Label:0x7f5c68f1f038 @prefix_options={}, @attributes={"values"=> ["1.4095081472e+09", "1.4097989632e+09", ..... "1.4097973248e+09"], "type"=>"value"}>, "name"=>"memory-used"}>, ...
It seems that the last branch of an xml-tree (or elements with content?) can't have any attributes. Is this the expected behaviour or maybe a bug?
Björn
Yes, I also face this problem. I solve it by using map or array, so resulting xml looks like <status> <metricgroup group_name="memory"> <metric name="memory-used"> <label type="array"> //array because it is array of measures <measure> <dateTime>1250178710</dateTime> <value>1.4260408320e+09</value> </measure> etc. I hope this helps. -- Josef Reidinger YaST team maintainer of perl-Bootloader, YaST2-Repair, webyast modules language and time -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
* Josef Reidinger <jreidinger@suse.cz> [Aug 14. 2009 08:13]:
Yes, I also face this problem. I solve it by using map or array, so resulting xml looks like
<status> <metricgroup group_name="memory"> <metric name="memory-used"> <label type="array"> //array because it is array of measures <measure> <dateTime>1250178710</dateTime> <value>1.4260408320e+09</value> </measure> etc.
iirc, the xml format for the monitoring values was discussed before. Given that values are sampled with a constant interval, it should be possible to separate timestamps from the values. E.g. <metric name="memory-used"> <period> <starttime>12345678990</starttime> <interval>5</interval> <samples type="array"> <value>1.4260408320e+09</value> <value>1.4284873636e+09</value> ... This only includes one timestamp and the interval (assumed 5 seconds) and then all values in one array. Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Friday 14 August 2009 10:57:45 Klaus Kaempf wrote:
* Josef Reidinger <jreidinger@suse.cz> [Aug 14. 2009 08:13]:
Yes, I also face this problem. I solve it by using map or array, so resulting xml looks like
<status> <metricgroup group_name="memory"> <metric name="memory-used"> <label type="array"> //array because it is array of measures <measure> <dateTime>1250178710</dateTime> <value>1.4260408320e+09</value> </measure> etc.
iirc, the xml format for the monitoring values was discussed before.
Given that values are sampled with a constant interval, it should be possible to separate timestamps from the values.
But that's not allways the case. When someone asks the rest-service for values of a longer period, eg. 5 hours it might happen that the oldest data have an interval of 70 secs while the newest got 10 secs interval.
E.g. <metric name="memory-used"> <period> <starttime>12345678990</starttime> <interval>5</interval> <samples type="array"> <value>1.4260408320e+09</value> <value>1.4284873636e+09</value> ...
This only includes one timestamp and the interval (assumed 5 seconds) and then all values in one array. Is it for sure that the values were not rearranged into a new order?
Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
-- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
* Bjoern Geuken <bgeuken@suse.de> [Aug 14. 2009 11:10]:
On Friday 14 August 2009 10:57:45 Klaus Kaempf wrote:
Given that values are sampled with a constant interval, it should be possible to separate timestamps from the values.
But that's not allways the case. When someone asks the rest-service for values of a longer period, eg. 5 hours it might happen that the oldest data have an interval of 70 secs while the newest got 10 secs interval.
Doesn't RRDtool resample and adapt intervals as one increases the period ? And I doubt that a 10 secs interval has any value on a 5 hours scale ;-) I strongly believe that we should look into ways to decrease the amount of data for the monitoring service. Currently, its a lot of xml generation and parsing going on, not to mention the bandwidth. Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (3)
-
Bjoern Geuken
-
Josef Reidinger
-
Klaus Kaempf