{"id":20252606,"url":"https://github.com/streamdal/gophercon2021","last_synced_at":"2025-10-23T17:51:27.580Z","repository":{"id":110652487,"uuid":"429328501","full_name":"streamdal/gophercon2021","owner":"streamdal","description":null,"archived":false,"fork":false,"pushed_at":"2021-12-08T17:40:54.000Z","size":5475,"stargazers_count":9,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-10T23:16:38.102Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/streamdal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-11-18T07:00:45.000Z","updated_at":"2022-12-05T03:41:02.000Z","dependencies_parsed_at":"2024-01-18T09:17:32.641Z","dependency_job_id":null,"html_url":"https://github.com/streamdal/gophercon2021","commit_stats":null,"previous_names":["batchcorp/gophercon2021"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamdal%2Fgophercon2021","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamdal%2Fgophercon2021/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamdal%2Fgophercon2021/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamdal%2Fgophercon2021/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamdal","download_url":"https://codeload.github.com/streamdal/gophercon2021/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248312132,"owners_count":21082638,"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-14T10:17:33.061Z","updated_at":"2025-10-23T17:51:27.455Z","avatar_url":"https://github.com/streamdal.png","language":"Go","readme":"# Reliability Nirvana\n## GopherCon 2021\n\nThis repo contains the various materials used as part of the [\"Reliability Nirvana\"](https://www.gophercon.com/agenda/speakers/1221929) \npresentation.\n\nContents:\n\n* `./svc` - idempotent sample service\n* `./example1` - bare-bones sample producer \u0026 consumer\n* `./docker-compose.yaml` - rabbitmq, etcd and statsd + graphite (for demo visualization)\n  * `docker-compose.yaml up -d` - to bring up all\n  * or \n  * `docker-compose up -d $specific-dependency`\n* `./assets` - config files for graphite, screenshots for this repo\n\nOnce docker-compose is finished, you should be able to view the graphite UI by pointing\nyour browser at `http://localhost:80` and see something like this:\n\n![Graphite screenshot](./assets/graphite.png)\n\nThe `orders` and `notify` services will emit the following metrics:\n\n* `$service_new_order_ok`\n  * Emitted by service when an event is processed successfully\n* `$service_new_order_skipped`\n  * Emitted by service when an event is skipped\n\nThese metrics can be found under the path: `Metrics/stats_counts/$service_new_order_*`\n\n## Demo\n\n### 1. Basic consume/produce\n\n1. Bring up dependencies\n   1. `docker-compose up -d`\n2. Verify dependencies are up\n3. Bing up services\n   1. `cd svc \u0026\u0026 SERVICE_NAME=order go run *.go`\n   2. In another terminal: `cd svc \u0026\u0026 SERVICE_NAME=notify go run *.go`\n4. Publish an event \n   1. `plumber write rabbit --exchange-name events --input '{\"type\":\"new_order\",\"id\":\"123\"}' --routing-key=foo`\n5. Observe services consume the event\n   1. `orders_new_order_ok` metric will increase in Graphite UI (http://localhost:80)\n   2. `notify_new_order_ok` metric will increase\n\n### 2. Recovery - one of the consumers is down (for a while)\n\n1. Bring down `notify` service (via `ctrl-c`)\n2. Publish another event\n3. Observe service `orders` consume the event\n   1. `orders_new_order_ok` metric will increase\n   2. `notify_new_order_ok` metric will **not** increase\n4. Bring up \"notify\" service\n   1. `cd svc \u0026\u0026 SERVICE_NAME=notify go run *.go`\n5. See it consume the event\n   1. `notify_new_order_ok` metric will increase on its own\n\n### 3. Idempotency\n\n1. Publish several events via `plumber`\n2. `orders` and `notify` services will both consume and process the messages each time\n3. `orders_processed` and `notifications_sent` metrics will increase...\n4. **^ But this is incorrect** - it's the same event - we shouldn't be processing duplicate events\n5. Enable etcd usage by restarting services and setting an ENV var:\n   1. `cd svc \u0026\u0026 ENABLE_ETCD=true SERVICE_NAME=orders go run *.go`\n   2. `cd svc \u0026\u0026 ENABLE_ETCD=true SERVICE_NAME=notify go run *.go`\n6. Publish a single event\n7. Watch services consume the event\n   1. `orders_new_order_ok` \u0026 `notify_new_order_ok` will increase\n8. Publish an event once more\n9. Both services will _skip_ the event because the message id has been seen\n   1. `orders_new_order_skipped` \u0026 `notify_new_order_skipped` metrics will be populated\n10. Restart the services and re-emit events\n11. Services will instantly skip the message (due to initial cache import)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamdal%2Fgophercon2021","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamdal%2Fgophercon2021","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamdal%2Fgophercon2021/lists"}