Merge "Add volume creation time metric"

This commit is contained in:
Jenkins 2015-03-31 09:07:28 +00:00 committed by Gerrit Code Review
commit 63036390c8
3 changed files with 22 additions and 6 deletions

View File

@ -21,7 +21,17 @@ local msg = {
Severity = 6,
}
local event_type_to_name = {
["compute.instance.create.end"] = "openstack.nova.instance_creation_time",
["volume.create.end"] = "openstack.cinder.volume_creation_time",
}
function process_message ()
local metric_name = event_type_to_name[read_message("Fields[event_type]")]
if not metric_name then
return -1
end
local created_at = read_message("Fields[created_at]") or ''
local launched_at = read_message("Fields[launched_at]") or ''
@ -29,12 +39,12 @@ function process_message ()
launched_at = patt.Timestamp:match(launched_at)
if created_at == nil or launched_at == nil or created_at == 0 or launched_at == 0 or created_at > launched_at then
return -1
end
end
msg.Timestamp = read_message("Timestamp")
msg.Fields = {
source = read_message('Logger'),
name = "openstack.nova.instance_creation_time",
name = metric_name,
-- preserve the original hostname in the Fields attribute because
-- sandboxed filters cannot override the Hostname attribute
hostname = read_message("Fields[hostname]"),

View File

@ -2,11 +2,11 @@ class lma_collector::notifications::metrics {
include lma_collector::params
include lma_collector::service
# Filter to compute the instance creation time metric
heka::filter::sandbox { 'instance_creation_time':
# Filter to compute resource's creation time metric
heka::filter::sandbox { 'resource_creation_time':
config_dir => $lma_collector::params::config_dir,
filename => "${lma_collector::params::plugins_dir}/filters/instance_creation_time.lua",
message_matcher => 'Type == \'notification\' && Fields[event_type] == \'compute.instance.create.end\'',
filename => "${lma_collector::params::plugins_dir}/filters/resource_creation_time.lua",
message_matcher => 'Type == \'notification\' && Fields[event_type] =~ /^(compute.instance|volume).create.end$/',
notify => Class['lma_collector::service'],
}

View File

@ -49,6 +49,12 @@ These metrics are retrieved from the Keystone API.
Volume
^^^^^^
These metrics are emitted per volume node.
* ``openstack.cinder.volume_creation_time``, the time (in seconds) it took to create a new volume.
.. note:: When using Ceph as the backend storage for volumes, the ``hostname`` value is always set to ``rbd``.
These metrics are retrieved from the Cinder API.
* ``openstack.cinder.volumes.<state>``, the number of volumes by state.