Graph-Based Fault Localization in Microservices using Static Code Metrics
Localization of faults in complex microservice systems is a critical challenge, as failures can propagate across highly interconnected call graphs spanning multiple methods and services. Existing fault localization approaches rely on runtime telemetry such as distributed traces, logs, and metrics, which are often infeasible due to cost, privacy constraints, or lack of instrumentation. To address these issues, this research introduces a proactive, static fault localization framework that operates exclusively on artifacts available during development: a multi-level call graph constructed from source code, statically extracted code metrics, and integration test outcomes obtained before deployment. The proposed approach enables fault detection at both the macro level (entire microservices) and the micro-level (individual methods) by constructing a multi-tier system graph that integrates services, APIs, and methods. We implemented a Graph Attention Network (GAT) model augmented with statically selected code metrics, and compared it to twoapproaches on the Train Ticket benchmark: Spectrum-Based Fault Localization (SBFL) and Graph Neural Networks (GNN). Our GAT model augmented with code metrics achieves 93.8% Top-1 accuracy at the method level under leave-one-fault-out cross-validation, with a near-zero gap between held-out and in-sample performance, and outperforms other models. This methodology enables engineers to identify high-risk components in microservice-based systems prior to deployment.