RobustPerception / azure_metrics_exporter

Azure metrics exporter for Prometheus
Apache License 2.0
133 stars 69 forks source link

Allow to specify custom time range for metrics query #99

Open ludydoo opened 3 years ago

ludydoo commented 3 years ago

Stumbled on a problem trying to get a storageaccount UsedCapacity. Seems like Azure doesn't allow to query this metric using the default range (1minute), but needs a bigger range (>1h) This pull request adds the range_seconds and offset_seconds, which are used to get the start/end time for the metrics query.

resource_tags:
  - resource_tag_name: "monitoring"
    resource_tag_value: "prometheus"
    resource_types:
      - "Microsoft.Storage/storageAccounts"
    metric_namespace: "microsoft.storage/storageaccounts"
    metrics:
      - name: "UsedCapacity"
    range_seconds: 21600
    offset_seconds: 180
    aggregations:
      - "Average"
techcubs commented 3 years ago

Hi, when can we expect this to be implemented please? Regards,

SlevinBE commented 2 years ago

I tested this PR in my setup and it does indeed solve the issue. Thanks! 👍 Probably a good idea to add some instructions on how to use these two new options to the readme.