Example #1
0
def create_application():
    ereporter2.register_formatter()

    # Zap out the ndb in-process cache by default.
    # This cache causes excessive memory usage in in handler where a lot of
    # entities are fetched in one query. When coupled with high concurrency
    # as specified via max_concurrent_requests in app.yaml, this may cause out of
    # memory errors.
    ndb.Context.default_cache_policy = staticmethod(lambda _key: False)
    ndb.Context._cache_policy = staticmethod(lambda _key: False)

    # App that serves HTML pages and old API.
    frontend = handlers_frontend.create_application(False)

    def is_enabled_callback():
        return config.settings().enable_ts_monitoring

    gae_ts_mon.initialize(frontend, is_enabled_fn=is_enabled_callback)
    # App that serves new endpoints API.
    endpoints_api = endpoints_webapp2.api_server([
        handlers_endpoints_v1.IsolateService,
        # components.config endpoints for validation and configuring of
        # luci-config service URL.
        config.ConfigApi,
    ])
    gae_ts_mon.instrument_wsgi_application(endpoints_api)

    prpc_api = webapp2.WSGIApplication(handlers_prpc.get_routes())
    return frontend, endpoints_api, prpc_api
Example #2
0
def create_application():
  ereporter2.register_formatter()

  # Zap out the ndb in-process cache by default.
  # This cache causes excessive memory usage in in handler where a lot of
  # entities are fetched in one query. When coupled with high concurrency
  # as specified via max_concurrent_requests in app.yaml, this may cause out of
  # memory errors.
  ndb.Context.default_cache_policy = staticmethod(lambda _key: False)
  ndb.Context._cache_policy = staticmethod(lambda _key: False)

  # If running on a local dev server, allow bots to connect without prior
  # groups configuration. Useful when running smoke test.
  if utils.is_local_dev_server():
    acl.bootstrap_dev_server_acls()
    pools_config.bootstrap_dev_server_acls()

  def is_enabled_callback():
    return config.settings().enable_ts_monitoring

  backend_app = handlers_backend.create_application(False)
  gae_ts_mon.initialize(backend_app, is_enabled_fn=is_enabled_callback)

  # Local import, because it instantiates the mapreduce app.
  # This is for the task queue handlers.
  from mapreduce import main
  gae_ts_mon.initialize(main.APP, is_enabled_fn=is_enabled_callback)

  event_mon_metrics.initialize()
  ts_mon_metrics.initialize()
  utils.report_memory(backend_app)
  return backend_app, main.APP
Example #3
0
def initialize():  # pragma: no cover
    """Bootstraps the global state and creates WSGI applications."""
    ereporter2.register_formatter()
    apps = (create_html_app(), create_endpoints_app(), create_backend_app())
    for app in apps:
        gae_ts_mon.initialize(app=app)
    return apps
Example #4
0
def create_application():
  ereporter2.register_formatter()
  backend = handlers_backend.create_application(False)

  def is_enabled_callback():
    return config.settings().enable_ts_monitoring

  gae_ts_mon.initialize(backend, is_enabled_fn=is_enabled_callback)
  return backend
Example #5
0
def create_backend_app():  # pragma: no cover
    """Returns WSGI app for backend."""
    routes = handlers.get_backend_routes() + swarming.get_backend_routes()
    app = webapp2.WSGIApplication(routes, debug=utils.is_local_dev_server())
    gae_ts_mon.initialize(app, cron_module='backend')
    gae_ts_mon.register_global_metrics(metrics.GLOBAL_METRICS)
    gae_ts_mon.register_global_metrics_callback('buildbucket_global',
                                                metrics.update_global_metrics)
    return app
Example #6
0
def create_application():
    ereporter2.register_formatter()
    backend = handlers_backend.create_application(False)

    def is_enabled_callback():
        return config.settings().enable_ts_monitoring

    gae_ts_mon.initialize(backend, is_enabled_fn=is_enabled_callback)
    return backend
Example #7
0
def main():
    utils.set_task_queue_module('default')
    apps = (
        handlers_endpoints.create_endpoints_app(),
        handlers_cron.create_cron_app(),
        handlers_frontend.create_frontend_app(),
        handlers_queues.create_queues_app(),
    )
    for app in apps:
        gae_ts_mon.initialize(app=app, is_enabled_fn=is_enabled_callback)
    return apps
