From fe18969953486690c91cd70f065da9a02e7e486f Mon Sep 17 00:00:00 2001 From: Daniel Thorn Date: Wed, 20 Nov 2024 13:42:43 -0800 Subject: [PATCH] address review --- bin/setup_services.sh | 3 +++ bin/test.sh | 8 +------- bin/waitfor_services.sh | 21 +++++++++++++++++++++ socorro/external/es/supersearch.py | 2 +- socorro/statsd_metrics.yaml | 24 ++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 8 deletions(-) create mode 100755 bin/waitfor_services.sh diff --git a/bin/setup_services.sh b/bin/setup_services.sh index 8dc46e259e..1e787791e4 100755 --- a/bin/setup_services.sh +++ b/bin/setup_services.sh @@ -13,6 +13,9 @@ set -euo pipefail +# wait for dev services to start up +./bin/waitfor_services.sh + # Drop and re-create the breakpad database with tables, stored procedures, # types, indexes, and keys; also bulk-loads static data for some lookup tables /app/bin/setup_postgres.sh diff --git a/bin/test.sh b/bin/test.sh index 39e12c389c..cd1c4ee425 100755 --- a/bin/test.sh +++ b/bin/test.sh @@ -27,13 +27,7 @@ PYTHON="$(which python)" echo ">>> wait for services to be ready" -waitfor --verbose --conn-only "${DATABASE_URL}" -waitfor --verbose "${LEGACY_ELASTICSEARCH_URL}" -waitfor --verbose "http://${PUBSUB_EMULATOR_HOST}" -waitfor --verbose "${STORAGE_EMULATOR_HOST}/storage/v1/b" -waitfor --verbose --codes={200,404} "${SENTRY_DSN}" -# wait for this last because it's slow to start -waitfor --verbose --timeout=30 "${ELASTICSEARCH_URL}" +./bin/waitfor_services.sh echo ">>> build queue things and db things" diff --git a/bin/waitfor_services.sh b/bin/waitfor_services.sh new file mode 100755 index 0000000000..58919317c0 --- /dev/null +++ b/bin/waitfor_services.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Usage: bin/waitfor_services.sh +# +# Waits for dev services to start up. +# +# Note: This should be called from inside a container. + +set -euo pipefail + +waitfor --verbose --conn-only "${DATABASE_URL}" +waitfor --verbose "${LEGACY_ELASTICSEARCH_URL}" +waitfor --verbose "http://${PUBSUB_EMULATOR_HOST}" +waitfor --verbose "${STORAGE_EMULATOR_HOST}/storage/v1/b" +waitfor --verbose --codes={200,404} "${SENTRY_DSN}" +# wait for this last because it's slow to start +waitfor --verbose --timeout=30 "${ELASTICSEARCH_URL}" diff --git a/socorro/external/es/supersearch.py b/socorro/external/es/supersearch.py index 090b865d55..1f3edfbccd 100644 --- a/socorro/external/es/supersearch.py +++ b/socorro/external/es/supersearch.py @@ -142,7 +142,7 @@ def _format(aggregation): return aggregation for i, bucket in enumerate(aggregation["buckets"]): - if bucket["key"] in (True, False): + if isinstance(bucket["key"], bool): # Restore es 1.4 format for boolean terms as string term = "T" if bucket["key"] else "F" elif "key_as_string" in bucket: diff --git a/socorro/statsd_metrics.yaml b/socorro/statsd_metrics.yaml index 2da71ea327..91ea46bf84 100644 --- a/socorro/statsd_metrics.yaml +++ b/socorro/statsd_metrics.yaml @@ -125,6 +125,30 @@ socorro.processor.es.save_processed_crash: description: | Timer for how long it takes to save the processed crash to Elasticsearch. +socorro.processor.legacy_es.crash_document_size: + type: "histogram" + description: | + Size of crash document. In bytes. + +socorro.processor.legacy_es.index: + type: "histogram" + description: | + Total time it took to index the crash document in Elasticsearch. + +socorro.processor.legacy_es.indexerror: + type: "incr" + description: | + Counter for errors when indexing a document in Elasticsearch. + + Tags: + + * ``error``: the error code indicating what happened + +socorro.processor.legacy_es.save_processed_crash: + type: "timing" + description: | + Timer for how long it takes to save the processed crash to Elasticsearch. + socorro.processor.ingestion_timing: type: "timing" description: |