newrelic_postgres_plugin 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
- gem "newrelic_plugin", "~> 1.0.2"
4
- gem "pg"
3
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,18 +1,24 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ newrelic_postgres_plugin (0.1.6)
5
+ newrelic_plugin (~> 1.0.2)
6
+ pg (>= 0.15.1)
7
+
1
8
  GEM
2
- remote: http://rubygems.org/
9
+ remote: https://rubygems.org/
3
10
  specs:
4
- faraday (0.8.7)
5
- multipart-post (~> 1.1)
11
+ faraday (0.8.8)
12
+ multipart-post (~> 1.2.0)
6
13
  json (1.8.0)
7
14
  multipart-post (1.2.0)
8
- newrelic_plugin (1.0.2)
15
+ newrelic_plugin (1.0.3)
9
16
  faraday (>= 0.8.1)
10
17
  json
11
- pg (0.15.1)
18
+ pg (0.16.0)
12
19
 
13
20
  PLATFORMS
14
21
  ruby
15
22
 
16
23
  DEPENDENCIES
17
- newrelic_plugin (~> 1.0.2)
18
- pg
24
+ newrelic_postgres_plugin!
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ def name
15
15
  end
16
16
 
17
17
  def version
18
- line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
18
+ line = File.read("lib/#{name}/version.rb")[/^\s*VERSION\s*=\s*.*/]
19
19
  line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
20
20
  end
21
21
 
@@ -1,10 +1,3 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'bundler/setup'
5
- require 'newrelic_plugin'
6
- require 'pg'
7
-
8
1
  module NewRelic::PostgresPlugin
9
2
 
10
3
  # Register and run the agent
@@ -20,7 +13,7 @@ module NewRelic::PostgresPlugin
20
13
  class Agent < NewRelic::Plugin::Agent::Base
21
14
 
22
15
  agent_guid 'com.boundless.postgres'
23
- agent_version '1.0.0'
16
+ agent_version NewRelic::PostgresPlugin::VERSION
24
17
  agent_config_options :host, :port, :user, :password, :dbname, :sslmode, :label
25
18
  agent_human_labels('Postgres') { "#{label || host}" }
26
19
 
@@ -67,10 +60,11 @@ module NewRelic::PostgresPlugin
67
60
  report_bgwriter_metrics
68
61
  report_database_metrics
69
62
  report_index_metrics
70
-
71
- @connection.finish
63
+
72
64
  rescue => e
73
65
  $stderr.puts "#{e}: #{e.backtrace.join("\n ")}"
66
+ ensure
67
+ @connection.finish if @connection
74
68
  end
75
69
 
76
70
  def report_derived_metric(name, units, value)
@@ -127,7 +121,7 @@ module NewRelic::PostgresPlugin
127
121
  report_metric "Indexes/Cache Hit Rate", '%', result[1]['ratio'].to_f * 100.0
128
122
  end
129
123
  @connection.exec(index_size_query) do |result|
130
- report_metric "Indexes/Size on Disk", 'bytes', result[0]['size'].to_f
124
+ report_metric "Indexes/Size on Disk", 'bytes', result[0]['size'].to_i
131
125
  end
132
126
  end
133
127
 
@@ -180,7 +174,7 @@ module NewRelic::PostgresPlugin
180
174
  end
181
175
 
182
176
  def index_size_query
183
- "SELECT sum(relpages*8192) AS size FROM pg_class WHERE reltype = 0;"
177
+ "SELECT sum(relpages::bigint*8192) AS size FROM pg_class WHERE reltype = 0;"
184
178
  end
185
179
 
186
180
  end
@@ -0,0 +1,3 @@
1
+ module NewRelic::PostgresPlugin
2
+ VERSION = '0.1.8'
3
+ end
@@ -1,6 +1,8 @@
1
1
  require 'rubygems'
2
- require 'newrelic_postgres_plugin/agent'
2
+ require 'bundler/setup'
3
+
4
+ require 'newrelic_plugin'
5
+ require 'pg'
3
6
 
4
- module NewRelic::PostgresPlugin
5
- VERSION = '0.1.6'
6
- end
7
+ require 'newrelic_postgres_plugin/version'
8
+ require 'newrelic_postgres_plugin/agent'
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'newrelic_postgres_plugin'
16
- s.version = '0.1.6'
17
- s.date = '2013-07-23'
16
+ s.version = '0.1.8'
17
+ s.date = '2013-09-25'
18
18
  s.rubyforge_project = 'newrelic_postgres_plugin'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -51,7 +51,7 @@ This is the New Relic plugin for monitoring Postgres developed by Boundless Inc.
51
51
  ## The newrelic_plugin needs to be installed. Prior to public release, the
52
52
  # gem needs to be downloaded from git@github.com:newrelic-platform/newrelic_plugin.git
53
53
  # and built using the "rake build" command
54
- s.add_dependency('newrelic_plugin', ">= 0.2.11")
54
+ s.add_dependency('newrelic_plugin', "~> 1.0.2")
55
55
  s.add_dependency('pg', ">= 0.15.1")
56
56
 
57
57
  s.post_install_message = <<-EOF
@@ -74,6 +74,7 @@ to find out how to install and run the plugin agent.
74
74
  config/newrelic_plugin.yml
75
75
  lib/newrelic_postgres_plugin.rb
76
76
  lib/newrelic_postgres_plugin/agent.rb
77
+ lib/newrelic_postgres_plugin/version.rb
77
78
  newrelic_postgres_plugin.gemspec
78
79
  postgresql.png
79
80
  ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_postgres_plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-23 00:00:00.000000000 Z
12
+ date: 2013-09-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: newrelic_plugin
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.2.11
21
+ version: 1.0.2
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 0.2.11
29
+ version: 1.0.2
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: pg
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -64,6 +64,7 @@ files:
64
64
  - config/newrelic_plugin.yml
65
65
  - lib/newrelic_postgres_plugin.rb
66
66
  - lib/newrelic_postgres_plugin/agent.rb
67
+ - lib/newrelic_postgres_plugin/version.rb
67
68
  - newrelic_postgres_plugin.gemspec
68
69
  - postgresql.png
69
70
  homepage: http://boundless.com