def create_application():
    ereporter2.register_formatter()
    # Task queues must be sent to the backend.
    utils.set_task_queue_module('backend')
    template.bootstrap()

    # Zap out the ndb in-process cache by default.
    # This cache causes excessive memory usage in in handler where a lot of
    # entities are fetched in one query. When coupled with high concurrency
    # as specified via max_concurrent_requests in app.yaml, this may cause out of
    # memory errors.
    ndb.Context.default_cache_policy = staticmethod(lambda _key: False)
    ndb.Context._cache_policy = staticmethod(lambda _key: False)

    # If running on a local dev server, allow bots to connect without prior
    # groups configuration. Useful when running smoke test.
    if utils.is_local_dev_server():
        acl.bootstrap_dev_server_acls()
        pools_config.bootstrap_dev_server_acls()

    def is_enabled_callback():
        return config.settings().enable_ts_monitoring

    # App that serves HTML pages and old API.
    frontend_app = handlers_frontend.create_application(False)
    gae_ts_mon.initialize(frontend_app, is_enabled_fn=is_enabled_callback)

    endpoints_api = endpoints_webapp2.api_server([
        handlers_endpoints.SwarmingServerService,
        handlers_endpoints.SwarmingTaskService,
        handlers_endpoints.SwarmingTasksService,
        handlers_endpoints.SwarmingQueuesService,
        handlers_endpoints.SwarmingBotService,
        handlers_endpoints.SwarmingBotsService,
        # components.config endpoints for validation and configuring of luci-config
        # service URL.
        config.ConfigApi,
    ])

    prpc_api = webapp2.WSGIApplication(handlers_prpc.get_routes())

    # Local import, because it instantiates the mapreduce app.
    # This is for the Web UI.
    from mapreduce import main
    gae_ts_mon.initialize(main.APP, is_enabled_fn=is_enabled_callback)

    event_mon_metrics.initialize()
    ts_mon_metrics.initialize()
    utils.report_memory(frontend_app)
    utils.report_memory(endpoints_api)
    utils.report_memory(prpc_api)
    return frontend_app, endpoints_api, prpc_api, main.APP
Example #9
0
def create_application():
    ereporter2.register_formatter()

    # App that serves HTML pages and old API.
    frontend = handlers_frontend.create_application(False)

    def is_enabled_callback():
        return config.settings().enable_ts_monitoring

    gae_ts_mon.initialize(frontend, is_enabled_fn=is_enabled_callback)
    # App that serves new endpoints API.
    api = endpoints.api_server([handlers_endpoints_v1.IsolateService])
    return frontend, api
Example #10
0
def create_application():
  ereporter2.register_formatter()

  # App that serves HTML pages and old API.
  frontend = handlers_frontend.create_application(False)

  def is_enabled_callback():
    return config.settings().enable_ts_monitoring

  gae_ts_mon.initialize(frontend, is_enabled_fn=is_enabled_callback)
  # App that serves new endpoints API.
  api = endpoints.api_server([handlers_endpoints_v1.IsolateService])
  return frontend, api
Example #11
0
def create_backend_app():  # pragma: no cover
  """Returns WSGI app for backend."""
  routes = handlers.get_backend_routes() + swarming.get_routes()
  app = webapp2.WSGIApplication(routes, debug=utils.is_local_dev_server())
  gae_ts_mon.initialize(app, cron_module='backend')
  gae_ts_mon.register_global_metrics([
      metrics.CURRENTLY_PENDING,
      metrics.CURRENTLY_RUNNING,
      metrics.LEASE_LATENCY,
      metrics.SCHEDULING_LATENCY,
  ])
  gae_ts_mon.register_global_metrics_callback(
      'send_metrics', metrics.send_all_metrics)
  return app
Example #12
0
def main():
    utils.set_task_queue_module('default')
    apps = (
        handlers_endpoints.create_endpoints_app(),
        handlers_frontend.create_frontend_app(),
        handlers_cron.create_cron_app(),
        handlers_queues.create_queues_app(),
    )
    for app in apps[1:]:
        # Not callable on endpoints app
        gae_ts_mon.initialize(app=app, is_enabled_fn=is_enabled_callback)
    gae_event_mon.initialize('gce-backend')
    metrics.initialize()
    return apps
Example #13
0
def create_application():
    ereporter2.register_formatter()

    # Zap out the ndb in-process cache by default.
    # This cache causes excessive memory usage in in handler where a lot of
    # entities are fetched in one query. When coupled with high concurrency
    # as specified via max_concurrent_requests in app.yaml, this may cause out of
    # memory errors.
    ndb.Context.default_cache_policy = staticmethod(lambda _key: False)
    ndb.Context._cache_policy = staticmethod(lambda _key: False)

    backend = handlers_backend.create_application(False)

    def is_enabled_callback():
        return config.settings().enable_ts_monitoring

    gae_ts_mon.initialize(backend, is_enabled_fn=is_enabled_callback)
    return backend
