# Cost-Profiling Microservice Applications Using an APM Stack
## 6 Related Works  
Beyond the earlier works on cloud monitoring surveyed at [9; 10; 11; 12], there are not many approaches in the academic literature that are explicitly aimed at monitoring microservices, specifically their cost. There are a few exceptions worth mentioning, though. [PERSON] et al. [6] presented CostHat, a graph-based model of the end-to-end operational costs of microservice applications deployed either on VMs or as serverless functions. The model is able to calculate the cost per application and microservice based on its incoming workload and can be used to perform what-if analysis for changes in the application. In order to do so, however, it requires, among other things, the costs per request and deployment for each microservice. In this respect, our tool can be used both in conjunction with CostHat and as an alternative to it. [PERSON] and [PERSON] present in [13] Costradamus, a cost-profiling system for services (including microservices) implemented in the serverless model. It relies on having access to logs, data from invocation responses, or the modeling of the responses and incorporates the notion of waste, albeit in a manner that is, by now, fairly obsolete (as the difference between metered and billed function call duration). Cost monitoring is also often present as a critical component in solutions aiming to address different problems. For example, these can be dealing with resource management of microservice architectures at scale, such as the work by [PERSON] et al. [14] or [PERSON] et al. [15]. The efficient automated scaling of microservices, for example [16], includes, by necessity, cost monitoring. Other works aim to optimize the deployment of microservices across service providers [17] or the cloud-edge continuum [18]. A related problem requiring cost monitoring is that of the optimization of (micro)service orchestration, as discussed, for example by the Ananke system [19; 20] and the work by [PERSON] et al. [21]. None of the above approaches, however, provide application developers with the tools to understand how the cost of deploying and operating their application and infrastructure breaks down to the individual microservices involved. In addition to the commercial and closed-source solutions for microservice application observability discussed in the introduction, there are also a series of industrial solutions specifically aimed at cost profiling. These include, among others, Infracost ([[https://www.infracost.io/](https://www.infracost.io/)]([https://www.infracost.io/](https://www.infracost.io/)) (accessed on 1 December 2022)) and C-Facts ([[https://www.c-facts.com/](https://www.c-facts.com/)]([https://www.c-facts.com/](https://www.c-facts.com/)) (accessed on 1 December 2022)). Infracost provides tools for the cost analysis of infrastructure as code (IaC) artifacts such as Terraform. The drawback is that they can only show costs related to infrastructure usage in, e.g., units, but they cannot show information about the effectiveness of the underlying infrastructure or the allocation of the infrastructure with respect to the microservice architecture. C-Facts offers a centralized solution for the monitoring and analysis of operational expenses across cloud providers with an all-in-one dashboard for their visualization. However, it relies on the ingestion of data by their own system, creating effectively a vendor lock-in, in contrast to our solution. In terms of open-source projects, the closest to our proposal is OpenCost ([[https://www.opencos.io/](https://www.opencos.io/)]([https://www.opencos.io/](https://www.opencos.io/)) (accessed on 1 December 2022)), itself an evolution of the Kubecost project ([[https://www.kubecost.com/](https://www.kubecost.com/)]([https://www.kubecost.com/](https://www.kubecost.com/)) (accessed on 1 December 2022)). OpenCost is a vendor-neutral cost-monitoring tool for Kubernetes clusters built on top of Prometheus with integrations to the billing systems of the three hyperscalers.