Skip to content

[8.18](backport #41790) Concurrent fetch of azure metricdefinitions and batchApi usage#44242

Merged
zmoog merged 6 commits into8.18from
mergify/bp/8.18/pr-41790
May 19, 2025
Merged

[8.18](backport #41790) Concurrent fetch of azure metricdefinitions and batchApi usage#44242
zmoog merged 6 commits into8.18from
mergify/bp/8.18/pr-41790

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented May 7, 2025

The changes affect azure monitor and relevant metricsets. The list of metricsets affected are:

  • monitor
  • container_registry
  • container_instance
  • container_service
  • compute_vm
  • compute_vm_scaleset
  • database_account
  • storage_account

A new configuration parameter is introduced enable_batch_api of type boolean.
If set to false(default) nothing changes in the way the metrics are collected for these metricsets.

If set to true:

  • The metric definitions of resources are collected asynchronously and write the results in a channel.
  • The channel is read and when the number of definitions collected reach 50 (batch API limit)
  • The metrics definitions are grouped based on criteria(1) and the azure BatchAPI is used to retrieve
    metrics of multiple resources with one api call.
  1. Grouping criteria are
  • Namespace
  • SubscriptionID
  • Location
  • Names
  • TimeGrain
  • Dimensions

Proposed commit message

  • WHAT: Introduce enable_batch_api parameter for concurrent fetching of azure metric definitions and metric values collection using Batch Api
  • WHY: Helps mitigating scalability problems

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Disruptive User Impact

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs


This is an automatic backport of pull request #41790 done by [Mergify](https://mergify.com).
@mergify mergify bot requested a review from a team as a code owner May 7, 2025 10:47
@mergify mergify bot added the backport label May 7, 2025
@mergify mergify bot requested a review from a team as a code owner May 7, 2025 10:47
@mergify mergify bot added conflicts There is a conflict in the backported pull request backport labels May 7, 2025
@mergify
Copy link
Contributor Author

mergify bot commented May 7, 2025

Cherry-pick of 13f8fde has failed:

On branch mergify/bp/8.18/pr-41790
Your branch is up to date with 'origin/8.18'.

You are currently cherry-picking commit 13f8fde9a.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   CHANGELOG.next.asciidoc
	modified:   NOTICE.txt
	new file:   x-pack/metricbeat/module/azure/README.md
	modified:   x-pack/metricbeat/module/azure/_meta/docs.asciidoc
	modified:   x-pack/metricbeat/module/azure/azure.go
	modified:   x-pack/metricbeat/module/azure/client.go
	new file:   x-pack/metricbeat/module/azure/client_batch.go
	new file:   x-pack/metricbeat/module/azure/client_batch_test.go
	modified:   x-pack/metricbeat/module/azure/client_utils.go
	modified:   x-pack/metricbeat/module/azure/config.go
	modified:   x-pack/metricbeat/module/azure/data.go
	modified:   x-pack/metricbeat/module/azure/mock_service.go
	new file:   x-pack/metricbeat/module/azure/monitor/client_helper_concurrent.go
	new file:   x-pack/metricbeat/module/azure/monitor/client_helper_concurrent_test.go
	modified:   x-pack/metricbeat/module/azure/monitor/monitor.go
	modified:   x-pack/metricbeat/module/azure/monitor_service.go
	modified:   x-pack/metricbeat/module/azure/resources.go
	modified:   x-pack/metricbeat/module/azure/service_interface.go
	new file:   x-pack/metricbeat/module/azure/storage/client_helper_concurrent.go
	new file:   x-pack/metricbeat/module/azure/storage/client_helper_concurrent_test.go
	modified:   x-pack/metricbeat/module/azure/storage/storage.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   go.mod
	both modified:   go.sum
	both added:      metricbeat/docs/modules/azure.asciidoc

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify bot added the conflicts There is a conflict in the backported pull request label May 7, 2025
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label May 7, 2025
@github-actions github-actions bot added the Team:obs-ds-hosted-services Label for the Observability Hosted Services team label May 7, 2025
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label May 7, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ds-hosted-services (Team:obs-ds-hosted-services)

@mergify
Copy link
Contributor Author

mergify bot commented May 12, 2025

This pull request has not been merged yet. Could you please review and merge it @MichaelKatsoulis? 🙏

@zmoog zmoog self-assigned this May 15, 2025
@mergify
Copy link
Contributor Author

mergify bot commented May 19, 2025

This pull request has not been merged yet. Could you please review and merge it @zmoog, @MichaelKatsoulis? 🙏

@mergify
Copy link
Contributor Author

mergify bot commented May 19, 2025

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b mergify/bp/8.18/pr-41790 upstream/mergify/bp/8.18/pr-41790
git merge upstream/8.18
git push upstream mergify/bp/8.18/pr-41790
MichaelKatsoulis and others added 3 commits May 19, 2025 17:18
* Use concurrency in metricsdefinition collection

* Change ResourceConfigurations.Metrics to a map

* Use batch API

* New queryResourceClient per location

* Wait for 50 reource ids before fetching the metrics

* Set timegrain if is equal to ''"

* Use batch API as feature

* Use baseclient to tackle code duplication

* Add unit tests for concurrent fetching of metric definitions

* Add batch client unit tests

* Add support of batch API for storage accounts

* Update docs and add unit tests form storage client

* Split metric names by 20

(cherry picked from commit 13f8fde)

# Conflicts:
#	go.mod
#	go.sum
#	metricbeat/docs/modules/azure.asciidoc
@zmoog zmoog force-pushed the mergify/bp/8.18/pr-41790 branch from 8d7173d to 2ec5f06 Compare May 19, 2025 15:22
@zmoog zmoog requested a review from a team as a code owner May 19, 2025 15:53
@mergify
Copy link
Contributor Author

mergify bot commented May 19, 2025

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b mergify/bp/8.18/pr-41790 upstream/mergify/bp/8.18/pr-41790
git merge upstream/8.18
git push upstream mergify/bp/8.18/pr-41790
@zmoog zmoog merged commit 4dbdfb2 into 8.18 May 19, 2025
170 checks passed
@zmoog zmoog deleted the mergify/bp/8.18/pr-41790 branch May 19, 2025 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport conflicts There is a conflict in the backported pull request input:azure-monitor Team:obs-ds-hosted-services Label for the Observability Hosted Services team

3 participants