Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. def record_metering_data(self, data):
  2. """Write the data to the backend storage system.
  3. :param data: a dictionary such as returned by
  4. ceilometer.meter.meter_message_from_counter
  5. """
  6. engine = self._engine_facade.get_engine()
  7. with engine.begin() as conn:
  8. # Record the raw data for the sample.
  9. m_id = self._create_meter(conn,
  10. data['counter_name'],
  11. data['counter_type'],
  12. data['counter_unit'])
  13. res_id = self._create_resource(conn,
  14. data['resource_id'],
  15. data['user_id'],
  16. data['project_id'],
  17. data['source'],
  18. data['resource_metadata'])
  19. sample = models.Sample.__table__
  20. conn.execute(sample.insert(), meter_id=m_id,
  21. resource_id=None,
  22. timestamp=data['timestamp'],
  23. volume=data['counter_volume'],
  24. message_signature=data['message_signature'],
  25. message_id=data['message_id'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement