forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix unintended skip in metric collection on Azure Monitor (elastic#37203
) * Fix unintended skip in metric collection Due to the use of `time.Now()` to set the value of the reference time used to decide if collect the value of the metric, the metricset may skip a metric collection. Made two changes to the Azure Monitor metricset: - moved `referenceTime` into the `Fetch()` and truncated its value to seconds to have a more predictable reference time for comparison. - Updated the `MetricRegistry.NeedsUpdate()` method to use `referenceTime` vs. using "now" to compare with the time grain duration. Current tests seem fine, with PT5M time grain and collection periods of 300s and 60s. I am also adding some structured logging messages to track registry decisions at the debug log level. Here's how to parse the structured logs to get a nice table view: ```shell $ cat metricbeat.log.json | grep "MetricRegistry" | jq -r '[.key, .needs_update, .reference_time, .now, .time_grain_start_time//"n/a", .last_collection_at//"n/a"] | @TSV' fdd3a07a3cabd90233c083950a4bc30c true 2023-11-26T15:51:30.000Z 2023-11-26T15:51:30.967Z 2023-11-26T15:46:30.000Z 2023-11-26T15:46:30.000Z 6ee8809577a906538473e3e5e98dc893 true 2023-11-26T15:51:30.000Z 2023-11-26T15:51:35.257Z 2023-11-26T15:46:30.000Z 2023-11-26T15:46:30.000Z 6aedb7dffafbfe9ca19e0aa01436d30a false 2023-11-26T15:51:30.000Z 2023-11-26T15:51:35.757Z 2023-11-26T15:46:30.000Z 2023-11-26T15:48:30.000Z ``` --------- Co-authored-by: Richa Talwar <[email protected]>
- Loading branch information
Showing
4 changed files
with
83 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters