pghero 3.3.2 → 3.3.3
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.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +4 -0
 - data/app/controllers/pg_hero/home_controller.rb +10 -3
 - data/lib/pghero/methods/system.rb +10 -4
 - data/lib/pghero/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: '002087a8cb8c6db43d1f084fd773aa4c8320c6fe77be3d4f42b6ca55ff91d39d'
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: fd4cb80b991e10232d7628604049e25685ae3723c53c7dd3231288b369015976
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 42a29de1135ce51d59423e0aedafff5261ffea8e93740a40aa80d472a48d01a799349ea9c48f78c027f86d493e342901698707894156b149236ca7e8f101a0a1
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 68e636a77b47b825803c04ef90005827a66ae6abc0dab5f60bde8877f0c0d4aa580daa60c7959042bb0f9f0bb374eda3e885e0903069247a00c7a9a8779945a2
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
| 
         @@ -248,9 +248,16 @@ module PgHero 
     | 
|
| 
       248 
248 
     | 
    
         
             
                  stats =
         
     | 
| 
       249 
249 
     | 
    
         
             
                    case @database.system_stats_provider
         
     | 
| 
       250 
250 
     | 
    
         
             
                    when :azure
         
     | 
| 
       251 
     | 
    
         
            -
                       
     | 
| 
       252 
     | 
    
         
            -
                         
     | 
| 
       253 
     | 
    
         
            -
             
     | 
| 
      
 251 
     | 
    
         
            +
                      if @database.send(:azure_flexible_server?)
         
     | 
| 
      
 252 
     | 
    
         
            +
                        [
         
     | 
| 
      
 253 
     | 
    
         
            +
                          {name: "Read IOPS", data: @database.read_iops_stats(**system_params).map { |k, v| [k, v ? v.round : v] }, library: chart_library_options},
         
     | 
| 
      
 254 
     | 
    
         
            +
                          {name: "Write IOPS", data: @database.write_iops_stats(**system_params).map { |k, v| [k, v ? v.round : v] }, library: chart_library_options}
         
     | 
| 
      
 255 
     | 
    
         
            +
                        ]
         
     | 
| 
      
 256 
     | 
    
         
            +
                      else
         
     | 
| 
      
 257 
     | 
    
         
            +
                        [
         
     | 
| 
      
 258 
     | 
    
         
            +
                          {name: "IO Consumption", data: @database.azure_stats("io_consumption_percent", **system_params), library: chart_library_options}
         
     | 
| 
      
 259 
     | 
    
         
            +
                        ]
         
     | 
| 
      
 260 
     | 
    
         
            +
                      end
         
     | 
| 
       254 
261 
     | 
    
         
             
                    when :gcp
         
     | 
| 
       255 
262 
     | 
    
         
             
                      [
         
     | 
| 
       256 
263 
     | 
    
         
             
                        {name: "Read Ops", data: @database.read_iops_stats(**system_params).map { |k, v| [k, v ? v.round : v] }, library: chart_library_options},
         
     | 
| 
         @@ -102,7 +102,8 @@ module PgHero 
     | 
|
| 
       102 
102 
     | 
    
         
             
                      end
         
     | 
| 
       103 
103 
     | 
    
         | 
| 
       104 
104 
     | 
    
         
             
                    client = Azure::Monitor::Profiles::Latest::Mgmt::Client.new
         
     | 
| 
       105 
     | 
    
         
            -
                     
     | 
| 
      
 105 
     | 
    
         
            +
                    # call utc to convert +00:00 to Z
         
     | 
| 
      
 106 
     | 
    
         
            +
                    timespan = "#{start_time.utc.iso8601}/#{end_time.utc.iso8601}"
         
     | 
| 
       106 
107 
     | 
    
         
             
                    results = client.metrics.list(
         
     | 
| 
       107 
108 
     | 
    
         
             
                      azure_resource_id,
         
     | 
| 
       108 
109 
     | 
    
         
             
                      metricnames: metric_name,
         
     | 
| 
         @@ -269,12 +270,13 @@ module PgHero 
     | 
|
| 
       269 
270 
     | 
    
         
             
                        used = azure_stats("storage_used", **options)
         
     | 
| 
       270 
271 
     | 
    
         
             
                        free_space(quota, used)
         
     | 
| 
       271 
272 
     | 
    
         
             
                      else
         
     | 
| 
       272 
     | 
    
         
            -
                         
     | 
| 
       273 
     | 
    
         
            -
                        # could add io_consumption_percent
         
     | 
| 
      
 273 
     | 
    
         
            +
                        replication_lag_stat = azure_flexible_server? ? "physical_replication_delay_in_seconds" : "pg_replica_log_delay_in_seconds"
         
     | 
| 
       274 
274 
     | 
    
         
             
                        metrics = {
         
     | 
| 
       275 
275 
     | 
    
         
             
                          cpu: "cpu_percent",
         
     | 
| 
       276 
276 
     | 
    
         
             
                          connections: "active_connections",
         
     | 
| 
       277 
     | 
    
         
            -
                          replication_lag:  
     | 
| 
      
 277 
     | 
    
         
            +
                          replication_lag: replication_lag_stat,
         
     | 
| 
      
 278 
     | 
    
         
            +
                          read_iops: "read_iops", # flexible server only
         
     | 
| 
      
 279 
     | 
    
         
            +
                          write_iops: "write_iops" # flexible server only
         
     | 
| 
       278 
280 
     | 
    
         
             
                        }
         
     | 
| 
       279 
281 
     | 
    
         
             
                        raise Error, "Metric not supported" unless metrics[metric_key]
         
     | 
| 
       280 
282 
     | 
    
         
             
                        azure_stats(metrics[metric_key], **options)
         
     | 
| 
         @@ -284,6 +286,10 @@ module PgHero 
     | 
|
| 
       284 
286 
     | 
    
         
             
                    end
         
     | 
| 
       285 
287 
     | 
    
         
             
                  end
         
     | 
| 
       286 
288 
     | 
    
         | 
| 
      
 289 
     | 
    
         
            +
                  def azure_flexible_server?
         
     | 
| 
      
 290 
     | 
    
         
            +
                    azure_resource_id.include?("/Microsoft.DBforPostgreSQL/flexibleServers/")
         
     | 
| 
      
 291 
     | 
    
         
            +
                  end
         
     | 
| 
      
 292 
     | 
    
         
            +
             
     | 
| 
       287 
293 
     | 
    
         
             
                  # only use data points included in both series
         
     | 
| 
       288 
294 
     | 
    
         
             
                  # this also eliminates need to align Time.now
         
     | 
| 
       289 
295 
     | 
    
         
             
                  def free_space(quota, used)
         
     | 
    
        data/lib/pghero/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: pghero
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3.3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.3.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Andrew Kane
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2023-04- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-04-18 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activerecord
         
     |