Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: infra_libs/ts_mon/api_monitor.py

Issue 1433543003: ts_mon: removed support for https:// endpoints (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fixed overzealous cleanup Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bootstrap/deps.pyl ('k') | infra_libs/ts_mon/config.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra_libs/ts_mon/api_monitor.py
diff --git a/infra_libs/ts_mon/api_monitor.py b/infra_libs/ts_mon/api_monitor.py
deleted file mode 100644
index 7356859ecdf822acfb863201b53e14d0f0d31434..0000000000000000000000000000000000000000
--- a/infra_libs/ts_mon/api_monitor.py
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright 2015 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.
-
-"""Monitor object which sends metrics to the monitoring api."""
-
-
-import logging
-import os
-
-from monacq import acquisition_api
-
-from infra_libs import httplib2_utils
-from infra_libs.ts_mon.common import monitors
-
-
-def _logging_callback(resp, content):
- logging.debug(repr(resp))
- logging.debug(content)
-
-
-class ApiMonitor(monitors.Monitor):
- """Class which sends metrics to the monitoring api."""
- def __init__(self, credsfile, endpoint, use_instrumented_http=True):
- """Process monitoring related command line flags and initialize api.
-
- Args:
- credsfile (str): path to the credentials json file
- endpoint (str): url of the monitoring endpoint to hit
- """
-
- if credsfile in (monitors.APPENGINE_CREDENTIALS,
- monitors.GCE_CREDENTIALS):
- raise NotImplementedError(
- 'Appengine or GCE service accounts are not supported for ApiMonitor')
-
- creds = acquisition_api.AcquisitionCredential.Load(
- os.path.abspath(credsfile))
- api = acquisition_api.AcquisitionApi(creds, endpoint)
- api.SetResponseCallback(_logging_callback)
-
- if use_instrumented_http:
- api.SetHttp(httplib2_utils.InstrumentedHttp('acq-mon-api'))
-
- self._api = api
-
- def send(self, metric_pb):
- """Send a metric proto to the monitoring api.
-
- Args:
- metric_pb (MetricsData or MetricsCollection): the metric protobuf to send
- """
- try:
- self._api.Send(self._wrap_proto(metric_pb))
- except acquisition_api.AcquisitionApiRequestException as e:
- logging.error('Failed to send the metrics: %s', e)
-
« no previous file with comments | « bootstrap/deps.pyl ('k') | infra_libs/ts_mon/config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698