arXiv:2609.31292cs.NISep 2026

Manuscript Offprint

arXiv:2609.31292

Dynamic Sampling for Telemetry in Microservices: A Reinforcement Learning and Entropy-Based Approach

Renan Martins Alves, Jéferson Campos Nobre, Juliano Araujo Wickboldt

Abstract

Microservices architectures are increasingly deployed in cloud-based distributed environments, making application development and maintenance more dynamic, but also increasing the complexity of troubleshooting and observability. Distributed tracing tools are therefore essential for request analysis and debugging, despite introducing additional overhead that can be amplified by excessive and inefficient data collection. This article proposes RADAR (Reinforcement Learning Agent for Dynamic And Relevant trace sampling), an agent that combines reinforcement learning with a data entropy assessment to achieve more efficient capture of traces relevant to system monitoring, based on the OpenTelemetry standard. RADAR tests different sampling rules to discover which combination is most efficient. A test environment simulating a minimalist online store with several microservices distributed across a Kubernetes cluster served as the basis for the experiments, which evaluated the agent's convergence and the system's performance in terms of resource consumption and collected data quality. Results showed that RADAR reduced network bandwidth consumption by 97.4% and CPU usage by 99.0% compared to full data collection, also outperforming a fixed-rate sampling baseline. Beyond these resource savings, the approach preserved observability of critical scenarios, retaining approximately 85.6% of rare trace patterns and increasing the average entropy of the stored information by approximately 25%, validating the feasibility of using entropy to orchestrate telemetry autonomously and efficiently.

Keywords: Microservices, Distributed Tracing, OpenTelemetry, Reinforcement Learning, Entropy, Autonomic Computing

1 Introduction

The transition from monolithic architectures to microservices has allowed organizations to increase development agility and application scalability [1]. However, this transition has also increased the complexity of performing system observability tasks [2]. In microservices environments, a single user request may traverse dozens of independent services, making distributed tracing an indispensable tool for understanding execution flow and diagnosing latent failures [2]. OpenTelemetry has emerged as an open standard that enables the generation, collection, and export of telemetry data across a wide range of languages and platforms, allowing end-to-end request tracing.

Despite its importance, collecting traces in full at large scale is infeasible: the resulting data volume can overwhelm network bandwidth, consume excessive CPU cycles for processing, and lead to prohibitive storage costs [3]. To mitigate this problem, sampling strategies are applied. Traditional methods, such as probabilistic head-sampling, decide whether to discard data at the beginning of a transaction, failing to capture rare events or errors that only manifest later in the flow. Tail-sampling, in turn, allows for more informed decisions, but its manual configuration is rigid and unable to adapt to the dynamic load and behavior variations typical of cloud environments [4]. Robust solutions such as Hindsight [3], which generates and retains all traces locally and only forwards them to the collector once an anomaly is detected, or the work of Las-Casas et al. [5], which clusters similar and common traces into tree nodes and prioritizes their discard when resources need to be freed, still leave notable gaps, such as rigid trigger definitions for anomalies or a lack of compatibility with more modern observability tooling.

The decision of which traces to retain depends on (i) the dynamic characteristics of traffic, (ii) the occurrence of errors and anomalies, and (iii) the diversity and informational richness of the executed paths. This decision must be made continuously, since system behavior changes over time; static, manually defined sampling heuristics are unable to adapt efficiently to complex and variable scenarios. This leads to the central challenge addressed in this work: how to significantly reduce the volume of traces collected in distributed systems while preserving the high informational value required for observability?

In this scenario, there is a need for observability mechanisms that can autonomously select the most relevant data. This work proposes RADAR (Reinforcement Learning Agent for Dynamic And Relevant trace sampling), a framework that uses Reinforcement Learning (RL) to dynamically adjust sampling policies in OpenTelemetry collectors. RADAR uses Shannon entropy as its reward metric, allowing the system to prioritize traces that present greater informational diversity, while discarding redundant requests that add no diagnostic value.

The main objective of this article is to present a dynamic sampling architecture capable of selecting, from a catalog of tail-sampling rules, the combination that preserves the traces with the highest diversity and diagnostic utility, balancing operational cost against information quality, without relying on statistical heuristics or prior data labeling. The main contributions of this work include:

• The RADAR framework: the design and practical implementation of an RL agent integrated into the OpenTelemetry ecosystem, capable of adjusting sampling policies at runtime;

• An entropy-based reward metric: a methodology for quantifying the relevance of distributed traces, balancing operational cost and information value, without requiring prior data labeling;

• An experimental microservices environment: a test environment with controllable traffic and fault injection, used to evaluate the agent’s convergence and the system’s performance.

The remainder of this article is organized as follows. Section 2 presents the theoretical background on observability, OpenTelemetry, Shannon entropy, and reinforcement learning. Section 3 discusses related work on sampling strategies and telemetry optimization. Section 4 describes the proposed methodology, system architecture, and problem modeling. Section 5 details the RADAR prototype implementation. Section 6 presents the experimental evaluation and results. Finally, Section 7 presents concluding remarks and directions for future work.

References (23)