Example #14
0
def create_application():
    ereporter2.register_formatter()

    def is_enabled_callback():
        return config.settings().enable_ts_monitoring

    # App that serves HTML pages and old API.
    frontend_app = handlers_frontend.create_application(False)
    gae_ts_mon.initialize(frontend_app, is_enabled_fn=is_enabled_callback)
    # Local import, because it instantiates the mapreduce app.
    from mapreduce import main
    gae_ts_mon.initialize(main.APP, is_enabled_fn=is_enabled_callback)
    api = endpoints.api_server([
        handlers_endpoints.swarming_api,
        # components.config endpoints for validation and configuring of luci-config
        # service URL.
        config.ConfigApi,
    ])
    ts_mon_metrics.initialize()
    return frontend_app, api, main.APP
Example #15
0
def create_application():
  ereporter2.register_formatter()

  def is_enabled_callback():
    return config.settings().enable_ts_monitoring

  # App that serves HTML pages and old API.
  frontend_app = handlers_frontend.create_application(False)
  gae_ts_mon.initialize(frontend_app, is_enabled_fn=is_enabled_callback)
  # Local import, because it instantiates the mapreduce app.
  from mapreduce import main
  gae_ts_mon.initialize(main.APP, is_enabled_fn=is_enabled_callback)
  api = endpoints.api_server([
    handlers_endpoints.swarming_api,
    # components.config endpoints for validation and configuring of luci-config
    # service URL.
    config.ConfigApi,
  ])
  ts_mon_metrics.initialize()
  return frontend_app, api, main.APP
Example #16
0
def create_application():
    ereporter2.register_formatter()

    # App that serves HTML pages and old API.
    frontend = handlers_frontend.create_application(False)

    def is_enabled_callback():
        return config.settings().enable_ts_monitoring

    gae_ts_mon.initialize(frontend, is_enabled_fn=is_enabled_callback)
    # App that serves new endpoints API.
    api = webapp2.WSGIApplication(
        endpoints_webapp2.api_server(
            [
                handlers_endpoints_v1.IsolateService,
                # components.config endpoints for validation and configuring of
                # luci-config service URL.
                config.ConfigApi,
            ],
            base_path='/_ah/api'))
    return frontend, api
Example #17
0
def create_application():
    ereporter2.register_formatter()
    utils.set_task_queue_module('backend')
    template.bootstrap()

    # If running on a local dev server, allow bots to connect without prior
    # groups configuration. Useful when running smoke test.
    if utils.is_local_dev_server():
        acl.bootstrap_dev_server_acls()

    def is_enabled_callback():
        return config.settings().enable_ts_monitoring

    # App that serves HTML pages and old API.
    frontend_app = handlers_frontend.create_application(False)
    gae_ts_mon.initialize(frontend_app, is_enabled_fn=is_enabled_callback)

    # App that contains crons and task queues.
    backend_app = handlers_backend.create_application(False)
    gae_ts_mon.initialize(backend_app, is_enabled_fn=is_enabled_callback)

    # Local import, because it instantiates the mapreduce app.
    from mapreduce import main
    gae_ts_mon.initialize(main.APP, is_enabled_fn=is_enabled_callback)

    # TODO(maruel): Remove this once there is no known client anymore.
    api = webapp2.WSGIApplication(
        endpoints_webapp2.api_server(
            [
                handlers_endpoints.SwarmingServerService,
                handlers_endpoints.SwarmingTaskService,
                handlers_endpoints.SwarmingTasksService,
                handlers_endpoints.SwarmingQueuesService,
                handlers_endpoints.SwarmingBotService,
                handlers_endpoints.SwarmingBotsService,
                # components.config endpoints for validation and configuring of luci-config
                # service URL.
                config.ConfigApi,
            ],
            base_path='/_ah/api'))

    event_mon_metrics.initialize()
    ts_mon_metrics.initialize()
    return frontend_app, api, backend_app, main.APP
