# Cost-Profiling Microservice Applications Using an APM Stack
## 1 Introduction  
Microservice architectures, i.e., applications structured as a collection of small and autonomous but collaborating services [1], are a popular style for building cloud-native applications. Companies such as Amazon, Netflix, Deutsche Telekom, LinkedIn, SoundCloud, Uber, and Verizon have been quick in adopting this architectural style [2]. As a result, it has become, in many ways, the de facto architectural style for the design and deployment of modern large-scale web applications. Containerization and orchestration solutions such as Docker ([[https://www.docker.com/](https://www.docker.com/)]([https://www.docker.com/](https://www.docker.com/)) (accessed on 1 December 2022)), Kubernetes ([[https://kubernetes.io/](https://kubernetes.io/)]([https://kubernetes.io/](https://kubernetes.io/)) (accessed on 1 December 2022)), and Nomad ([[https://www.nomadproject.io/](https://www.nomadproject.io/)]([https://www.nomadproject.io/](https://www.nomadproject.io/)) (accessed on 1 December 2022)) are the foundational technologies for automatically deploying, scaling, and managing microservice applications on the cloud. Empowered by adopting these solutions, the application infrastructure usually ends up spanning multiple hardware devices across physical locations and potentially across multiple cloud service providers and is managed independently from the application itself. In this environment, there is an imperative need to possess the ability to observe both how microservices as complex distributed systems behave and how they interact with their underlying infrastructure [3]. Observability, a measure of how well a system's internal state can be inferred by its external outputs, is a concept coming from dynamical systems that has been widely adopted in microservice architectures for this purpose [4]. Achieving observability is challenging on multiple levels [5]. It requires being able to monitor applications across heterogeneous infrastructures, using different, use-case-specific metrics, and producing vast amounts of data while requiring an all-in-one solution for the stakeholders to use. Towards this goal, a number of distributed tracing solutions such as OpenTelemetry ([[https://opentelementetry.io/](https://opentelementetry.io/)]([https://opentelementetry.io/](https://opentelementetry.io/)) (accessed on 1 December 2022)), Jaeger (https://www. jaegertracing.io/ (accessed on 1 December 2022)), Zipkin ([[https://zipkin.io/](https://zipkin.io/)]([https://zipkin.io/](https://zipkin.io/)) (accessed on 1 December 2022)), and, indirectly, Istio ([[https://istio.io/](https://istio.io/)]([https://istio.io/](https://istio.io/)) (accessed on 1 December 2022)) are employed. However, networking-based solutions lack the necessary granularity and insights into the application-level interactions, as they treat the applications' internal workings as a black box. _Automatic platform monitoring (APM)_ solutions are deployed instead of or on top of distributed tracing solutions as non-invasive platforms for collecting metrics without interrupting the application flow. APM solutions, including those offered by companies such as Datadog ([[https://www.datadoghq.com/](https://www.datadoghq.com/)]([https://www.datadoghq.com/](https://www.datadoghq.com/)) (accessed on 1 December 2022)), DynaTrace ([[https://www.dynatrace.com/](https://www.dynatrace.com/)]([https://www.dynatrace.com/](https://www.dynatrace.com/)) (accessed on 1 December 2022)), New Relic ([[https://newrelic.com/](https://newrelic.com/)]([https://newrelic.com/](https://newrelic.com/)) (accessed on 1 December 2022)), and Splunk ([[https://www.splunk.com/](https://www.splunk.com/)]([https://www.splunk.com/](https://www.splunk.com/)) (accessed on 1 December 2022)), have become very popular with microservice architectures as a result. A relatively unexplored possibility offered by these solutions is the ability to provide application stakeholders with very fine-grained cost data at the level of microservices and their corresponding deployments.