示例#1
0
 def _document_to_metric(self, document):
     metadata = bg_metric.MetricMetadata.from_string_dict(document.config.to_dict())
     # TODO: Have a look at dsl doc to avoid parsing strings to dates
     # https://github.com/elastic/elasticsearch-dsl-py/blob/master/docs/persistence.rst
     return bg_metric.make_metric(
         document.name,
         metadata,
         created_on=ttls.str_to_datetime(document.created_on),
         updated_on=ttls.str_to_datetime(document.updated_on),
         read_on=ttls.str_to_datetime(document.read_on),
     )
示例#2
0
 def _document_to_metric(self, document):
     metadata = bg_metric.MetricMetadata.from_string_dict(
         document.config.to_dict())
     # TODO: Have a look at dsl doc to avoid parsing strings to dates
     # https://github.com/elastic/elasticsearch-dsl-py/blob/master/docs/persistence.rst
     return bg_metric.make_metric(
         document.name,
         metadata,
         created_on=ttls.str_to_datetime(document.created_on),
         updated_on=ttls.str_to_datetime(document.updated_on),
         read_on=ttls.str_to_datetime(document.read_on),
     )