Skip to content

[azuremonitor receiver] Don't scrape metrics namespace when not equal to a resource type #37220

Open
@celian-garcia

Description

@celian-garcia

Component(s)

receiver/azuremonitor

What happened?

Description

The azuremonitor receiver is not able to retrieve metrics with a namespace being different from resource type. Typically like {resource type}/something e.g Microsoft.Storage/storageAccounts/blobServices.

Technically, what it does is that for each resource type, and for each resource, it get metrics definition using this Azure Metric Definitions - List API. Which means that it takes a storage account resource and get the shape of the metrics (metric names, dimensions, etc..) from it. By default it seems to get only the metric namespace that is equal to the name of the resource type "Microsoft.Storage/storageAccounts" and not all the rest "Microsoft.Storage/storageAccounts/*"

So to make it simple it does

  • GET resources of type "Microsoft.Storage/storageAccounts" -> find X resources
  • for each resource, GET metrics definition of that resource, and only namespace "Microsoft.Storage/storageAccounts"
  • GET resources of type "Microsoft.Storage/storageAccounts/blobServices" -> find nothing
  • terminate
    => No metrics collecte for blob services namespace

There is a confusion between Resource type and Metric namespace in Azure that partially overlaps.
For this reason, we basically have no metrics for the "sub resource types namespaces" of this kind

Steps to Reproduce

Start an otel collector with an azure receiver and give a for example Microsoft.Storage/storageAccounts/blobServices

  azuremonitor/storageaccount-blob-tst:
    cache_resources: 3600
    client_id: <redacted>
    client_secret: <redacted>
    cloud: AzureCloud
    collection_interval: 60s
    initial_delay: 1s
    tenant_id: <redacted>
    services: [ "Microsoft.Storage/storageAccounts/blobServices" ]
    subscription_id: <redacted>

Expected Result

We should have the metrics from the blob services namesapce

Actual Result

No resources found, so no metrics

Collector version

v0.117.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

Log output

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is needednever staleIssues marked with this label will be never staled and automatically removedreceiver/azuremonitor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions