Re: Patch for bugs in json.pm

Michael Burk <[email protected]>
Newsgroups gmane.comp.archivers.amanda.devel
Message-ID <CAJ-WpnqNRLLndfD=uS-dsyxKf3WpaEs4W5yuYgnK9GwfKEVgzQ@mail.gmail.com>
Hi Jean-Louis,

I came up with a combination of your first and third examples. I like the
labels on the first example; it's consistent with the rest of the file and
it provides a simple way to loop on any of the keys. I also like the idea
of combining strange and failed into the same data structure. So here's
some real output (the hashes return keys in random order):


   "dump_details" : [
      {
         "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"
         ],
         "disk_name" : "/u00",
         "backup_level" : "1",
         "hostname" : "aluminum.abc.example.com"
      },
      {
         "disk_name" : "\"c:/\"",
         "failure" : [
            "sendbackup: start [neon.abc.example.com:\"c:/\" level 0]",
            "sendbackup: info BACKUP=pkzip",
            "sendbackup: info RECOVER_CMD=Extract with zmanda windows
client or unzip program",
            "sendbackup: info end"
         ],
         "backup_level" : "0",
         "error" : "[data timeout]",
         "hostname" : "neon.abc.example.com"
      },
      ...

(I don't have an example of both a failure and a strange on the same DLE)


If you're good with this arrangement, I'll submit the diff.

Thanks,

On Wed, Mar 2, 2016 at 6:56 AM, Jean-Louis Martineau <
[email protected]> wrote:

> Michael,
>
> I will accept your change if you send a patch, read at the end of the
> email for more strange_details improvement.
>
> Jean-Louis
>
> On 01/03/16 06:17 PM, Michael Burk wrote:
>
> 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",
>         ],
>             ...
>     ]
>
>
>
> How about the following for strange_details?
>
> "strange_details" : [
>  {
>     "host": "aluminum.abc.example.com",
>    "dle" : "/u00",
>    "level" : 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"
>     ]
>   },
>   { ...
>   }
> ]
>
> or the following where host, dle and level values are keys of hashes:
> "strange_details": {
>   "aluminum.abc.example.com": {
>     "/u00" : {
>       1: [
>           "  sendbackup: start [aluminum.abc.example.com:/u00 level 1]",
>           "  sendbackup: info BACKUP=/bin/gtar",
>           ....
>           ]
>      }
>   }
> }
>
>
> Then why two keys at the top level for strange/failed, would it be better
> to group them like the following:
> "details": {
>   "aluminum.abc.example.com": {
>     "/u00" : {
>       1: {
>          "strange" : [
>             "  sendbackup: start [aluminum.abc.example.com:/u00 level 1]",
>             "  sendbackup: info BACKUP=/bin/gtar",
>             ....
>          ],
>          "failed": [
>             ...
>          ]
>      }
>   }
> }
>
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.