Skip to content
This repository was archived by the owner on Jul 6, 2021. It is now read-only.

Dmius repgen 86 #100

Merged
merged 9 commits into from
Dec 4, 2018
Merged

Dmius repgen 86 #100

merged 9 commits into from
Dec 4, 2018

Conversation

dmius
Copy link
Collaborator

@dmius dmius commented Nov 30, 2018

No description provided.

@Nastradamus
Copy link
Contributor

I fixed Makefile to fix build on any supported by golang OS'es.

@Nastradamus
Copy link
Contributor

After first run, I see several issues:

  1. Relative UNIX path is not supported (existing file not found)
  2. The program continues to run after an error
  3. UNIX-like file path'es not supported
  4. Error Data file or template is wrong while report is correct
  5. DEBUG messages apper while I did not turnet on any debug options
  6. --checkdata expects data if can't find a file
  7. Cannot find and load plugin. appears in STDOUT (STDERR expected)
[vyagofarov@mac:~/git/healthcheck] $ ./pghrep/bin/pghrep --checkdata=./artifacts/dummy/1_2018_11_30T11_23_03_+0300/A005_extensions.json
2018/11/30 11:24:05 ERROR: File given by --checkdata not found, will used as json data ./artifacts/dummy/1_2018_11_30T11_23_03_+0300/A005_extensions.json
2018/11/30 11:24:05 >>> DEBUG:  Can't parse json data: invalid character '.' looking for beginning of value
2018/11/30 11:24:05 ERROR: Content given by --checkdata is wrong json content.
[vyagofarov@mac:~/git/healthcheck] $ ./pghrep/bin/pghrep --checkdata=/Users/vyagofarov/git/healthcheck/artifacts/dummy/1_2018_11_30T11_23_03_+0300/A005_extensions.json
2018/11/30 11:48:00 ERROR: File given by --checkdata not found, will used as json data /Users/vyagofarov/git/healthcheck/artifacts/dummy/1_2018_11_30T11_23_03_+0300/A005_extensions.json
2018/11/30 11:48:00 >>> DEBUG:  Can't parse json data: invalid character '/' looking for beginning of value
2018/11/30 11:48:00 ERROR: Content given by --checkdata is wrong json content.
[vyagofarov@mac:~/git/healthcheck] $
[vyagofarov@mac:~/git/healthcheck] $ ./pghrep/bin/pghrep --checkdata=file:///Users/vyagofarov/git/healthcheck/artifacts/dummy/1_2018_11_30T11_23_03_+0300/A005_extensions.json
2018/11/30 11:49:18 >>> DEBUG:  File path /Users/vyagofarov/git/healthcheck/artifacts/dummy/1_2018_11_30T11_23_03_+0300/A005_extensions.json
2018/11/30 11:49:18 >>> DEBUG:  File path /Users/vyagofarov/git/healthcheck/artifacts/dummy/1_2018_11_30T11_23_03_+0300/A005_extensions.json
2018/11/30 11:49:18 >>> DEBUG:  Replicas map[]
2018/11/30 11:49:18 >>> DEBUG:  Hosts map[replicas:[] master:dev]
2018/11/30 11:49:18 WARNING: Plugin /Users/vyagofarov/git/healthcheck/bin/A005.so not found.
Cannot find and load plugin. stat /Users/vyagofarov/git/healthcheck/plugins/A005.go: no such file or directory
2018/11/30 11:49:18 >>> DEBUG:  Find A005.tpl
2018/11/30 11:49:18 >>> DEBUG:  reportTpl <nil>
2018/11/30 11:49:18 Cannot generate report. Data file or template is wrong.

@dmius
Copy link
Collaborator Author

dmius commented Nov 30, 2018

1 Now supported only filepath with file:// prefix, relative and absoulute
2 Will fixed in next commit
3 See 1
4 Now exists only A001 and A002 templates
5 Will fixed in next commit
6 Will fixed in next commit
7 Will enabled in debug mode only, plugin not required for every report, so this just information message.

pghrep/README.md Outdated
@@ -0,0 +1,5 @@
For generate report use:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"To generate ..."

pghrep/README.md Outdated

`./bin/pghrep --checkdata=file:///path_to_json_repots_storage/A002_pgversion.json --outdir=/path_to_md_reports_storage/ `

also for enable debug mode add option `--debug 1`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, to enable debug mode, use --debug 1

/* 2018 © Dmitry Udalov dmius@postgres.ai
2018 © Postgres.ai
/*
Postgres Healt Reporter
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Health

}
}

func determineMasterReplica(data map[string]interface{}) {
Copy link
Collaborator

@NikolayS NikolayS Dec 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

давай комментарии к функции распишем.

из названия совершенно непонятно, что она делает — определяет, мастер это или реплика? или что? (возможно, название тоже стоит улучшить)

@NikolayS
Copy link
Collaborator

NikolayS commented Dec 3, 2018

The code works as expected, let's do these two corrections, as discussed:

  • get rid of file:// completely
  • allow use of both absolute (/path/to/file/or/dir) and relative (./path/to or path/to) paths to files/directories in any parameter

Copy link
Contributor

@Nastradamus Nastradamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good! It works in macOS. Generated report A001:

[vyagofarov@mac:~/git/healthcheck/pghrep] $ ./bin/pghrep -checkdata=./artifacts/dummy/1_2018_11_30T18_02_12_+0300/A005_extensions.json

@dmius dmius merged commit 28c5885 into master Dec 4, 2018
@NikolayS NikolayS deleted the dmius-repgen-86 branch December 5, 2018 05:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants