ankane / pghero

A performance dashboard for Postgres

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to show space graph on Azure Flexible Postgres Server if storage auto-growth is enabled

Jamesits opened this issue · comments

Azure Flexible Postgres Server with storage auto-growth is enabled does not have storage_limit monitor stat. On such configuration, /free_space_stats returns 500.

Relevant stack trace:

Started GET "/free_space_stats" for 172.71.214.143 at 2024-03-12 06:56:03 +0000
Processing by PgHero::HomeController#free_space_stats as */*
Completed 500 Internal Server Error in 304ms (ActiveRecord: 0.0ms | Allocations: 3243)
  
MsRest::HttpOperationError ({
  "message": "MsRest::HttpOperationError",
  "request": {
    "base_uri": "https://management.azure.com",
    "path_template": "{resourceUri}/providers/microsoft.insights/metrics",
    "method": "get",
    "path_params": null,
    "skip_encoding_path_params": {
      "resourceUri": "/subscriptions/{redacted}/resourceGroups/{redacted}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{redacted}"
    },
    "query_params": {
      "timespan": "2024-02-27T07:00:00Z/2024-03-12T07:00:00Z",
      "interval": "PT1H",
      "metricnames": "storage_limit",
      "aggregation": "Average",
      "top": null,
      "orderby": null,
      "$filter": null,
      "resultType": null,
      "api-version": "2018-01-01",
      "metricnamespace": null
    },
    "skip_encoding_query_params": null,
    "headers": {
      "Content-Type": "application/json; charset=utf-8",
      "Accept": "application/json",
      "accept-language": "en-US",
      "x-ms-client-request-id": "{redacted}"
    },
    "body": null,
    "middlewares": [
      [
        "MsRest::RetryPolicyMiddleware",
        {
          "times": 3,
          "retry": 0.02
        }
      ],
      [
        "cookie_jar"
      ]
    ],
    "log": null
  },
  "response": {
    "body": "{\"code\":\"BadRequest\",\"message\":\"Failed to find metric configuration for provider: Microsoft.DBforPostgreSQL, resource Type: flexibleServers, metric: storage_limit, Valid metrics: bloat_percent,tps,is_db_alive,backup_storage_used,cpu_credits_consumed,cpu_credits_remaining,cpu_percent,memory_percent,iops,disk_bandwidth_consumed_percentage,disk_iops_consumed_percentage,disk_queue_depth,read_throughput,write_throughput,read_iops,write_iops,storage_percent,storage_used,storage_free,txlogs_storage_used,xact_total,xact_commit,xact_rollback,numbackends,deadlocks,tup_inserted,tup_deleted,tup_updated,tup_returned,tup_fetched,temp_files,temp_bytes,blks_read,blks_hit,sessions_by_state,sessions_by_wait_event_type,oldest_backend_time_sec,oldest_backend_xmin,oldest_backend_xmin_age,longest_query_time_sec,longest_transaction_time_sec,physical_replication_delay_in_seconds,physical_replication_delay_in_bytes,logical_replication_delay_in_bytes,active_connections,max_connections,network_bytes_egress,network_bytes_ingress,connections_failed,connections_succeeded,maximum_used_transactionIDs,analyze_count_user_tables,autoanalyze_count_user_tables,autovacuum_count_user_tables,n_dead_tup_user_tables,n_live_tup_user_tables,n_mod_since_analyze_user_tables,tables_analyzed_user_tables,tables_autoanalyzed_user_tables,tables_autovacuumed_user_tables,tables_counter_user_tables,tables_vacuumed_user_tables,vacuum_count_user_tables,client_connections_active,client_connections_waiting,server_connections_active,server_connections_idle,total_pooled_connections,num_pools\"}",
    "headers": {
      "cache-control": "no-cache",
      "pragma": "no-cache",
      "content-length": "1560",
      "content-type": "application/json; charset=utf-8",
      "expires": "-1",
      "x-ms-correlation-request-id": "{redacted}",
      "x-ms-ratelimit-remaining-subscription-reads": "11999",
      "request-context": "appId=cid-v1:{redacted}",
      "x-ms-request-id": "{redacted},
      "strict-transport-security": "max-age=31536000; includeSubDomains",
      "x-ms-routing-request-id": "{redacted}",
      "x-content-type-options": "nosniff",
      "x-cache": "CONFIG_NOCACHE",
      "x-msedge-ref": "{redacted}",
      "date": "Tue, 12 Mar 2024 06:56:03 GMT"
    },
    "status": 400
  }
}):
  
azure_mgmt_monitor (0.19.0) lib/2018-01-01/generated/azure_mgmt_monitor/metrics.rb:177:in `block in list_async'
concurrent-ruby (1.2.2) lib/concurrent-ruby/concurrent/promise.rb:534:in `block in on_fulfill'
concurrent-ruby (1.2.2) lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:24:in `block in execute'
concurrent-ruby (1.2.2) lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:48:in `block in synchronize'
concurrent-ruby (1.2.2) lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:48:in `synchronize'
concurrent-ruby (1.2.2) lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:48:in `synchronize'
concurrent-ruby (1.2.2) lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:22:in `execute'
concurrent-ruby (1.2.2) lib/concurrent-ruby/concurrent/promise.rb:564:in `block in realize'
concurrent-ruby (1.2.2) lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:352:in `run_task'
concurrent-ruby (1.2.2) lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:343:in `block (3 levels) in create_worker'
concurrent-ruby (1.2.2) lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `loop'
concurrent-ruby (1.2.2) lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `block (2 levels) in create_worker'
concurrent-ruby (1.2.2) lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:333:in `catch'
concurrent-ruby (1.2.2) lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:333:in `block in create_worker'

Hi @Jamesits, thanks for reporting. Will take a look at this next time I'm working with Azure.