Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add postgres exporter #236

Merged
merged 16 commits into from
Jul 30, 2018
Merged

Conversation

blupman
Copy link

@blupman blupman commented Jul 17, 2018

Pull Request (PR) description

I have added a postgres_exporter module, the module is installing https://github.com/wrouesnel/postgres_exporter

This Pull Request (PR) fixes the following issues

String $download_extension,
String $download_url_base,
Array[String] $extra_groups,
String $group,
Copy link
Member

Choose a reason for hiding this comment

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

can you update the String datatype to String[1] on all locations where it makes sense? (It enforces a minimum string length of 1).

Copy link
Author

Choose a reason for hiding this comment

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

I've added quite a few [1]'s to where it makes sense. also some minor cleanups, in de comments

end

describe 'install correct binary' do
it { is_expected.to contain_file('/usr/local/bin/postgres_exporter').with('target' => '/opt/postgres_exporter-0.4.6.linux-amd64/postgres_exporter') }
Copy link
Member

Choose a reason for hiding this comment

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

please also add something like this:

it { is_expected.to compile.with_all_deps }

Copy link
Author

Choose a reason for hiding this comment

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

added, a few tests.
I used redis_exporter as a starting point, which is about the only spec test that doesn't do this, shall i create an other pull request enhanching the redis_exporter?

Copy link
Member

Choose a reason for hiding this comment

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

That would be awesome!

@bastelfreak bastelfreak added enhancement New feature or request needs-work not ready to merge just yet labels Jul 17, 2018
@bastelfreak
Copy link
Member

hey @blupman, thanks for the PR! I did some little inline comments, but all in all this looks good. Travis is currently having some issues, but I hope that will be fixed soon.

@@ -253,6 +253,18 @@ prometheus::blackbox_exporter::package_name: 'blackbox_exporter'
prometheus::blackbox_exporter::modules: {}
prometheus::blackbox_exporter::config_file: '/etc/blackbox-exporter.yaml'
prometheus::blackbox_exporter::version: '0.7.0'
prometheus::postgres_exporter::data_source_uri: 'host=/var/run/postgresql/ sslmode=disable'
prometheus::postgres_exporter::postgres_pass: 'postgres_exporter_password'
prometheus::postgres_exporter::postgres_user: 'postgres_exporter_username'
Copy link
Member

Choose a reason for hiding this comment

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

should postgres_user and postgres_pass default to undef? Might makes it more obvious to users that they need to change it.

Copy link
Author

Choose a reason for hiding this comment

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

agreed,
i had to add the postgres_pass and postgres_pass to the spec test, to make the daemon start

class prometheus::postgres_exporter (
String[1] $download_extension,
String[1] $download_url_base,
Array[String] $extra_groups,
Copy link
Member

Choose a reason for hiding this comment

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

Can you please update this to Array[String[1]]? That will enforce a minimum string length of 1.

Copy link
Author

Choose a reason for hiding this comment

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

ok. done

Boolean $purge_config_dir = true,
Boolean $restart_on_change = true,
Boolean $service_enable = true,
String $service_ensure = 'running',
Copy link
Member

Choose a reason for hiding this comment

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

for all the other String datatypes here: Please ensure a minimal String length of 1.

Copy link
Author

Choose a reason for hiding this comment

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

now its done for all non optional strings.

@bastelfreak
Copy link
Member

@blupman can you recheck again please? I made some more inline comments.

@bastelfreak
Copy link
Member

@blupman can you take a look at the failing spec tests?

@blupman
Copy link
Author

blupman commented Jul 30, 2018 via email

@bastelfreak bastelfreak removed the needs-work not ready to merge just yet label Jul 30, 2018
@bastelfreak
Copy link
Member

Thanks!

@bastelfreak bastelfreak merged commit 4b9cf9a into voxpupuli:master Jul 30, 2018
# Service startup scripts style (e.g. rc, upstart or systemd)
#
# [*install_method*]
# Installation method: url or package (only url is supported currently)
Copy link
Member

Choose a reason for hiding this comment

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

only url is supported currently. Is that true?

Copy link
Author

Choose a reason for hiding this comment

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

I'm not aware of a packaged version of postgres_exporter, if it exsist, its not tested.

cegeka-jenkins pushed a commit to cegeka/puppet-prometheus that referenced this pull request Aug 28, 2019
* add postgres exporter

* spec fixes

* spec fixes

* default to no env vars, and extra input checks

* add postgres exporter

* add pointer to postgres_exporter module

* stricter data typing, spectest enhanchements

* tuning spec tests

* change spec tests

* fix rubocop.

* update to follow suggestions of review

* add a comma, spec fixing..

* set required params in acceptance test.
Rovanion pushed a commit to Rovanion/puppet-prometheus that referenced this pull request May 5, 2021
* add postgres exporter

* spec fixes

* spec fixes

* default to no env vars, and extra input checks

* add postgres exporter

* add pointer to postgres_exporter module

* stricter data typing, spectest enhanchements

* tuning spec tests

* change spec tests

* fix rubocop.

* update to follow suggestions of review

* add a comma, spec fixing..

* set required params in acceptance test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants