{"id":21291509,"url":"https://github.com/postfinance/profiler","last_synced_at":"2025-04-14T15:34:45.174Z","repository":{"id":57513835,"uuid":"241068416","full_name":"postfinance/profiler","owner":"postfinance","description":"pprof endpoint for Go applications that can be activated by a signal","archived":false,"fork":false,"pushed_at":"2025-01-31T12:56:42.000Z","size":52,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-28T04:28:06.252Z","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/postfinance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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":"2020-02-17T09:33:59.000Z","updated_at":"2025-01-31T12:52:56.000Z","dependencies_parsed_at":"2025-01-22T06:22:25.190Z","dependency_job_id":"42b8ac52-e867-4fd9-8d48-993bec061727","html_url":"https://github.com/postfinance/profiler","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/postfinance%2Fprofiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postfinance%2Fprofiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postfinance%2Fprofiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postfinance%2Fprofiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postfinance","download_url":"https://codeload.github.com/postfinance/profiler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248906700,"owners_count":21181204,"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-11-21T13:34:04.391Z","updated_at":"2025-04-14T15:34:45.168Z","avatar_url":"https://github.com/postfinance.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/postfinance/profiler)](https://goreportcard.com/report/github.com/postfinance/profiler)\n[![GoDoc](https://godoc.org/github.com/postfinance/profiler?status.svg)](https://godoc.org/github.com/postfinance/profiler)\n[![Build](https://github.com/postfinance/profiler/actions/workflows/build.yml/badge.svg)](https://github.com/postfinance/profiler/actions/workflows/build.yml)\n[![Coverage](https://coveralls.io/repos/github/postfinance/profiler/badge.svg?branch=master)](https://coveralls.io/github/postfinance/profiler?branch=master)\n\n# profiler\n\n## Usage\n\nAdd the following line to your Go code:\n\n```go\n// create and start the profiler handler\nprofiler.New().Start()\n\n// ... or with custom values\nprofiler.New(\n    profiler.WithSignal(syscall.SIGUSR1),\n    profiler.WithAddress(\":8080\"),\n    profiler.WithTimeout(15 * time.Minute),\n)\n```\n\n## Defaults\n\n| Parameter | Default   |\n|-----------|-----------|\n| Signal    | *SIGUSR1* |\n| Listen    | *:6666*   |\n| Timeout   | *30m*     |\n\n### Start the pprof endpoint\n\n```shell\npkill -SIGUSR1 \u003cyour Go program\u003e\n```\n\n\u003e After *timeout* the endpoint will shutdown.\n\n### Collect pprof data\n\n```shell\ngo tool pprof -http $(hostname):8080 http://localhost:6666/debug/pprof/profile\n```\n\n... or ...\n\n```shell\ngo tool pprof -http localhost:7007 http://localhost:8080/debug/pprof/profile\n```\n\n## Kubernetes\n\n### Start the pprof endpoint\n\n```shell\nkubectl get pods\nNAME                    READY   STATUS    RESTARTS   AGE\n...\n\nkubectl exec -ti \u003cyour pod\u003e -- sh\n/ # pkill -SIGUSR1 \u003cyour Go program\u003e\n/ #\n```\n\n\u003e After *timeout* the endpoint will shutdown.\n\n### Check log\n\n```shell\nkubectl logs \u003cyour pod\u003e -f | grep 'start debug endpoint'\n```\n\n### Port-forward\n\n```shell\nkubectl port-forward \u003cyour pod\u003e 8080:6666\nForwarding from 127.0.0.1:8080 -\u003e 6666\nForwarding from [::1]:8080 -\u003e 6666\nHandling connection for 8080\n```\n\n### Collect pprof data\n\n```shell\ngo tool pprof -http $(hostname):8888 http://localhost:8080/debug/pprof/profile\n```\n\n... or ...\n\n```shell\ngo tool pprof -http localhost:7007 http://localhost:8080/debug/pprof/profile\n```\n\n### Use [statsviz](https://github.com/arl/statsviz)\n\nOpen: [http://localhost:8080/debug/statsviz](http://localhost:8080/debug/statsviz)\n\n### Use [expvarmon](https://github.com/divan/expvarmon)\n\n```shell\nexpvarmon -ports=http://localhost:8080\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostfinance%2Fprofiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostfinance%2Fprofiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostfinance%2Fprofiler/lists"}