当前位置: 首页>>代码示例>>Python>>正文


Python LadDiagnosticUtil.getAggregationPeriodsFromLadCfg方法代码示例

本文整理汇总了Python中Utils.LadDiagnosticUtil.getAggregationPeriodsFromLadCfg方法的典型用法代码示例。如果您正苦于以下问题:Python LadDiagnosticUtil.getAggregationPeriodsFromLadCfg方法的具体用法?Python LadDiagnosticUtil.getAggregationPeriodsFromLadCfg怎么用?Python LadDiagnosticUtil.getAggregationPeriodsFromLadCfg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utils.LadDiagnosticUtil的用法示例。


在下文中一共展示了LadDiagnosticUtil.getAggregationPeriodsFromLadCfg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _update_metric_collection_settings

# 需要导入模块: from Utils import LadDiagnosticUtil [as 别名]
# 或者: from Utils.LadDiagnosticUtil import getAggregationPeriodsFromLadCfg [as 别名]
    def _update_metric_collection_settings(self, ladCfg):
        """
        Update mdsd_config_xml_tree for Azure Portal metric collection. The mdsdCfg performanceCounters element contains
        an array of metric definitions; this method passes each definition to its provider's AddMetric method, which is
        responsible for configuring the provider to deliver the metric to mdsd and for updating the mdsd config as
        required to expect the metric to arrive. This method also builds the necessary aggregation queries (from the
        metrics.metricAggregation array) that grind the ingested data and push it to the WADmetric table.
        :param ladCfg: ladCfg object from extension config
        :return: None
        """
        metrics = LadUtil.getPerformanceCounterCfgFromLadCfg(ladCfg)
        if not metrics:
            return

        counter_to_table = {}
        local_tables = set()

        # Add each metric
        for metric in metrics:
            if metric['type'] == 'builtin':
                local_table_name = BuiltIn.AddMetric(metric)
                if local_table_name:
                    local_tables.add(local_table_name)
                    counter_to_table[metric['counterSpecifier']] = local_table_name

        # Finalize; update the mdsd config to be prepared to receive the metrics
        BuiltIn.UpdateXML(self._mdsd_config_xml_tree)

        # Aggregation is done by <LADQuery> within a <DerivedEvent>. If there are no alternate sinks, the DerivedQuery
        # can send output directly to the WAD metrics table. If there *are* alternate sinks, have the LADQuery send
        # output to a new local table, then arrange for additional derived queries to pull from that.
        intervals = LadUtil.getAggregationPeriodsFromLadCfg(ladCfg)
        sinks = LadUtil.getFeatureWideSinksFromLadCfg(ladCfg, 'performanceCounters')
        for table_name in local_tables:
            for aggregation_interval in intervals:
                if sinks:
                    local_table_name = ProvUtil.MakeUniqueEventName('aggregationLocal')
                    self._add_derived_event(aggregation_interval, table_name,
                                            local_table_name,
                                            'Local', add_lad_query=True)
                    self._handle_alternate_sinks(aggregation_interval, sinks, local_table_name)
                else:
                    self._add_derived_event(aggregation_interval, table_name,
                                            LadConfigAll._wad_table_name(aggregation_interval),
                                            'Central', add_lad_query=True)
开发者ID:SuperScottz,项目名称:azure-linux-extensions,代码行数:47,代码来源:lad_config_all.py

示例2: test_getAggregationPeriodsFromLadCfg

# 需要导入模块: from Utils import LadDiagnosticUtil [as 别名]
# 或者: from Utils.LadDiagnosticUtil import getAggregationPeriodsFromLadCfg [as 别名]
 def test_getAggregationPeriodsFromLadCfg(self):
     periods = LadUtil.getAggregationPeriodsFromLadCfg(self.valid_config)
     self.assertEqual(len(periods), 2)
     self.assertIn('PT5M', periods)
     self.assertIn('PT1H', periods)
开发者ID:Azure,项目名称:azure-linux-extensions,代码行数:7,代码来源:test_LadDiagnosticUtil.py


注:本文中的Utils.LadDiagnosticUtil.getAggregationPeriodsFromLadCfg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。