-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[receiver/azuremonitorreceiver] parallelize calls by subscriptions in Batch API mode #40344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
celian-garcia
wants to merge
2
commits into
open-telemetry:main
from
celian-garcia:celian-garcia/39417
Closed
[receiver/azuremonitorreceiver] parallelize calls by subscriptions in Batch API mode #40344
celian-garcia
wants to merge
2
commits into
open-telemetry:main
from
celian-garcia:celian-garcia/39417
Conversation
This file contains hidden or 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
… Batch API mode Signed-off-by: Célian Garcia <[email protected]>
Converting it to draft since it produces some crashes. I have a bunch of never ending strange logs to analyze, example:
|
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
atoulme
pushed a commit
that referenced
this pull request
Oct 10, 2025
… Batch API mode (#43047) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description This PR revives the previously non-functional #40344, aiming to enhance performance by running metrics collection across Azure subscriptions in parallel. This significantly reduces latency when dealing with multiple subscriptions. Compared to the original PR, this version addresses a critical concurrency issue: ```fatal error: concurrent map read and map write``` Reference: https://victoriametrics.com/blog/go-sync-map/ To resolve this, I evaluated multiple approaches and found that using the concurrent-map library yielded the best results. Details of the evaluation and benchmarks are documented in concurrency_bench_report.md. <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes #39417 <!--Describe what testing was performed and which tests were added.--> #### Testing During testing, a race condition was discovered in the Azure SDK related to the fallback behavior of the Cloud option in the NewClient function: ```go // NewClient creates a client that accesses Azure Monitor metrics data. // Client should be used for performing metrics queries on multiple monitored resources in the same region. // A credential with authorization at the subscription level is required when using this client. // // endpoint - The regional endpoint to use, for example https://eastus.metrics.monitor.azure.com. // The region should match the region of the requested resources. For global resources, the region should be 'global'. func NewClient(endpoint string, credential azcore.TokenCredential, options *ClientOptions) (*Client, error) { if options == nil { options = &ClientOptions{} } if reflect.ValueOf(options.Cloud).IsZero() { options.Cloud = cloud.AzurePublic // <-- HERE } c, ok := options.Cloud.Services[ServiceName] if !ok || c.Audience == "" { return nil, errors.New("provided Cloud field is missing Azure Monitor Metrics configuration") } ``` To prevent this, our implementation explicitly sets the Cloud option in all cases, ensuring deterministic behavior and avoiding the race. <!--Describe the documentation added.--> #### Documentation A new markdown file (concurrency_bench_report.md) has been added to document: - The rationale behind choosing concurrent-map - Benchmark results comparing different implementations - Notes for future contributors who may want to explore alternative concurrency strategies <!--Please delete paragraphs that you did not use before submitting.--> --------- Signed-off-by: Célian Garcia <[email protected]> Signed-off-by: Celian GARCIA <[email protected]> Co-authored-by: Moritz Wiesinger <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The idea is to not wait for all the calls for one Azure subscription to finish before starting to collect data from another Azure subscription.
Parallelizing this helps to make all the processing and queries under 1m.
Link to tracking issue
Fixes #39417
Testing
No regression on the current tests that should cover the case.
Documentation
N/A