Skip to content

Commit

Permalink
Remove old search metrics collection system. (ansible#1274)
Browse files Browse the repository at this point in the history
* Remove old search metrics collection system.

* update docs

* Add option to disable metrics in backend.
  • Loading branch information
newswangerd authored Nov 5, 2018
1 parent 25c1c57 commit 5ebe403
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 152 deletions.
20 changes: 0 additions & 20 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -324,26 +324,6 @@ OK, go for it! Your Galaxy web site is available at: `http://localhost:8000 <htt
Post build setup
----------------

Metrics
^^^^^^^

From the root of the project tree, run ``make dev/setup-metrics`` to initialize
InfluxDB and import data sources and dashboards for Prometheus and InfluxDB into Grafana.

.. code-block:: console
$ make dev/setup-metrics
Log into Grafana at `http://localhost:3000 <http://localhost:3000>`_ using the admin user with
password ``admin``. Navigate to ``Galaxy Search Metrics - InfluxDB`` and
``Galaxy Search Metrics - Prometheus`` dashboards.

Search metrics are exposed at `http://localhost:8000/metrics <http://localhost:8000/metrics>`_. From
there, the metrics are being scraped by Prometheus
(`http://localhost:9090/ <http://localhost:9090/>`_). Prometheus serves as a short-term storage.
For a long-term metrics storage, the metrics are being sent from
Prometheus to InfluxDB.

Create an admin user
^^^^^^^^^^^^^^^^^^^^

Expand Down
3 changes: 3 additions & 0 deletions galaxy/api/serializers/influx.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class BaseMeasurement(drf_serializers.Serializer):
measurement = drf_serializers.CharField()

def save(self):
if not settings.GALAXY_METRICS_ENABLED:
return

global influx_insert_buffer
if len(influx_insert_buffer) < settings.INFLUX_INSERT_BUFFER_COUNT:
influx_insert_buffer.append(self.data)
Expand Down
2 changes: 0 additions & 2 deletions galaxy/api/views/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from galaxy.api import filters
from galaxy.api import serializers
from galaxy.api.views import base_views as base
from galaxy.common import metrics
from galaxy.main import models

__all__ = [
Expand Down Expand Up @@ -80,7 +79,6 @@ def get_queryset(self):
repository__provider_namespace__namespace__active=True))

# TODO(cutwater): Use serializer to parse request arguments
@metrics.send('search')
def list(self, request, *args, **kwargs):
queryset = self.filter_queryset(self.get_queryset())

Expand Down
95 changes: 0 additions & 95 deletions galaxy/common/metrics.py

This file was deleted.

24 changes: 2 additions & 22 deletions galaxy/settings/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import os

import djcelery
import prometheus_client


djcelery.setup_loader()

Expand Down Expand Up @@ -297,26 +295,6 @@
If set to `None`, system temporary directory is used.
"""

# =========================================================
# Metrics Settings
# =========================================================

METRICS_ENABLED = False

PROM_CNTR_SEARCH = prometheus_client.Counter(
'galaxy_search',
'',
['keywords', 'platforms', 'cloud_platforms', 'tags'],
registry=prometheus_client.REGISTRY
)

PROM_CNTR_SEARCH_CRITERIA = prometheus_client.Counter(
'galaxy_search_criteria',
'',
['ctype', 'cvalue'],
registry=prometheus_client.REGISTRY
)

# =========================================================
# Logging
# =========================================================
Expand Down Expand Up @@ -440,6 +418,8 @@
# more data will potentially be lost when galaxy restarts.
INFLUX_INSERT_BUFFER_COUNT = 5

GALAXY_METRICS_ENABLED = True


# =========================================================
# Domain Settings
Expand Down
6 changes: 0 additions & 6 deletions galaxy/settings/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,3 @@
]

STATIC_ROOT = ''

# =========================================================
# Metrics Settings
# =========================================================

METRICS_ENABLED = True
7 changes: 0 additions & 7 deletions galaxy/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,6 @@ def _set_logging():

LOGGING = _set_logging()

# =========================================================
# Metrics Settings
# =========================================================

METRICS_ENABLED = True


# =========================================================
# InfluxDB Settings
# =========================================================
Expand Down

0 comments on commit 5ebe403

Please sign in to comment.