-
Notifications
You must be signed in to change notification settings - Fork 963
Open
Labels
MgmtThis issue is related to a management-plane library.This issue is related to a management-plane library.MonitorMonitor, Monitor Ingestion, Monitor QueryMonitor, Monitor Ingestion, Monitor QueryService AttentionWorkflow: This issue is responsible by Azure service team.Workflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Description
Bug Report
-
import path of package in question, e.g.
"github.com/Azure/azure-sdk-for-go/sdk/monitor/query/azmetrics"
v1.3.0 -
What happened?
-
I'm able to get disk metrics via Microsoft Azure UI, but your SDK retrieves average, minimum and maximum of 0 for all read/write IO/Bandwith metrics. None of them are filled.
-
What did you expect or want to happen?
I would expect metrics to flow and be consistent with your UI.
Screenshot of the UI below.
Recurring results running the code, values of 0 for all metrics, screenshot:
The times of the screenshots might not be the same, but I assure the results retrieved have been always zero since I've been testing this, making sure there was enough load on the volume during all tests.
- How can we reproduce it?
// Azure metric names for disk performance
const (
azReadOps = "Composite Disk Read Operations/sec"
azWriteOps = "Composite Disk Write Operations/sec"
azReadBandwidth = "Composite Disk Read Bytes/sec"
azWriteBandwidth = "Composite Disk Write Bytes/sec"
)
func (a *AzureClient) queryMetrics(ctx context.Context, start, end time.Time, volumes []persistentVolume) (azmetrics.QueryResourcesResponse, error) {
const azTimeFormat = "2006-01-02T15:04:05.000Z"
metricNames := []string{azReadOps, azWriteOps, azReadBandwidth, azWriteBandwidth}
metricsNamespace := "Microsoft.Compute/disks"
opts := &azmetrics.QueryResourcesOptions{
Aggregation: lo.ToPtr("Average, Minimum, Maximum, Total"),
EndTime: lo.ToPtr(end.Format(azTimeFormat)),
Interval: lo.ToPtr("PT1M"),
StartTime: lo.ToPtr(start.Format(azTimeFormat)),
Top: lo.ToPtr(int32(a.maxBatchSize)),
}
resourceIDs := make([]string, 0, len(volumes))
for _, v := range volumes {
resourceIDs = append(resourceIDs, fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/disks/%s", a.azureSubscriptionID, a.azureResourceGroup, v.VolumeID))
}
resourcesList := azmetrics.ResourceIDList{ResourceIDs: resourceIDs}
resources, err := a.azClient.QueryResources(
ctx,
a.azureSubscriptionID,
metricsNamespace,
metricNames,
resourcesList,
opts,
)
if err != nil {
a.logger.Warn("failed to query azure volume metrics", zap.Error(err))
return azmetrics.QueryResourcesResponse{}, err
}
a.logger.Debug("azure volume metrics", zap.Any("resources", resources))
return resources, nil
}- Anything we should know about your environment.
- Nothing special.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
MgmtThis issue is related to a management-plane library.This issue is related to a management-plane library.MonitorMonitor, Monitor Ingestion, Monitor QueryMonitor, Monitor Ingestion, Monitor QueryService AttentionWorkflow: This issue is responsible by Azure service team.Workflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that