コード例 #1
0
def DistributionMetric(name, reset_after=False, description=None,
                       bucketer=None, field_spec=_MISSING):
  """Returns a metric handle for a distribution named |name|."""
  return ts_mon.NonCumulativeDistributionMetric(
      name, description=description, bucketer=bucketer, field_spec=field_spec)
コード例 #2
0
ファイル: servlet.py プロジェクト: xinghun61/infra
from framework import urls
from framework import xsrf
from proto import project_pb2
from search import query2ast
from services import secrets_svc
from tracker import tracker_views

from infra_libs import ts_mon

NONCE_LENGTH = 32

if not settings.unit_test_mode:
    import MySQLdb

GC_COUNT = ts_mon.NonCumulativeDistributionMetric(
    'monorail/servlet/gc_count',
    'Count of objects in each generation tracked by the GC',
    [ts_mon.IntegerField('generation')])

GC_EVENT_REQUEST = ts_mon.CounterMetric(
    'monorail/servlet/gc_event_request',
    'Counts of requests that triggered at least one GC event', [])

# TODO(seanmccullough): Move this to services? Or context?
trace_service = None
if app_identity.get_application_id() != 'testing-app':
    logging.warning('app id: %s', app_identity.get_application_id())
    try:
        credentials = GoogleCredentials.get_application_default()
        trace_service = discovery.build('cloudtrace',
                                        'v1',
                                        credentials=credentials)