rapidloop / pgmetrics

Collect and display information and stats from a running PostgreSQL server
https://pgmetrics.io
Apache License 2.0
960 stars 65 forks source link

allow pgmetric to be used as library #14

Closed siddharth178 closed 6 years ago

siddharth178 commented 6 years ago

Fixes: https://github.com/rapidloop/pgmetrics/issues/13

pgmetrics is a great command-line tool. but running this specific commandline in every environment is not ideal.

this is the minimal change one can do to make it work like a library. separating it out as a real library can be taken as a separate task and i think it would be only necessary if this simple setup doesn't work.

mdevan commented 6 years ago

This alone would not be sufficient, unfortunately.

The options struct is not exported, so Collect() would not be callable from outside the package. It's not fair to export options because it has things not related to collection (output format etc). Also, you won't want to import github.com/rapidloop/pgmetrics/cmd/pgmetrics since it is a main package.

siddharth178 commented 6 years ago

Okk, got it. Valid points. I will issue another PR soon to have that collector package separated out.