# Assessing Evolution of Microservices Using Static Analysis
## 3 The Proposed Centric Metrics
### Metrics Definition  
The seven metrics utilize centralized attributes extracted from the system. Metrics S1 and S2 pertain to the service view, as detailed in Table 2. Metrics D1 through D5 are associated with the data view, as shown in Table 3. Each metric quantifies certain attributes to describe a centric perspective of the microservice system and to assist in the reasoning about its evolution. \begin{table}
\begin{tabular}{l} \hline \hline
**S1: Number of Microservices (\#\(\mu_{s}\))** \\ \hline
**Description:** The count of microservices in the system. \\
**Value:**\#\(\mu_{s}=|S|\). \\
**Goal:** Provides a quantitative measure of the system’s scale or complexity in terms of microservices. \\
**Motivation:** Provides insights into the system’s modularity evolution by showing expansions or contractions in high-level components between subsequent releases. \\ \hline
**S2: Number of Microservice Connections (\#\(C_{\mu_{s}}\))** \\ \hline
**Description:** Number of endpoint calls between microservices in the system. \\
**Value:**\(\sum_{i=1}^{n}|C_{i}|\); where \(n=|S|\). \\
**Goal:** Provides a measure of the communication intensity between microservices in the system. \\
**Motivation:** Reveals changes in the dependency view across system releases and identifies potential bottlenecks, such as excessive connections to a single service. \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Service view metric definitions. \begin{table}
\begin{tabular}{l} \hline \hline
**D1: Number of Persistent Data Entities (\#\(PDE_{s}\))** \\ \hline
**Description:** The count of relational and non-relational persistent data entities in the system. \\
**Value:**\(\sum_{i=1}^{n}|D_{p_{i}}|\); where \(n=|S|\). \\
**Goal:** Provides insight into the scale of persistent data entities within the system. \\
**Motivation:** Provides insights into a data perspective, i.e., the storage approach per each microservice. In addition to the data model, modularity changes throughout releases. \\ \hline
**D2: Number of Transient Data Entities (\#\(TDE_{s}\))** \\ \hline
**Description:** Number of data entities used as data transfer objects (DTOs) across microservices (not persistent in storage). \\
**Value:**\(\sum_{i=1}^{n}|D_{t_{i}}|\); where \(n=|S|\). \\
**Goal:** Provides an indication of the usage scale of data transfer objects. \\
**Motivation:** Illustrates the evolution of additional entities created for customizing responses and data transfer purposes but not involved in domain/business logic. It indicates whether each microservice consumes or delivers more data models to others. \\ \hline
**D3: Number of Relationships between Data Entities (\#\(RDE_{s}\))** \\ \hline
**Description:** The count of relationships between data entities in each microservice’s data model. \\
**Value:**\(|MR|/2\); such that \(MR=\bigcup_{i=1}^{n}\bigcup_{j=1}^{m}\{r,f(r)\mid r\in\bigcup_{l}R_{ijl}\}\); where \(n=|S|\), \\ \(m=|D_{p_{i}}|+|D_{t_{i}}|\), \(f(r)\) is a function that reverses relationships to prevent duplicate counting of both the relationship and its reverse counterpart. \\
**Goal:** Provides a measure of the complexity and interconnectedness of data entities within each microservice’s data model. \\
**Motivation:** Demonstrates the evolution of data model complexity and the presence of cohesive models within each microservice over different releases. \\ \hline
**D4: Number of Merge Candidate Data Entities (\#\(MDE_{s}\))** \\ \hline
**Description:** The count of entities duplicated in multiple bounded contexts. These entities may retain different fields based on the purpose of each bounded context. \\
**Value:**\((\sum_{i=1}^{n}|Dp_{i}|+|Dt_{i}|)-|DE|\); where \(DE=\{f_{d}(d)\mid d\in\bigcup_{i=1}^{n}Dp_{i}+Dt_{i}\}\), \\ \(n=|S|\), \(f_{d}(d)\) is a function that receives an entity and returns the corresponding entity after the Entity Merging phase; it is defined as \\ \(f_{d}(d)= \begin{cases}d&\text{if }d\text{ not merged}\\ d^{\prime}&\text{if }d\text{ was merged into }d^{\prime}\end{cases}