ignore compute.instance.create.start for metrics

do not build metrics off compute.instance.create.start as it
doesn't have enough information in it to push to Gnocchi. there is
an .end event that happens seconds later so .start event has little
value outside context of event.

we change fnmatch to regex for more useful regex comparison and it's
faster

not a complete fix as compute.instance.update also is missing host
value occasionally

Partial-Bug: #1718290
Change-Id: I2aa7045873fd740255a3be5f64b9e9f5fd94e2d4
This commit is contained in:
gord chung 2018-01-12 14:15:24 +00:00
parent f35049d862
commit 3a5fd619fa
2 changed files with 7 additions and 6 deletions

View File

@ -101,7 +101,7 @@ metric:
lookup: ['name', 'unit', 'volume']
- name: 'memory'
event_type: 'compute.instance.*'
event_type: &instance_events compute.instance.(?!create.start).*
type: 'gauge'
unit: 'MB'
volume: $.payload.memory_mb
@ -118,7 +118,7 @@ metric:
image_ref: $.payload.image_meta.base_image_ref
- name: 'vcpus'
event_type: 'compute.instance.*'
event_type: *instance_events
type: 'gauge'
unit: 'vcpu'
volume: $.payload.vcpus
@ -143,7 +143,7 @@ metric:
<<: *instance_meta
- name: 'disk.root.size'
event_type: 'compute.instance.*'
event_type: *instance_events
type: 'gauge'
unit: 'GB'
volume: $.payload.root_gb
@ -155,7 +155,7 @@ metric:
<<: *instance_meta
- name: 'disk.ephemeral.size'
event_type: 'compute.instance.*'
event_type: *instance_events
type: 'gauge'
unit: 'GB'
volume: $.payload.ephemeral_gb

View File

@ -13,13 +13,13 @@
import glob
import itertools
import os
import re
import pkg_resources
import six
from oslo_config import cfg
from oslo_log import log
from oslo_utils import fnmatch
from stevedore import extension
from ceilometer import declarative
@ -72,6 +72,7 @@ class MeterDefinition(object):
self._event_type = self.cfg.get('event_type')
if isinstance(self._event_type, six.string_types):
self._event_type = [self._event_type]
self._event_type = [re.compile(etype) for etype in self._event_type]
if ('type' not in self.cfg.get('lookup', []) and
self.cfg['type'] not in sample_util.TYPES):
@ -107,7 +108,7 @@ class MeterDefinition(object):
def match_type(self, meter_name):
for t in self._event_type:
if fnmatch.fnmatch(meter_name, t):
if t.match(meter_name):
return True
def to_samples(self, message, all_values=False):