lib/azure/armrest/insights/metrics_service.rb
# Returns a list metrics for +resource_id+, which can be either a
# resource object or a plain resource string. You may also provide
# hash of filtering +options+ to limit the results. The possible
# options are:
#
#   * :timespan        => The timespan of the query in "start/end" format.
#   * :interval        => The interval (timegrain) of the query.
#   * :metricnames     => A comma separated list of metrics to retrieve.
#   * :aggregation     => A comma separated list of aggregration types to retrieve.
#   * :segment         => The name of the dimension to segment the metric values by.
#   * :top             => The maximum number of records to retrieve. Defaults to 10.
#   * :orderby         => The aggregation to use for sorting.
#   * :filter          => An expression used to filter the results.
#   * :resultType      => Reduces the set of data collected. Syntax is dependent on operation.
#   * :metricnamespace => Metric namespace to query metric definitions for.
#
# If no filter expression is defined, the first metric defined
# for that resource will be returned using the primary aggregation
# type in the metric defintion over a time period of the last hour.
#
#   vms = Azure::Armrest::VirtualMachineService.new(conf)
#   mts = Azure::Armrest::Insights::MetricService.new(conf)
#
#   vm = vms.get('your_vm', 'your_resource_group')
#
#   options = {
#     :metricnames => "'Percentage CPU'"
#     :timespan    => "2020-02-13T02:20:00Z/2020-02-14T04:20:00Z"
#     :aggregation => "Average",
#     :interval    => "PT1M"
#   }
#
#   definitions = mts.list_metrics(vm.id, options)
#
Returns a list metrics for +resource_id+, which can be either a
resource object or a plain resource string. You may also provide
hash of filtering +options+ to limit the results. The possible
options are.

:timespan        => The timespan of the query in "start/end" format.
:interval        => The interval (timegrain) of the query.
:metricnames     => A comma separated list of metrics to retrieve.
:aggregation     => A comma separated list of aggregration types to retrieve.
:segment         => The name of the dimension to segment the metric values by.
:top             => The maximum number of records to retrieve. Defaults to 10.
:orderby         => The aggregation to use for sorting.
:filter          => An expression used to filter the results.
:resultType      => Reduces the set of data collected. Syntax is dependent on operation.
:metricnamespace => Metric namespace to query metric definitions for.

If no filter expression is defined, the first metric defined
for that resource will be returned using the primary aggregation
type in the metric defintion over a time period of the last hour.








Returns a list metrics for + resource_id + which can be either a resource object or a plain resource string . You may also provide hash of filtering + options + to limit the results . The possible options are . : timespan = > The timespan of the query in " start / end " format . : interval = > The interval ( timegrain ) of the query . : metricnames = > A comma separated list of metrics to retrieve . : aggregation = > A comma separated list of aggregration types to retrieve . : segment = > The name of the dimension to segment the metric values by . : top = > The maximum number of records to retrieve . Defaults to 10 . : orderby = > The aggregation to use for sorting . : filter = > An expression used to filter the results . : resultType = > Reduces the set of data collected . Syntax is dependent on operation . : metricnamespace = > Metric namespace to query metric definitions for . If no filter expression is defined the first metric defined for that resource will be returned using the primary aggregation type in the metric defintion over a time period of the last hour .
def list_metrics(resource, options = {})
          resource_id = resource.respond_to?(:id) ? resource.id : resource
          options[:filter] = options if options.is_a?(String) 
          url = File.join(
            configuration.environment.resource_url,
            resource_id,
            'providers/microsoft.insights/metrics'
          )
          url << "?api-version=#{api_version}"
          options.each do |key, value|
            key.to_s == 'filter' ? url << "&$" : url << "&"
            url << "#{key}=#{value}"
          end
          response = rest_get(url)
          Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::Insights::Metric)
        end
def list_metrics ( resource , options = { } ) resource_id = resource . respond_to? ( :id ) ? resource . id : resource options [ :filter ] = options if options . is_a? ( String ) url = File . join ( configuration . environment . resource_url , resource_id , 'providers/microsoft.insights/metrics' ) url << "?api-version=#{api_version}" options . each do | key , value | key . to_s == 'filter' ? url << "&$" : url << "&" url << "#{key}=#{value}" end response = rest_get ( url ) Azure :: Armrest :: ArmrestCollection . create_from_response ( response , Azure :: Armrest :: Insights :: Metric ) end
Returns a list metrics for +resource_id+, which can be either a
resource object or a plain resource string.
Returns a list metrics for + resource_id + which can be either a resource object or a plain resource string .
# For backwards compatibility # The :filter option requires a leading '$'
resource
<not_specific>
options
<not_specific>