Example #18
0
    ('/', main.MainHandler),
    ('/mark_recovered_alerts',
     mark_recovered_alerts.MarkRecoveredAlertsHandler),
    ('/memory_report', memory_report.MemoryReportHandler),
    ('/migrate_test_names', migrate_test_names.MigrateTestNamesHandler),
    ('/deprecate_tests', deprecate_tests.DeprecateTestsHandler),
    ('/navbar', navbar.NavbarHandler),
    ('/pinpoint/new/bisect',
     pinpoint_request.PinpointNewBisectRequestHandler),
    ('/pinpoint/new/perf_try',
     pinpoint_request.PinpointNewPerfTryRequestHandler),
    ('/pinpoint/new/prefill',
     pinpoint_request.PinpointNewPrefillRequestHandler),
    ('/put_entities_task', put_entities_task.PutEntitiesTaskHandler),
    ('/report', report.ReportHandler),
    ('/short_uri', short_uri.ShortUriHandler),
    (r'/speed_releasing/(.*)',
     speed_releasing.SpeedReleasingHandler),
    ('/speed_releasing', speed_releasing.SpeedReleasingHandler),
    ('/update_dashboard_stats',
     update_dashboard_stats.UpdateDashboardStatsHandler),
    ('/update_test_suites', update_test_suites.UpdateTestSuitesHandler),
    ('/update_test_suite_descriptors',
     update_test_suite_descriptors.UpdateTestSuiteDescriptorsHandler),
    (oauth2_decorator.DECORATOR.callback_path,
     oauth2_decorator.DECORATOR.callback_handler())
]

APP = webapp2.WSGIApplication(_URL_MAPPING, debug=False)
gae_ts_mon.initialize(APP)
Example #19
0
from handlers.flake.detection import show_flake
from handlers.flake.reporting import component_report
from handlers.flake.reporting import flake_report

# App Engine pipeline status pages.
pipeline_status_handler_mappings = [
    ('/_ah/pipeline/rpc/tree', pipeline_status_ui._TreeStatusHandler),
    ('/_ah/pipeline/rpc/class_paths',
     pipeline_status_ui._ClassPathListHandler),
    ('/_ah/pipeline/rpc/list', pipeline_status_ui._RootListHandler),
    ('/_ah/pipeline(/.+)', pipeline_status_ui._StatusUiHandler),
]
pipeline_status_application = webapp2.WSGIApplication(
    pipeline_status_handler_mappings, debug=False)
if appengine_util.IsInProductionApp():
    gae_ts_mon.initialize(pipeline_status_application)

# waterfall frontend.
waterfall_frontend_web_pages_handler_mappings = [
    ('/', home.Home),
    ('/waterfall/auto-revert-metrics', auto_revert_metrics.AutoRevertMetrics),
    ('/waterfall/check-duplicate-failures',
     check_duplicate_failures.CheckDuplicateFailures),
    ('/waterfall/config', config.Configuration),
    ('/waterfall/culprit', culprit.Culprit),
    ('/waterfall/failure', build_failure.BuildFailure),
    ('/waterfall/failure-log', failure_log.FailureLog),
    ('/waterfall/list-failures', list_analyses.ListAnalyses),
    ('/waterfall/pipeline-errors-dashboard',
     pipeline_errors_dashboard.PipelineErrorsDashboard),
    ('/waterfall/triage-suspected-cl', triage_suspected_cl.TriageSuspectedCl),
Example #20
0
from google.appengine.api import app_identity
from handlers import flake_issues
from handlers import migrate
from handlers.all_flake_occurrences import AllFlakeOccurrences
from handlers.cron_dispatch import CronDispatch
from handlers.index import Index
from handlers.post_comment import PostComment
from handlers.search import Search

handlers = [
    (r'/', Index),
    (r'/post_comment', PostComment),
    (r'/all_flake_occurrences', AllFlakeOccurrences),
    (r'/search', Search),
    (r'/cron/(.*)', CronDispatch),
    (r'/issues/process/(.*)', flake_issues.ProcessIssue),
    (r'/issues/update-if-stale/(.*)', flake_issues.UpdateIfStaleIssue),
    (r'/issues/create_flaky_run', flake_issues.CreateFlakyRun),
    (r'/override_issue_id', flake_issues.OverrideIssueId),
    (r'/migrate', migrate.Migrate),
]


def is_monitoring_enabled():
    return not app_identity.get_application_id().endswith('-staging')


app = webapp2.WSGIApplication(handlers, debug=True)
gae_ts_mon.initialize(app, is_enabled_fn=is_monitoring_enabled)
gae_event_mon.initialize('flakiness_pipeline')
Example #21
0
def wrap_webapp2_app(app):
    """Instruments webapp2 application to track HTTP endpoints performance."""
    gae_ts_mon.initialize(app=app,
                          is_enabled_fn=is_ts_monitoring_enabled,
                          cron_module='backend')
    return app
Example #22
0
def create_html_app():  # pragma: no cover
    """Returns WSGI app that serves HTML pages."""
    app = webapp2.WSGIApplication(handlers.get_frontend_routes(),
                                  debug=utils.is_local_dev_server())
    gae_ts_mon.initialize(app, cron_module='backend')
    return app
Example #23
0
                    self.rows[row] = rhs.rows[row].purge_unicode()
                self.category_count = sum([
                    len(self.ordered_categories[master])
                    for master in self.ordered_masters
                ])

        num_revs = self.request.get('numrevs')
        if num_revs:
            num_revs = utils.clean_int(num_revs, -1)
        if not num_revs or num_revs <= 0:
            num_revs = 25
        out = TemplateData(data, num_revs)
        template = template_environment.get_template('merger_b.html')
        self.response.out.write(template.render(data=out))


# Summon our persistent data model into existence.
data = MergerData()
data.bootstrap()
template_environment = jinja2.Environment()
template_environment.loader = jinja2.FileSystemLoader('templates')
template_environment.filters['notstarted'] = notstarted

URLS = [
    ('/restricted/merger/update', MergerUpdateAction),
    ('/restricted/merger/render.*', MergerRenderAction),
]

application = webapp2.WSGIApplication(URLS, debug=True)
gae_ts_mon.initialize(application)
Example #24
0
    ('/migrate_test_names', migrate_test_names.MigrateTestNamesHandler),
    ('/deprecate_tests', deprecate_tests.DeprecateTestsHandler),
    ('/navbar', navbar.NavbarHandler),
    ('/pinpoint/new/bisect',
     pinpoint_request.PinpointNewBisectRequestHandler),
    ('/pinpoint/new/perf_try',
     pinpoint_request.PinpointNewPerfTryRequestHandler),
    ('/pinpoint/new/prefill',
     pinpoint_request.PinpointNewPrefillRequestHandler),
    ('/post_bisect_results', post_bisect_results.PostBisectResultsHandler),
    ('/put_entities_task', put_entities_task.PutEntitiesTaskHandler),
    ('/report', report.ReportHandler),
    ('/short_uri', short_uri.ShortUriHandler),
    (r'/speed_releasing/(.*)',
     speed_releasing.SpeedReleasingHandler),
    ('/speed_releasing', speed_releasing.SpeedReleasingHandler),
    ('/start_try_job', start_try_job.StartBisectHandler),
    ('/update_bug_with_results',
     update_bug_with_results.UpdateBugWithResultsHandler),
    ('/update_dashboard_stats',
     update_dashboard_stats.UpdateDashboardStatsHandler),
    ('/update_test_suites', update_test_suites.UpdateTestSuitesHandler),
    ('/update_test_suite_descriptors',
     update_test_suite_descriptors.UpdateTestSuiteDescriptorsHandler),
    (oauth2_decorator.DECORATOR.callback_path,
     oauth2_decorator.DECORATOR.callback_handler())
]

