{"id":50713670,"url":"https://github.com/devflex-pro/chanprobe","last_synced_at":"2026-06-09T17:03:53.093Z","repository":{"id":359656610,"uuid":"1246997483","full_name":"devflex-pro/chanprobe","owner":"devflex-pro","description":"  Observable bounded queues for Go with context-aware send/recv, drop policies, snapshots, and expvar support.","archived":false,"fork":false,"pushed_at":"2026-05-22T19:48:27.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-22T22:32:48.982Z","etag":null,"topics":["backpressure","bounded-queue","channels","concurrency","go","golang","metrics","observability","queue"],"latest_commit_sha":null,"homepage":"","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/devflex-pro.png","metadata":{"files":{"readme":"README.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-22T19:38:08.000Z","updated_at":"2026-05-22T19:48:31.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/devflex-pro/chanprobe","commit_stats":null,"previous_names":["devflex-pro/chanprobe"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/devflex-pro/chanprobe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devflex-pro%2Fchanprobe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devflex-pro%2Fchanprobe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devflex-pro%2Fchanprobe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devflex-pro%2Fchanprobe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devflex-pro","download_url":"https://codeload.github.com/devflex-pro/chanprobe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devflex-pro%2Fchanprobe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34116461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["backpressure","bounded-queue","channels","concurrency","go","golang","metrics","observability","queue"],"created_at":"2026-06-09T17:03:51.193Z","updated_at":"2026-06-09T17:03:53.086Z","avatar_url":"https://github.com/devflex-pro.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chanprobe\n\nObservable bounded in-process queues for Go services.\n\n`chanprobe` is a small Go library for instrumenting important async boundaries:\nworker pools, event pipelines, webhook delivery, background jobs, rate-limited\nintegrations, Kafka/NATS consumers, and similar queues.\n\nThe goal is not to replace every `chan`. The goal is to make production queues\nvisible:\n\n- Is the producer blocked?\n- Is the consumer slow?\n- How long do items wait in the queue?\n- Are we dropping work?\n- Which queue introduced latency?\n- When did backpressure start?\n\nUse `chanprobe` when the queue itself is an operational signal.\n\n## Installation\n\n```bash\ngo get github.com/devflex-pro/chanprobe\n```\n\n## Basic Example\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n\n    \"github.com/devflex-pro/chanprobe\"\n)\n\nfunc main() {\n    ctx := context.Background()\n    jobs := chanprobe.New[string](\"jobs\", 1024)\n    defer jobs.Close()\n\n    if err := jobs.Send(ctx, \"hello\"); err != nil {\n        panic(err)\n    }\n\n    job, ok := jobs.Recv(ctx)\n    if !ok {\n        return\n    }\n\n    fmt.Println(job)\n}\n```\n\n## Drop Policies\n\nThe default policy is `Block`: `Send` waits for capacity and `TrySend` fails\nimmediately when the queue is full.\n\n```go\nq := chanprobe.New[string](\n    \"webhook_delivery\",\n    10_000,\n    chanprobe.WithDropPolicy(chanprobe.DropOldest),\n)\n```\n\nAvailable policies:\n\n- `Block`: wait for space in `Send`.\n- `DropNewest`: reject incoming work when full.\n- `DropOldest`: evict the oldest queued item and insert the new one.\n\n## Metrics\n\nEvery queue exposes a point-in-time snapshot:\n\n```go\nsnap := jobs.Snapshot()\n\nfmt.Println(\"queue\", snap.Name)\nfmt.Println(\"depth\", snap.Len, \"of\", snap.Cap)\nfmt.Println(\"sent\", snap.SentTotal)\nfmt.Println(\"received\", snap.ReceivedTotal)\nfmt.Println(\"dropped\", snap.DroppedTotal)\nfmt.Println(\"oldest age\", snap.OldestItemAge)\n```\n\nSnapshot fields:\n\n- `len`\n- `cap`\n- `sent_total`\n- `received_total`\n- `dropped_total`\n- `send_blocked_total`\n- `recv_blocked_total`\n- `send_wait_total`\n- `recv_wait_total`\n- `item_wait_total`\n- `oldest_item_age`\n- `closed`\n\n`dropped_total` counts work the queue actually discarded: `DropNewest`\nrejections and `DropOldest` evictions. A failed `TrySend` on a full blocking\nqueue is not counted as dropped work.\n\n## expvar\n\nQueues register in the default registry unless registration is disabled with\n`WithRegistry(nil)`.\n\n```go\nchanprobe.PublishExpvar(\"chanprobe\", nil)\nhttp.ListenAndServe(\":8080\", nil)\n```\n\nThen inspect:\n\n```bash\ncurl http://localhost:8080/debug/vars\n```\n\nSee [examples/http_debug](examples/http_debug/main.go) for a runnable example.\n\n## Performance\n\n`chanprobe` adds observability and context-aware queue operations. It has\noverhead compared to native channels. Use it at important async boundaries where\nvisibility matters, not as a blanket replacement for every channel.\n\nRun local benchmarks with:\n\n```bash\ngo test -bench=. -benchmem ./...\n```\n\n## When Not To Use This Package\n\n- For tiny internal channels where native channel performance matters most.\n- For hot loops that do not need queue metrics.\n- When you need a drop-in `chan T` replacement.\n- When your metrics backend already instruments the queue boundary directly.\n\n## Non-goals\n\n- No `unsafe` in the core package.\n- No runtime monkey-patching.\n- No magical resizing of Go channels.\n- No global goroutine scanning.\n- No mandatory Prometheus or OpenTelemetry dependency in the core package.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevflex-pro%2Fchanprobe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevflex-pro%2Fchanprobe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevflex-pro%2Fchanprobe/lists"}