{"id":17216406,"url":"https://github.com/exhuma/gopgstats","last_synced_at":"2025-03-25T13:43:03.315Z","repository":{"id":66736602,"uuid":"153266711","full_name":"exhuma/gopgstats","owner":"exhuma","description":null,"archived":false,"fork":false,"pushed_at":"2018-10-20T16:34:25.000Z","size":36,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T12:32:51.816Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/exhuma.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-16T10:24:36.000Z","updated_at":"2018-11-16T21:50:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"4b199480-88b8-43a1-81ca-f96bbaab802b","html_url":"https://github.com/exhuma/gopgstats","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exhuma%2Fgopgstats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exhuma%2Fgopgstats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exhuma%2Fgopgstats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exhuma%2Fgopgstats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/exhuma","download_url":"https://codeload.github.com/exhuma/gopgstats/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245473743,"owners_count":20621283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T03:27:40.756Z","updated_at":"2025-03-25T13:43:03.307Z","avatar_url":"https://github.com/exhuma.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"PostgreSQL statistics for Go\n============================\n\n\nThis package contains helper functions to retrieve runtime statistcs of a\nPostgreSQL DB server. The aim is to decouple the DB queries from Go\napplications.\n\nStatistics will always return as a list of structs where each statistic has its\nown struct. The decision to do this instead of returning a list of\n``interface{}`` items was that this keeps type-safety and removes guesswork.\n\nAs of 2018-10-17, this package contains a couple of statistics. More will come\nsoon.\n\n\nDSN \u0026 URLs\n----------\n\nPlease take note that URLs are **not** yet supported as database DSNs. Certain\nstatistics are only available on the databse of the currently active\nconnection. This means that in order to fetch statistics from all databases, a\nnew connection must be established per DB. ``gopgstats`` will reuse the DSN\nwhich was used to create the ``Fetcher`` object and modify it as needed. This\nmodification is currently only coded for normal connection strings. Not for\nURLs!\n\n\nUsage\n-----\n\n::\n\n    import (\n        \"database/sql\"\n        \"github.com/exhuma/gopgstats\"\n        _ \"github.com/lib/pq\"\n    )\n\n    // Use a normal PostgreSQL DSN syntax here. Note that URLs are currently\n    // NOT supported!\n    dsn := \"host=dbhost username=jdoe password=s3cr37\"\n    db, err := sql.Open(\"postgres\", dsn)\n    if err != nil {\n        panic(err)\n    }\n\n    fmt.Println(\"--- Locks\")\n    fetcher := gopgstats.MakeDefaultFetcher(db)\n    result, err := fetcher.Locks()\n    fmt.Println(err)\n    fmt.Println(result)\n\n    fmt.Println(\"--- Disk IO\")\n    diskio, err := fetcher.DiskIOAll(dsn)\n    fmt.Println(err)\n    fmt.Println(diskio)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexhuma%2Fgopgstats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexhuma%2Fgopgstats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexhuma%2Fgopgstats/lists"}