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

[postgres] Made BGW_METRICS version dependent #1272

Merged
merged 1 commit into from
Jan 3, 2015

Conversation

ipolishchuk
Copy link

We are using Postgres 9.1.9 and I see a lot of errors in collector,log like this:

2014-12-22 18:33:47 UTC | WARNING | dd.collector | checks.postgres(postgres.py:277) | Not all metrics may be available: ('ERROR', '42703', 'column "checkpoint_write_time" does not exist')

The problem is that postgres 9.2 columns of a pg_stat_bgwriter view are hardcoded in postgres.py
The columns checkpoint_write_time, checkpoint_sync_time, buffers_backend_fsync are missing in version 9.1
After a BGW_METRICS query failed, all the following queries fail, too.

The proposed fix makes the BGW_METRICS Postgres version aware. This may not be the most elegant solution, but I tried to make as fewer changes as possible, and do everything in the spirit of the existing code.

After I applied this fix, I have BGW_METRICS working, and the queries following BGW_METRICS are working too.

@LeoCavaille LeoCavaille changed the title Made BGW_METRICS version dependent [postgres] Made BGW_METRICS version dependent Jan 2, 2015
@LeoCavaille LeoCavaille added this to the 5.2.0 milestone Jan 2, 2015
@LeoCavaille
Copy link
Member

@ipolishchuk thanks a lot for your contribution. We will review it shortly and consider its inclusion in the next agent release.

@LeoCavaille
Copy link
Member

@ipolishchuk this is really great, I tested your change with postgres 8.4. 9.0, 9.1, 9.2, 9.3, 9.4 (we are in the process of improving integration testing and running tests against a larger matrix of versions but we are not there yet...). And it works great. One thing that I realized though is buffers_backend_fsync is only available after 9.1.
Merging this change and I will add something to handle the pre-9.1 versions.
👍

cc @alq666

LeoCavaille added a commit that referenced this pull request Jan 3, 2015
[postgres] Made BGW_METRICS version dependent
@LeoCavaille LeoCavaille merged commit e9c1b70 into DataDog:master Jan 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants