{"id":17982969,"url":"https://github.com/minghsu0107/saga-product","last_synced_at":"2025-03-25T19:31:49.427Z","repository":{"id":59046443,"uuid":"359215517","full_name":"minghsu0107/saga-product","owner":"minghsu0107","description":"Transaction services of the saga pattern implementation.","archived":false,"fork":false,"pushed_at":"2023-02-16T10:23:04.000Z","size":230,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-20T17:39:03.573Z","etag":null,"topics":["event-driven","go","idempotency","microservices","monorepo","nats","saga","sonyflake","transaction"],"latest_commit_sha":null,"homepage":"","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/minghsu0107.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-18T17:53:33.000Z","updated_at":"2024-01-21T17:10:26.000Z","dependencies_parsed_at":"2023-02-18T10:17:05.184Z","dependency_job_id":null,"html_url":"https://github.com/minghsu0107/saga-product","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minghsu0107%2Fsaga-product","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minghsu0107%2Fsaga-product/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minghsu0107%2Fsaga-product/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minghsu0107%2Fsaga-product/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/minghsu0107","download_url":"https://codeload.github.com/minghsu0107/saga-product/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245530321,"owners_count":20630530,"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":["event-driven","go","idempotency","microservices","monorepo","nats","saga","sonyflake","transaction"],"created_at":"2024-10-29T18:15:43.145Z","updated_at":"2025-03-25T19:31:47.242Z","avatar_url":"https://github.com/minghsu0107.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Saga Product\nTransaction services of my [saga pattern implementation](https://github.com/minghsu0107/saga-example), including product, order, payment and orchestrator.\n\nFeatures:\n- Entirely event-driven\n- Idempotency for all transactions\n- Stateless saga orchestrator making transactions scalable\n- Sonyflake distributed unique ID generator\n- Redis cache for fast data retrieval\n- Bloom/Cuckoo filters for preventing cache penatration\n- Prometheus metrics\n- Distributed tracing with [OpenTelemetry](https://opentelemetry.io)\n  - HTTP server\n  - gRPC server\n  - gPRC client\n  - Event handlers\n- Four microservices in a monorepo and compiled to a single binary, minimizing deployment efforts\n- Comprehensive application struture with domain-driven design (DDD), decoupling service implementations from configurations and transports\n- Compile-time dependecy injection using [wire](https://github.com/google/wire)\n- Graceful shutdown\n- Unit testing and continuous integration using [Drone CI](https://www.drone.io)\n## Usage\nSee [docker-compose example](https://github.com/minghsu0107/saga-example/blob/main/docker-compose.yaml) for details on how to start each service.\n## Exported Metrics\n- `APP` could be `product`, `order`, `payment`, or `orchestrator`.\n- `HTTPAPP` could be `product`, `order`, or `payment`.\n\n| Metric                                                                                                                                   | Description                                                                                                 | Labels                                                           |\n| ---------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |\n| APP_pubsub_subscriber_messages_received_total                                                                                                       | A Prometheus Counter. Counts the number of messages obtained by the subscriber.                             | `acked` (\"acked\" or \"nacked\"), `handler_name`, `subscriber_name` |\n| APP_pubsub_handler_execution_time_seconds (APP_pubsub_handler_execution_time_seconds_count, APP_pubsub_handler_execution_time_bucket, APP_pubsub_handler_execution_time_seconds_sum) | A Prometheus Histogram. Records the execution time of the handler function wrapped by the middleware.       | `handler_name`, `success` (\"true\" or \"false\")                    |\n| APP_pubsub_publish_time_seconds (APP_pubsub_publish_time_seconds_count, APP_pubsub_publish_time_seconds_bucket, APP_pubsub_publish_time_seconds_sum)                                 | A Prometheus Histogram. Registers the time of execution of the Publish function of the decorated publisher. | `handler_name`, `success` (\"true\" or \"false\"), `publisher_name`  |\n| HTTPAPP_http_request_duration_seconds (HTTPAPP_http_request_duration_seconds_count, HTTPAPP_http_request_duration_seconds_bucket, HTTPAPP_http_request_duration_sum)     | A Prometheus histogram. Records the latency of the HTTP requests.                                           | `code`, `handler`, `method`                                      |\n| HTTPAPP_http_requests_inflight                                                                                                                   | A Prometheus gauge. Records the number of inflight requests being handled at the same time.                 | `code`, `handler`, `method`                                      |\n| HTTPAPP_http_response_size_bytes (HTTPAPP_http_response_size_bytes_count, HTTPAPP_http_response_size_bytes_bucket, HTTPAPP_http_response_size_bytes_sum)                 | A Prometheus histogram. Records the size of the HTTP responses.                                             | `handler`                                                        |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminghsu0107%2Fsaga-product","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fminghsu0107%2Fsaga-product","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminghsu0107%2Fsaga-product/lists"}