Skip to content
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

[BUG] Azure Monitor Query client: resourceId is missing in response #43841

Open
3 tasks done
alex-semenk opened this issue Jan 20, 2025 · 2 comments
Open
3 tasks done
Assignees
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor Monitor, Monitor Ingestion, Monitor Query question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@alex-semenk
Copy link

alex-semenk commented Jan 20, 2025

Describe the bug
resourceId field is missing in MetricsQueryResult object when calling method MetricsAsyncClient.queryResourcesWithResponse.
Since API allows to send request for server resource ids, it's required to have resourceIds back in response to be able to map metrics back to requested resources.

Exception or Stack Trace
Issue doesn't cause any exception in the SDK.

To Reproduce
Steps to reproduce the behavior:
Given the MetricsAsyncClient make a call to the API

var response = metricDataClient.queryResourcesWithResponse(resourceIds, metricsNames, metricsNamespace, options)

In the response you get MetricsQueryResourcesResult object which contains List<MetricsQueryResult>. Each MetricsQueryResult in response is missing resourceId field.

Code Snippet

var credentials = new DefaultAzureCredentialBuilder().build();
var endpoint = "https://eastus.metrics.monitor.azure.com";
var metricDataClient = MetricsClientBuilder().credential(credentials).endpoint(endpoint).buildAsyncClient();
var response = metricDataClient.queryResourcesWithResponse(
                List.of("yourResourceId"),
                List.of("Http2xx"),
                "microsoft.web/sites",
                new MetricsQueryResourcesOptions()
        ).block();

Expected behavior
response contains list of MetricsQueryResult objects, each of them has resourceId (the same as specified in the original request).

Screenshots
Image
As you can see on the screenshot (from the debug window) resourceId field is missing in the response.

Setup (please complete the following information):

  • OS: MacOS 15.2
  • IDE: IntelliJ IDEA
  • Library/Libraries: com.azure:azure-monitor-query:1.5.4
  • Java version: 21
  • App Server/Environment: Embedded Tomcat
  • Frameworks: Spring Boot

Additional context
After issue troubleshooting I found, that the issue is related to MetricsQueryResult class constructor which is missing resourceId field. Because of this, field is missing when object MetricsQueryResult is created in MetricsHelper.mapToMetricsQueryResult method.

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added
@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jan 20, 2025
@joshfree joshfree added the Monitor Monitor, Monitor Ingestion, Monitor Query label Jan 27, 2025
@joshfree
Copy link
Member

@jairmyree could you follow up with @alex-semenk

@github-actions github-actions bot removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jan 27, 2025
@jairmyree
Copy link
Member

@alex-semenk Thank you for reaching out. I'll be looking into this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Monitor Monitor, Monitor Ingestion, Monitor Query question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

3 participants