Re: Patch for bugs in json.pm

Michael Burk <[email protected]>
Newsgroups gmane.comp.archivers.amanda.devel
Message-ID <CAJ-WpnpHQsCKRG5=ZeS4N1zoL8Eg3z704jHWJO6NruBgCbuJxA@mail.gmail.com>
Hello,

I appreciate the JSON report format option, as it gives me a flexible way
to do things like turn the data into an HTML report. I have noticed a few
oddities in the JSON output, and have a couple other suggestions to improve
it. I don't know if you consider the JSON format to be frozen yet or not.
If you are interested in these changes, I'd be happy to submit a diff.


## Oddities

- section labeled "statistic" instead of "statistics"
  (unexpected, inconsistent with other section keys)

- some numerical statistics have quoted values (inconsistent):
    - run_time
    - tape_used.incr,full,total
    - estimate_time
    - avg_compression.incr,full,total
    - avg_dump_rate.incr,full,total

- "Avg_tape_write_speed" is the only capitalized key (inconsistent)


## Improvements

- Failed/Strange Dump Details are copies of these text sections in the plain
  text version of the report (arrays of text). It would be better to make
them
  arrays of arrays of text. In other words, each DLE output would be an
array
  element, like so:

   "strange_details" : [
        [
          "  aluminum.abc.example.com /u00 lev 1 STRANGE",
          "  sendbackup: start [aluminum.abc.example.com:/u00 level 1]",
          "  sendbackup: info BACKUP=/bin/gtar",
          "  sendbackup: info RECOVER_CMD=/bin/gzip -dc |/bin/gtar -xpGf -
...",
          "  sendbackup: info COMPRESS_SUFFIX=.gz",
          "  sendbackup: info end",
          "  ? /bin/gtar: ./oradata/sbmmgr/sbmmgr_srl0.f: file changed as
we read it",
          "  ? /bin/gtar: ./oradata/sbmprd/sbmprd_srl0.f: file changed as
we read it",
          "  | Total bytes written: 1161318400 (1.1GiB, 50MiB/s)",
          "  sendbackup: size 1134100",
          "  sendbackup: end",
        ],
        [
          "  boron.abc.example.com /u00 lev 1 STRANGE",
          "  sendbackup: start [boron.abc.example.com:/u00 level 1]",
          "  sendbackup: info BACKUP=/bin/gtar",
          "  sendbackup: info RECOVER_CMD=/bin/gzip -dc |/bin/gtar -xpGf -
...",
          "  sendbackup: info COMPRESS_SUFFIX=.gz",
          "  sendbackup: info end",
          "  ? /bin/gtar: ./app/oracle/product/
11.2.0.4/network/log/listener.log: file changed as we read it",
          "  | Total bytes written: 1739325440 (1.7GiB, 30MiB/s)",
          "  sendbackup: size 1698560",
          "  sendbackup: end",
        ],
            ...
    ]


Thanks,
Michael

On Mon, Feb 29, 2016 at 3:58 AM, Jean-Louis Martineau <
[email protected]> wrote:

> Michael,
>
> Thanks for the patch, I committed it.
>
> Jean-Louis
>
>
>
> On 26/02/16 04:36 PM, Michael Burk wrote:
>
> Hello,
>
> I found 3 bugs in the json.pm module:
>
> - dump_duration shows minutes only (no seconds)
> - tape_duration shows minutes only (no seconds)
> - Avg Compressed Size shows incr. value for every value
>
> Here is diff fixing all 3:
>
> --- json.pm.orig 2016-02-22 09:49:51.000000000 -0700
> +++ json.pm 2016-02-25 20:45:17.119683669 -0700
> @@ -256,8 +256,8 @@
>      };
>
>      $self->{'sections'}{'statistic'}{'avg_compression'} = {
> - total => $comp_size->($incr_stats),
> - full  => $comp_size->($incr_stats),
> + total => $comp_size->($total_stats),
> + full  => $comp_size->($full_stats),
>   incr  => $comp_size->($incr_stats)
>      };
>
> @@ -535,9 +535,9 @@
>   'dump_orig_kb' => $$record[4],
>   'dump_out_kb' => $$record[5],
>   'dump_comp' => $$record[6],
> - 'dump_duration' => int($$record[7]),
> + 'dump_duration' => $$record[7],
>   'dump_rate' => $$record[8],
> - 'tape_duration' => int($$record[9]),
> + 'tape_duration' => $$record[9],
>   'tape_rate' => $$record[10],
>   'dump_partial' => $$record[11],
>   'last_tape_label' => $$record[12]
>
>
> Thanks,
> Michael
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.