Dapr
Published on: October 19, 2024

đź”—Dapr
Dapr is an event-driven, distributed runtime that makes it easy for developers to develop applications that are resilient, stateless/stateful (without being an expert in distributed systems) that can run on cloud as well as edge.
Dapr follows the sidecar pattern and provides APIs that implemented keeping best practices in mind for building micro-services in form of Building Blocks
Microservice building for cloud and edge are shown below (and growing :))
My work
TLDR
I wrote metrics for Dapr Workflow Building Block ↗️.
The Issue
I worked on implementing metrics for the Dapr Workflow Building Block .This helped Dapr users to track the overall traffic and health of their applications (workflows).
To fully understand the issue I worked on, check this Issue link.
I am very proud of this contribution since I got to be one of the enablers for making Dapr more stable.
The Solution
For the solution, I wrote custom metrics using Open Census. To be precise, I implemented the following metrics:
- Workflow Operations count : records total number of successful/failed workflow operations requests.
- Workflow Operation Latency: records the latency for the workflow operations requests.
- Workflow execution count: records total number of Successful/Failed/ Recoverable workflow executions.
- Activity Execution count: records total number of Successful/Failed/ Recoverable workflow execution.
- Activity Execution Latency: records latency for Successful/Failed/ Recoverable workflow execution.
To deliver a complete solution, I also wrote tests for the implementation that had 92% coverage in the initial implementation.
Things I learnt about
Here is the Link to the Pull Request
Actor Model
The đź”—Dapr project has the đź”—Actor Model at it's core. I got to learn the implementation of the Actor pattern, how it works and how to implement it. I came across amazing resources from senior engineers at Microsoft that explained the conceptual knowledge perfectly. One of them is this YouTube Video
Workflow Engine
This is the internal implementation that manages the overall execution of a Dapr workflow analysing the events, status updates and even emitting metrics.
It also performs the task of scheduling the execution and re-scheduling in case of the event of a failure.
The in-depth explanation of the workflow engine will be in a different section.
I leant in depth how to work with concurrency in Go. I learnt how to work with time, sync, Marshalling/Un-Marshalling data and Durable tasks etc.