Permalink
Browse files

cosmetics

  • Loading branch information...
1 parent 4f3ddde commit 8145ced79da5195088457ddba390af8dc0eb83ca @nivertech nivertech committed Sep 19, 2011
Showing with 11 additions and 13 deletions.
  1. +11 −13 src/erlcloud_mon.erl
View
@@ -124,20 +124,19 @@ extract_dimension(Node) ->
put_metric_data(Namespace, MetricData) ->
Config = default_config(),
Params =
- [ {"Namespace", Namespace} |
+ [
+ {"Namespace", Namespace} |
lists:flatten(
[ params_metric_data(N,MD) || {N,MD} <- lists:zip(lists:seq(1,length(MetricData)), MetricData) ]
)
],
-
mon_query(Config, "PutMetricData", Params).
%%------------------------------------------------------------------------------
-spec params_metric_data(NM::pos_integer(), MD::metric_datum()) -> [{string(),string()}].
params_metric_data(NM,MD) ->
%% TODO - check case when both Value and statistics specified or both undefined
Prefix = ?FMT("MetricData.member.~b", [NM]),
-
lists:flatten(
[
[ {Prefix++".MetricName", MD#metric_datum.metric_name} ],
@@ -202,16 +201,15 @@ params_stat(Prefix, StatisticValues) ->
put_metric_data(Namespace, MetricName, Value, Unit, Timestamp) ->
Config = default_config(),
Params =
- [
- {"Namespace", Namespace},
- {"MetricData.member.1.MetricName", MetricName},
- {"MetricData.member.1.Value", Value}
- ]
- ++
- [ {"MetricData.member.1.Unit", Unit} || Unit=/=undefined, Unit=/="" ]
- ++
- [ {"MetricData.member.1.Timestamp", format_timestamp(Timestamp)} || Timestamp=/=undefined, Timestamp=/="" ],
-
+ lists:flatten(
+ [
+ {"Namespace", Namespace},
+ {"MetricData.member.1.MetricName", MetricName},
+ {"MetricData.member.1.Value", Value},
+ [ {"MetricData.member.1.Unit", Unit} || Unit=/=undefined, Unit=/="" ],
+ [ {"MetricData.member.1.Timestamp", format_timestamp(Timestamp)} || Timestamp=/=undefined, Timestamp=/="" ]
+ ]
+ ),
mon_simple_query(Config, "PutMetricData", Params).
%%------------------------------------------------------------------------------

0 comments on commit 8145ced

Please sign in to comment.