APP = webapp2.WSGIApplication(_URL_MAPPING, debug=False)
gae_ts_mon.initialize(APP)
Example #25
0
from handlers import build_ahead
from handlers import calculate_confidence_scores
from handlers import check_reverted_cls
from handlers import collect_tree_closures
from handlers import obscure_emails
from handlers import process_failure_analysis_requests
from handlers import process_flake_analysis_request
from handlers.flake import update_open_flake_issues
from handlers.flake.detection import detect_flakes
from handlers.flake.detection import update_flake_counts
from handlers.flake.reporting import generate_report

# For appengine pipeline running on backend module.
pipeline_backend_application = pipeline_handlers._APP
if appengine_util.IsInProductionApp():
  gae_ts_mon.initialize(pipeline_backend_application)

# "waterfall-backend" module.
waterfall_backend_web_pages_handler_mappings = [
    ('/waterfall/cron/calculate-confidence-scores',
     calculate_confidence_scores.CalculateConfidenceScores),
    ('/waterfall/cron/check-reverted-cls', check_reverted_cls.CheckRevertedCLs),
    ('/waterfall/cron/collect-tree-closures',
     collect_tree_closures.CollectTreeClosures),
    ('/waterfall/cron/obscure-emails', obscure_emails.ObscureEmails),
    ('/waterfall/cron/periodic-build-ahead', build_ahead.BuildAhead),
    ('/waterfall/task/process-failure-analysis-requests',
     process_failure_analysis_requests.ProcessFailureAnalysisRequests),
    ('/waterfall/task/process-flake-analysis-request',
     process_flake_analysis_request.ProcessFlakeAnalysisRequest),
]
Example #26
0
 def setUp(self):
     super(TestMetrics, self).setUp()
     gae_ts_mon.reset_for_unittest()
     gae_ts_mon.initialize()
     self.now = datetime.datetime(2016, 4, 7)
     self.mock_now(self.now)
Example #27
0
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import webapp2

import gae_ts_mon

from gae_libs import appengine_util
from findit_v2.handlers import build_completion_processor

