GithubHelp home page GithubHelp logo

minghsu0107 / saga-product Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 0.0 230 KB

Transaction services of the saga pattern implementation.

Go 99.42% Makefile 0.35% Dockerfile 0.19% Shell 0.04%
go saga transaction microservices event-driven nats idempotency sonyflake monorepo

saga-product's Introduction

Saga Product

Transaction services of my saga pattern implementation, including product, order, payment and orchestrator.

Features:

  • Entirely event-driven
  • Idempotency for all transactions
  • Stateless saga orchestrator making transactions scalable
  • Sonyflake distributed unique ID generator
  • Redis cache for fast data retrieval
  • Bloom/Cuckoo filters for preventing cache penatration
  • Prometheus metrics
  • Distributed tracing with OpenTelemetry
    • HTTP server
    • gRPC server
    • gPRC client
    • Event handlers
  • Four microservices in a monorepo and compiled to a single binary, minimizing deployment efforts
  • Comprehensive application struture with domain-driven design (DDD), decoupling service implementations from configurations and transports
  • Compile-time dependecy injection using wire
  • Graceful shutdown
  • Unit testing and continuous integration using Drone CI

Usage

See docker-compose example for details on how to start each service.

Exported Metrics

  • APP could be product, order, payment, or orchestrator.
  • HTTPAPP could be product, order, or payment.
Metric Description Labels
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
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")
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
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
HTTPAPP_http_requests_inflight A Prometheus gauge. Records the number of inflight requests being handled at the same time. code, handler, method
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

saga-product's People

Contributors

minghsu0107 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.