Example #1
0
# See the License for the specific language governing permissions and
# limitations under the License.

import os

import flask
from oslo.config import cfg
import six

from dashboard import memory_storage
from spectrometer.openstack.common import log as logging
from spectrometer.processor import runtime_storage
from spectrometer.processor import utils


LOG = logging.getLogger(__name__)


RECORD_FIELDS_FOR_AGGREGATE = ['record_id', 'primary_key', 'record_type',
                               'company_name', 'module', 'user_id', 'release',
                               'date', 'week', 'author_name', 'loc', 'type',
                               'disagreement', 'value', 'status',
                               'blueprint_id']


def compact_records(records):
    for record in records:
        compact = dict([(k, record[k]) for k in RECORD_FIELDS_FOR_AGGREGATE
                        if k in record])
        yield compact
Example #2
0
import six
from six.moves.urllib import parse
import yaml

from spectrometer.openstack.common import log as logging
from spectrometer.processor import config
from spectrometer.processor import default_data_processor
from spectrometer.processor import mls
from spectrometer.processor import mps
from spectrometer.processor import rcs
from spectrometer.processor import record_processor
from spectrometer.processor import runtime_storage
from spectrometer.processor import utils
from spectrometer.processor import vcs

LOG = logging.getLogger(__name__)


def get_pids():
    # needs to be compatible with psutil >= 1.1.1 since it's a global req.
    PSUTIL2 = psutil.version_info >= (2, 0)
    result = set([])
    for pid in psutil.get_pid_list():
        try:
            p = psutil.Process(pid)
            name = p.name() if PSUTIL2 else p.name
            if name == 'uwsgi':
                LOG.debug('Found uwsgi process, pid: %s', pid)
                result.add(pid)
        except Exception as e:
            LOG.debug('Exception while iterating process list: %s', e)