Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Azure Monitor: adjust grouping logic and avoid duplicating documents …
…to make the metricset TSDB-friendly (#36823) ## Overview (WHAT) Here is a summary of the changes introduced with this PR. - Update the metric grouping logic - Track metrics collection info - Adjust collection interval ### Update the metric grouping logic Streamlines the metrics grouping logic to include all the fields the TSDB team identified as dimensions for the Azure Metrics events. Here are the current components of the grouping key: - timestamp - namespace - resource ID - resource Sub ID - dimensions - time grain It also tries to make the grouping simpler to read. (WHY) When TSDB is enabled, it drops events with the same timestamp and dimensions. The metricset must group all metrics values by timestamp+dimensions and create one event for each group to avoid data loss. ### Track metrics collection info The metricset tracks the timestamp and time grain for each metrics collection. At the beginning of each iteration, it skips collecting a value if the metricset has already collected a value for the (time grain) period. (WHY) The metricset usually collects one data point for each collection period. When the time grain is larger than the collection period, the metricset collects the identical data point multiple times. For example, consider a `PT1H` (one hour) time grain and a collection period of five minutes: without tracking, the metrics would collect the identical `PT1H` data point 12 times. ### Adjust collection interval Change the collection interval to `[{-2 x INTERVAL},{-1 x INTERVAL})` with a delay of `{INTERVAL}`. (WHY) The collection interval was [2x the collection period or time grain](https://github.com/elastic/beats/blob/ed34c37f59c7bc0cf9e8051f7b5327c861b59467/x-pack/metricbeat/module/azure/client.go#L110-L116). This interval is too large, and we collected multiple data points for the same metric. There was some code to drop the additional data points, but it wasn't working in all cases. Glossary: - collection interval: the time range used to fetch metrics values. - collection period: time between metric collections (e.g., with a 5 min period, the metricset collects new metrics every 5 minutes) (cherry picked from commit 886d078)
- Loading branch information