Пример интеграции opentelemetry в moleculer по средством custom tracer.
Выполнить npx parcel ./webapp/index.html --no-cache --no-hmr --dist-dir=./public
.
В соседнем терминале.
Выполнить yarn dc:up
.
Запуск завершен, можно работать http://localhost:3000
и http://localhost:9411/zipkin
Чтобы обновления кода BE попали в контейнеры нужно выполнять yarn dc:up
.
После окончания работ выключить контейнеры docker compose yarn dc:down
и остановить процесс parcel
.
- Setup webapp for emit spans to Zipkin backend and share context with moleculer backend.
- Setup the
api-gateway
service that will broadcast requests to another services-(product, cart, order). - Setup the
product
service that will handle actions:- by them self and return list of products.
- Setup the
cart
service that will handle actions:- them self by save cart to
db
. - emit some message to RabbitMQ, for collect
metrics
. - emit some message to RabbitMQ, for reservation products on the
warehouse
.
- them self by save cart to
- Setup the
order
service that will handle action:- by them self by save order to db.
- by call cart service for getting cart data.
- emit some message to RabbitMQ, for collect
metrics
. - emit some message to RabbitMQ, for activate
delivery
.
- Setup the
partner
service that will handle action:- by them self, save data to db.
- emit events for
metrics
consumer.
- Configure
metrics
consumer, which itself will handle events that were triggered by "product", "cart" and "order". - Configure
delivery
consumer, which itself will process events that were launched by the serviceorder
through calling actions in the serviceproduct
, and will also generate events that will be processed by the consumermetrics
- Configure
warehouse
consumer, which itself will handle events that were triggered bycart
service through calling actions in the serviceproduct
, and also make http request topartner
service.
- Emit trace form webapp.
- Spreading the trace context between the web application and the api gateway, as well as services and consumers.
- Emit trace from moleculer services, consumers, any http service.
- The continuity of the trace in all the involved areas.
In the result I'm want to see all traces in Zipkin GUI.