-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[receiver/azuremonitorreceiver] parallelize calls by subscriptions in Batch API mode #43047
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
Merged
atoulme
merged 4 commits into
open-telemetry:main
from
celian-garcia:azuremonitorreceiver/fix-39417
Oct 10, 2025
Merged
[receiver/azuremonitorreceiver] parallelize calls by subscriptions in Batch API mode #43047
atoulme
merged 4 commits into
open-telemetry:main
from
celian-garcia:azuremonitorreceiver/fix-39417
Oct 10, 2025
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
db21fd1 to
f3d47c2
Compare
|
|
43a2807 to
e4c4c7e
Compare
|
Please address the conflict. |
e4c4c7e to
ab513fa
Compare
… Batch API mode Signed-off-by: Célian Garcia <celian.garcia@amadeus.com> Signed-off-by: Celian GARCIA <celian.garcia@amadeus.com>
ab513fa to
480dd4a
Compare
|
@atoulme, conflicts resolved 🙂 |
mowies
reviewed
Oct 9, 2025
Co-authored-by: Moritz Wiesinger <moritz.wiesinger@dynatrace.com>
paulojmdias
approved these changes
Oct 9, 2025
atoulme
approved these changes
Oct 10, 2025
ChrsMark
pushed a commit
to ChrsMark/opentelemetry-collector-contrib
that referenced
this pull request
Oct 20, 2025
… Batch API mode (open-telemetry#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 open-telemetry#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. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#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 <celian.garcia@amadeus.com> Signed-off-by: Celian GARCIA <celian.garcia@amadeus.com> Co-authored-by: Moritz Wiesinger <moritz.wiesinger@dynatrace.com>
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
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 writeReference: 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.
Link to tracking issue
Fixes #39417
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:
To prevent this, our implementation explicitly sets the Cloud option in all cases, ensuring deterministic behavior and avoiding the race.
Documentation
A new markdown file (concurrency_bench_report.md) has been added to document: