Skip to content

Commit

Permalink
CA-400124 - rrdd: only serialize transform when it's not default
Browse files Browse the repository at this point in the history
This saves on space, since only cpuX and cpu_avg datasources currently have
transform=inverse, all the others have the default identity function specified.

Signed-off-by: Andrii Sultanov <[email protected]>
  • Loading branch information
last-genius committed Oct 9, 2024
1 parent 686751f commit fe79b0f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ocaml/xcp-rrdd/lib/transport/base/rrd_json.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ let ds_owner x =
)

let ds_transform x =
( "transform"
, match x with
| Rrd.Identity ->
string "identity"
| Rrd.Inverse ->
string "inverse"
)
match x with
| Rrd.Identity ->
[]
(* This is the default when transform is absent, and not including it
makes the file smaller *)
| Rrd.Inverse ->
[("transform", string "inverse")]

let bool b = string "%b" b (* Should use `Bool b *)

Expand All @@ -72,7 +72,7 @@ let ds_to_json (owner, ds) =
[
description ds.Ds.ds_description
; [ds_owner owner]
; [ds_transform ds.Ds.ds_pdp_transform_function]
; ds_transform ds.Ds.ds_pdp_transform_function
; ds_value ds.Ds.ds_value
; [ds_type ds.Ds.ds_type]
; [
Expand Down

0 comments on commit fe79b0f

Please sign in to comment.