Problem
The exporter cannot fetch metrics for Microsoft.Storage/storageAccounts/objectReplicationPolicies because insights.go hardcodes /default as the sub-resource name for all storage account metric namespaces.
When metric_namespace starts with microsoft.storage/storageaccounts/, the exporter appends /<subResourceType>/default to the resource URI:
https://github.com/webdevops/azure-metrics-exporter/blob/8701afc2b013/metrics/insights.go#L74-L79
if strings.HasPrefix(strings.ToLower(p.settings.MetricNamespace), "microsoft.storage/storageaccounts/") {
splitNamespace := strings.Split(p.settings.MetricNamespace, "/")
// Storage accounts have an extra requirement that their ResourceURI include <type>/default
storageAccountType := splitNamespace[len(splitNamespace)-1]
resourceURI = resourceURI + fmt.Sprintf("/%s/default", storageAccountType)
}
This works for singleton sub-resources like blobServices/default, queueServices/default, tableServices/default, and fileServices/default, but objectReplicationPolicies sub-resources are identified by a specific
policy ID (e.g., objectReplicationPolicies/a1b2c3d4-...), not default.
The exporter ends up calling:
GET .../storageAccounts/<name>/objectReplicationPolicies/default/providers/Microsoft.Insights/metrics
When the correct URI would be:
GET .../storageAccounts/<name>/objectReplicationPolicies/<policyId>/providers/Microsoft.Insights/metrics
Azure Monitor returns an empty response with no error, so this fails silently.
Steps to Reproduce
Configure the exporter with:
resourceType: "Microsoft.Storage/storageAccounts"
metricNamespace: "Microsoft.Storage/storageAccounts/objectReplicationPolicies"
metric:
- PendingBytesForReplication
- PendingOperationsForReplication
aggregation:
- average
The exporter produces zero azure_microsoft_storage_* metrics even when the storage accounts in the subscription have active object replication policies.
Expected Behavior
The exporter should be able to discover and query metrics for objectReplicationPolicies sub-resources that are not named default.
Problem
The exporter cannot fetch metrics for
Microsoft.Storage/storageAccounts/objectReplicationPoliciesbecauseinsights.gohardcodes/defaultas the sub-resource name for all storage account metric namespaces.When
metric_namespacestarts withmicrosoft.storage/storageaccounts/, the exporter appends/<subResourceType>/defaultto the resource URI:https://github.com/webdevops/azure-metrics-exporter/blob/8701afc2b013/metrics/insights.go#L74-L79
This works for singleton sub-resources like
blobServices/default,queueServices/default,tableServices/default, andfileServices/default, but objectReplicationPolicies sub-resources are identified by a specificpolicy ID (e.g., objectReplicationPolicies/a1b2c3d4-...), not default.
The exporter ends up calling:
GET .../storageAccounts/<name>/objectReplicationPolicies/default/providers/Microsoft.Insights/metricsWhen the correct URI would be:
GET .../storageAccounts/<name>/objectReplicationPolicies/<policyId>/providers/Microsoft.Insights/metricsAzure Monitor returns an empty response with no error, so this fails silently.
Steps to Reproduce
Configure the exporter with:
The exporter produces zero azure_microsoft_storage_* metrics even when the storage accounts in the subscription have active object replication policies.
Expected Behavior
The exporter should be able to discover and query metrics for objectReplicationPolicies sub-resources that are not named default.