示例#1
0
# Global metric. Metric fields:
# - project_id: e.g. 'chromium'
# - subproject_id: e.g. 'blink'. Set to empty string if not used.
# - pool: e.g. 'Chrome'
# - spec_name: name of a job specification, e.g. '<master>:<builder>'
#     for buildbot jobs.
# Override target field:
# - hostname: 'autogen:<executor_id>': name of the bot that executed a job,
#     or an empty string. e.g. 'autogen:swarm42-m4'.
# Value should be 'pending' or 'running'. Completed / canceled jobs should not
# send this metric.
_jobs_running = gae_ts_mon.BooleanMetric(
    'jobs/running',
    'Presence metric for a running job.', [
        gae_ts_mon.StringField('spec_name'),
        gae_ts_mon.StringField('project_id'),
        gae_ts_mon.StringField('subproject_id'),
        gae_ts_mon.StringField('pool'),
    ])

# Global metric. Metric fields:
# - project_id: e.g. 'chromium'
# - subproject_id: e.g. 'blink'. Set to empty string if not used.
# - pool: e.g. 'Chrome'
# - spec_name: name of a job specification, e.g. '<master>:<builder>'
#     for buildbot jobs.
# - status: 'pending' or 'running'.
_jobs_active = gae_ts_mon.GaugeMetric(
    'jobs/active',
    'Number of running, pending or otherwise active jobs.', [
        gae_ts_mon.StringField('spec_name'),
示例#2
0
tasks_expired = gae_ts_mon.CounterMetric(
    'swarming/tasks/expired',
    description='Number of expired tasks')

# Global metric. Metric fields:
# - project_id: e.g. 'chromium'
# - subproject_id: e.g. 'blink'. Set to empty string if not used.
# - spec_name: name of a job specification, e.g. '<master>:<builder>:<test>'
#     for buildbot jobs.
# Override target field:
# - hostname: 'autogen:<executor_id>': name of the bot that executed a job,
#     or an empty string. e.g. 'autogen:swarm42-m4'.
# Value should be 'pending' or 'running'. Completed / canceled jobs should not
# send this metric.
jobs_running = gae_ts_mon.BooleanMetric(
    'jobs/running',
    description='Presence metric for a running job.')

# Global metric. Metric fields:
# - project_id: e.g. 'chromium'
# - subproject_id: e.g. 'blink'. Set to empty string if not used.
# - spec_name: name of a job specification, e.g. '<master>:<builder>:<test>'
#     for buildbot jobs.
# - status: 'pending' or 'running'.
jobs_active = gae_ts_mon.GaugeMetric(
    'jobs/active',
    description='Number of running, pending or otherwise active jobs.')


# Global metric. Target field: hostname = 'autogen:<executor_id>' (bot id).
executors_pool = gae_ts_mon.StringMetric(
示例#3
0
        'Maximum number of instances currently configured.',
        [gae_ts_mon.StringField('instance_template')]),
    'config_min_instances':
    gae_ts_mon.GaugeMetric(
        'machine_provider/gce_backend/config/instances/min',
        'Minimum number of instances currently configured.',
        [gae_ts_mon.StringField('instance_template')]),
    'instances':
    gae_ts_mon.GaugeMetric('machine_provider/gce_backend/instances',
                           'Current count of the number of instances.',
                           [gae_ts_mon.StringField('instance_template')]),
}

config_valid = gae_ts_mon.BooleanMetric(
    'machine_provider/gce_backend/config/valid',
    'Whether or not the current config is valid.',
    [gae_ts_mon.StringField('config')],
)

instance_deletion_time = gae_ts_mon.CumulativeDistributionMetric(
    'machine_provider/gce_backend/instances/deletions/time',
    'Seconds between initiating deletion RPC and learning its result.',
    [gae_ts_mon.StringField('zone')],
    #    units=ts_mon.MetricsDataUnits.SECONDS,
)


def compute_global_metrics():  # pragma: no cover
    for name, counts in config.count_instances().iteritems():
        logging.info('%s min: %s', name, counts[0])
        GLOBAL_METRICS['config_min_instances'].set(
示例#4
0
  'hostname': '',
  # ID of the instance reporting the metric.
  'task_num': 0,
}


GLOBAL_METRICS = {
    'instances': gae_ts_mon.GaugeMetric(
        'machine_provider/gce_backend/instances',
        description='Current count of the number of instances.',
    ),
}


config_valid = gae_ts_mon.BooleanMetric(
    'machine_provider/gce_backend/config/valid',
    description='Whether or not the current config is valid.',
)


def compute_global_metrics():
  orphaned, total = instances.count_instances()
  GLOBAL_METRICS['instances'].set(
      orphaned,
      fields={
          'orphaned': True,
      },
      target_fields=GLOBAL_TARGET_FIELDS,
  )
  GLOBAL_METRICS['instances'].set(
      total - orphaned,
      fields={