# "findit-backend" module.
findit_backend_handler_mappings = [
    ('/findit/internal/v2/task/build-completed',
     build_completion_processor.BuildCompletionProcessor),
]
findit_backend_web_application = webapp2.WSGIApplication(
    findit_backend_handler_mappings, debug=False)
if appengine_util.IsInProductionApp():
  gae_ts_mon.initialize(findit_backend_web_application)
Example #28
0
import gae_ts_mon

from gae_libs import appengine_util

from handlers import code_coverage

# "code-coverage-backend" module.
code_coverage_backend_handler_mappings = [
    ('.*/coverage/task/fetch-source-file', code_coverage.FetchSourceFile),
    ('.*/coverage/task/process-data/.*',
     code_coverage.ProcessCodeCoverageData),
]
code_coverage_backend_web_application = webapp2.WSGIApplication(
    code_coverage_backend_handler_mappings, debug=False)
if appengine_util.IsInProductionApp():
    gae_ts_mon.initialize(code_coverage_backend_web_application)

# "code-coverage-frontend" module.
code_coverage_frontend_handler_mappings = [
    # TODO(crbug.com/924573): Migrate to '.*/coverage/api/coverage-data'.
    ('/coverage/api/coverage-data', code_coverage.ServeCodeCoverageData),
    # These mappings are separated so that ts_mon data (e.g. latency) is
    # groupable by view. (instead of a single entry like .*/coverage.*)
    ('.*/coverage', code_coverage.ServeCodeCoverageData),
    ('.*/coverage/component', code_coverage.ServeCodeCoverageData),
    ('.*/coverage/dir', code_coverage.ServeCodeCoverageData),
    ('.*/coverage/file', code_coverage.ServeCodeCoverageData),
]
code_coverage_frontend_web_application = webapp2.WSGIApplication(
    code_coverage_frontend_handler_mappings, debug=False)
if appengine_util.IsInProductionApp():
Example #29
0
def create_html_app():  # pragma: no cover
  """Returns WSGI app that serves HTML pages."""
  app = webapp2.WSGIApplication(
    handlers.get_frontend_routes(), debug=utils.is_local_dev_server())
  gae_ts_mon.initialize(app, cron_module='backend')
  return app
Example #30
0
import time
import threading
import urllib2
import webapp2

import gae_ts_mon

from google.appengine.api.modules import modules

metric = gae_ts_mon.CounterMetric('test/dsansome/loadtest',
    description='Dummy metric for testing ts_mon on Appengine')


class IncrementHandler(webapp2.RequestHandler):
  def get(self):
    count = self.request.params['count']
    start = time.time()
    for _ in xrange(int(count)):
      metric.increment()
    end = time.time()

    self.response.write(end - start)


main_handlers = [
  (r'/inc', IncrementHandler),
]

app = webapp2.WSGIApplication(main_handlers, debug=True)
gae_ts_mon.initialize()
Example #31
0
        # TODO(hinoka): This should be in Google storage, where the grass is
        #               green and size limits don't exist.
        compressed_result = zlib.compress(json.dumps(final_result))
        if len(compressed_result) < 10**6:
          cached_result = BuildLogResultModel(
              url=url, version=VERSION_ID, data=compressed_result)
          cached_result.put()

        return final_result
    else:
      # Fetch the log from the buildbot master.
      logging.info('Old layout')
      s = BuildLog.fetch_buildlog(url)
      s = s.replace('default.css', '../../static/default-old.css')
      s = s.replace('<a href="stdio/text">(view as text)</a>',
          '<a href="stdio/text">(view as text)</a><br/><br/>'
          '<a href="%s?new=true">(New layout)</a>' %
          self.request.url.split('?')[0])
      return s


app = webapp2.WSGIApplication([
    ('/buildbot/', MainPage),
    ('/buildbot/(.*)/builders/(.*)/builds/(\d+)/steps/(.*)/logs/(.*)/?',
        BuildLog),
    ('/buildbot/(.*)/builders/(.*)/builds/(\d+)/?', Build),
    ('/buildbot/(.*)/buildslaves/(.*)/?', BuildSlave),
    ('/buildbot/(.*)', BuildbotPassthrough),
    ])
gae_ts_mon.initialize(app)
Example #32
0
def create_frontend_app():  # pragma: no cover
    """Returns WSGI app for frontend."""
    app = webapp2.WSGIApplication(handlers.get_frontend_routes(),
                                  debug=utils.is_local_dev_server())
    gae_ts_mon.initialize(app)
    return app
