Skip to content

Commit

Permalink
Merge pull request #38 from johnelse/rrd-type-names
Browse files Browse the repository at this point in the history
Let's write the actual name of the value to the shared memory area
  • Loading branch information
simonjbeaumont committed May 19, 2016
2 parents 8c9970f + 793605d commit f276692
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions lib/rrd_json.ml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ let json_of_ds ?(owner=Rrd.Host) ?(rshift=4) ds buf =
| Rrd.VT_Float f -> json_line_float "value" f; json_line_string "value_type" "float"
| Rrd.VT_Unknown -> failwith "to_json: Impossible to represent VT_Unknown type");
json_line_string "type" (match ds.ds_type with
| Rrd.Gauge -> "absolute"
| Rrd.Absolute -> "rate"
| Rrd.Derive -> "absolute_to_rate");
| Rrd.Gauge -> "gauge"
| Rrd.Absolute -> "absolute"
| Rrd.Derive -> "derive");
json_line_bool "default" ds.ds_default;
json_line_string "units" ds.ds_units;
json_line_float "min" ds.ds_min;
Expand Down Expand Up @@ -80,9 +80,9 @@ let json_metadata_of_ds ?(owner=Rrd.Host) ds buf =
| Rrd.VT_Float _ -> "float"
| Rrd.VT_Unknown -> failwith "to_json: Impossible to represent VT_Unknown type");
json_line_string "type" (match ds.ds_type with
| Rrd.Gauge -> "absolute"
| Rrd.Absolute -> "rate"
| Rrd.Derive -> "absolute_to_rate");
| Rrd.Gauge -> "gauge"
| Rrd.Absolute -> "absolute"
| Rrd.Derive -> "derive");
json_line_bool "default" ds.ds_default;
json_line_string "units" ds.ds_units;
json_line_float "min" ds.ds_min;
Expand Down
6 changes: 3 additions & 3 deletions lib/rrd_rpc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ let assoc_opt ~(key : string) ~(default : string)
(* Converts string to the corresponding datasource type. *)
let ds_ty_of_string (s : string) : Rrd.ds_type =
match String.lowercase s with
| "absolute" -> Rrd.Gauge
| "rate" -> Rrd.Absolute
| "absolute_to_rate" -> Rrd.Derive
| "gauge" -> Rrd.Gauge
| "absolute" -> Rrd.Absolute
| "derive" -> Rrd.Derive
| _ -> raise Rrd_protocol.Invalid_payload

(* Converts a string to value of datasource owner type. *)
Expand Down

0 comments on commit f276692

Please sign in to comment.