Example #33
0
from frontend.handlers import triage_analysis
from frontend.handlers import uma_sampling_profiler_dashboard
from frontend.handlers import uma_sampling_profiler_result_feedback
from gae_libs.pipeline_wrapper import pipeline_status_ui

# App Engine pipeline status pages in the default module.
pipeline_status_handler_mappings = [
    ('/_ah/pipeline/rpc/tree', pipeline_status_ui._TreeStatusHandler),
    ('/_ah/pipeline/rpc/class_paths',
     pipeline_status_ui._ClassPathListHandler),
    ('/_ah/pipeline/rpc/list', pipeline_status_ui._RootListHandler),
    ('/_ah/pipeline(/.+)', pipeline_status_ui._StatusUiHandler),
]
pipeline_status_application = webapp2.WSGIApplication(
    pipeline_status_handler_mappings, debug=False)
gae_ts_mon.initialize(pipeline_status_application)

frontend_web_pages_handler_mappings = [
    ('/clusterfuzz/dashboard', clusterfuzz_dashboard.ClusterfuzzDashBoard),
    ('/clusterfuzz/public-dashboard',
     clusterfuzz_public_dashboard.ClusterfuzzPublicDashBoard),
    ('/clusterfuzz/result-feedback',
     clusterfuzz_result_feedback.ClusterfuzzResultFeedback),
    ('/clusterfuzz/triage-analysis', triage_analysis.TriageAnalysis),
    ('/config', crash_config.CrashConfig),
    ('/cracas/dashboard', cracas_dashboard.CracasDashBoard),
    ('/cracas/result-feedback', cracas_result_feedback.CracasResultFeedback),
    ('/cracas/triage-analysis', triage_analysis.TriageAnalysis),
    ('/uma-sampling-profiler/dashboard',
     uma_sampling_profiler_dashboard.UMASamplingProfilerDashboard),
    ('/uma-sampling-profiler/result-feedback',
Example #34
0

class FetchPagesAction(base_page.BasePage):

  # R0201: 93,2:FetchPagesAction.get: Method could be a function
  # pylint: disable=R0201
  def get(self):
    deferred.defer(app.fetch_pages)


class MainAction(base_page.BasePage):

  def get(self):
    args = self.request.query_string
    self.redirect('/p/chromium/console' + '?' + args)


# Call initial bootstrap for the app module.
app.bootstrap()
base_page.bootstrap()

# GAE will cache |application| across requests if we set it here.  See
# http://code.google.com/appengine/docs/python/runtime.html#App_Caching for more
# info.
application = webapp2.WSGIApplication(
  [('/', MainAction),
   ('/p/(.*)/' + ONE_BOX_URL, OneBoxAction),
   ('/p/(.*)', PageAction),
   ('/tasks/fetch_pages', FetchPagesAction)])
gae_ts_mon.initialize(application)
Example #35
0
from handlers import triage_suspected_cl
from handlers import try_job_dashboard
from handlers import try_job_push
from handlers import version
from handlers.flake import analyze_regression_range
from handlers.flake import check_flake
from handlers.flake import list_flakes
from handlers.flake import triage_flake_analysis

# Default module.
default_web_pages_handler_mappings = [
    ('/version', version.Version),
]
default_web_application = webapp2.WSGIApplication(
    default_web_pages_handler_mappings, debug=False)
gae_ts_mon.initialize(default_web_application)

# Cloud Endpoint apis in the default module.
api_application = endpoints.api_server([FindItApi])

# App Engine pipeline status pages in the default module.
pipeline_status_handler_mappings = [
    ('/_ah/pipeline/rpc/tree', pipeline_status_ui._TreeStatusHandler),
    ('/_ah/pipeline/rpc/class_paths',
     pipeline_status_ui._ClassPathListHandler),
    ('/_ah/pipeline/rpc/list', pipeline_status_ui._RootListHandler),
    ('/_ah/pipeline(/.+)', pipeline_status_ui._StatusUiHandler),
]
pipeline_status_application = webapp2.WSGIApplication(
    pipeline_status_handler_mappings, debug=False)
gae_ts_mon.initialize(pipeline_status_application)
Example #36
0
import webapp2

import gae_ts_mon

from backend.handlers import rerun_analyses
from backend.handlers import rerun_analysis
from backend.handlers import update_component_config
from backend.handlers import update_inverted_index
from backend.handlers import update_monorail_metrics
from backend.handlers import update_repo_to_dep_path
from gae_libs.pipeline_wrapper import pipeline_handlers


# For appengine pipeline running on backend modules.
pipeline_backend_application = pipeline_handlers._APP
gae_ts_mon.initialize(pipeline_backend_application)


backend_handler_mappings = [
    ('/process/update-component-config',
     update_component_config.UpdateComponentConfig),
    ('/process/rerun-analyses', rerun_analyses.RerunAnalyses),
    ('/process/rerun-analysis', rerun_analysis.RerunAnalysis),
    ('/process/update-inverted-index',
     update_inverted_index.UpdateInvertedIndex),
    ('/process/update-monorail-metrics',
     update_monorail_metrics.UpdateMonorailMetrics),
    ('/process/update-repo-to-dep-path',
     update_repo_to_dep_path.UpdateRepoToDepPath),
]
backend_app = webapp2.WSGIApplication(backend_handler_mappings, debug=False)
Example #37
0
default_web_pages_handler_mappings = [
    ('/_ah/push-handlers/index-isolated-builds',
     completed_build_pubsub_ingestor.CompletedBuildPubsubIngestor),
    ('/_ah/push-handlers/swarming',
     swarming_pubsub_pipeline_callback.SwarmingPubSubPipelineCallback),
    ('/_ah/push-handlers/tryjob',
     try_job_pubsub_pipeline_callback.TryJobPubSubPipelineCallback),
    ('/', home.Home),
    # Keep this as the last one for URL redirection if there is no matching
    # above and no matching in the dispatch.yaml for old urls.
    (r'/.*', url_redirect.URLRedirect),
]
default_web_application = webapp2.WSGIApplication(
    default_web_pages_handler_mappings, debug=False)
if appengine_util.IsInProductionApp():
  gae_ts_mon.initialize(default_web_application)

# Cloud Endpoint apis in the default module.
api_application = endpoints_webapp2.api_server([FindItApi])
if appengine_util.IsInProductionApp():
  gae_ts_mon.initialize(api_application)

# App Engine pipeline status pages in the default module.
# TODO(stgao): Move this to frontend module.
pipeline_status_handler_mappings = [
    ('/_ah/pipeline/rpc/tree', pipeline_status_ui._TreeStatusHandler),
    ('/_ah/pipeline/rpc/class_paths', pipeline_status_ui._ClassPathListHandler),
    ('/_ah/pipeline/rpc/list', pipeline_status_ui._RootListHandler),
    ('/_ah/pipeline(/.+)', pipeline_status_ui._StatusUiHandler),
]
pipeline_status_application = webapp2.WSGIApplication(
Example #38
0
import threading
import urllib2
import webapp2

import gae_ts_mon

from google.appengine.api.modules import modules

metric = gae_ts_mon.CounterMetric('test/dsansome/loadtest',
    'Dummy metric for testing ts_mon on Appengine',
    None)


class IncrementHandler(webapp2.RequestHandler):
  def get(self):
    count = self.request.params['count']
    start = time.time()
    for _ in xrange(int(count)):
      metric.increment()
    end = time.time()

    self.response.write(end - start)


main_handlers = [
  (r'/inc', IncrementHandler),
]

app = webapp2.WSGIApplication(main_handlers, debug=True)
gae_ts_mon.initialize()
Example #39
0
import gae_ts_mon
import webapp2

from handlers.admin_dispatch import AdminDispatch
from handlers.builder_timeline_data import BuilderTimelineData
from handlers.index import Index
from handlers.patch_status import PatchStatus
from handlers.patch_summary import PatchSummary
from handlers.patch_timeline import PatchTimeline
from handlers.patch_timeline_data import PatchTimelineData
from handlers.post import Post
from handlers.stats_viewer import StatsViewer
from handlers.stats_data_points import StatsDataPoints

handlers = [
  (r'/', Index),
  (r'/admin/(.*)', AdminDispatch),
  (r'/builder-timeline-data/(.*)/(.*)/(.*)/(.*)', BuilderTimelineData),
  (r'/patchset/(.*)/(.*)', PatchStatus),  # Legacy URL for old links.
  (r'/patch-status/(.*)/(.*)', PatchStatus),
  (r'/patch-summary/(.*)/(.*)', PatchSummary),
  (r'/patch-timeline/(.*)/(.*)', PatchTimeline),
  (r'/patch-timeline-data/(.*)/(.*)', PatchTimelineData),
  (r'/post', Post),
  (r'/stats/(highest|lowest)/(.*)/(.*)', StatsDataPoints),
  (r'/stats/(.*)/(.*)', StatsViewer),
]

app = webapp2.WSGIApplication(handlers, debug=True)
gae_ts_mon.initialize(app)
 def setUp(self):
   super(TestMetrics, self).setUp()
   gae_ts_mon.reset_for_unittest()
   gae_ts_mon.initialize()
   self.now = datetime.datetime(2016, 4, 7)
   self.mock_now(self.now)