diff --git a/lib/dpul_collections/index_metrics_tracker.ex b/lib/dpul_collections/index_metrics_tracker.ex index 317ce0c6..10823fa3 100644 --- a/lib/dpul_collections/index_metrics_tracker.ex +++ b/lib/dpul_collections/index_metrics_tracker.ex @@ -38,8 +38,8 @@ defmodule DpulCollections.IndexMetricsTracker do GenServer.call(__MODULE__, {:poll_started, source}) end - @spec index_times(source :: module()) :: term() - def index_times(source) do + @spec index_durations(source :: module()) :: term() + def index_durations(source) do Metrics.index_metrics(source.processor_marker_key(), "full_index") end diff --git a/lib/dpul_collections_web/indexing_pipeline/dashboard_page.ex b/lib/dpul_collections_web/indexing_pipeline/dashboard_page.ex index 19f6cf62..9f7f421c 100644 --- a/lib/dpul_collections_web/indexing_pipeline/dashboard_page.ex +++ b/lib/dpul_collections_web/indexing_pipeline/dashboard_page.ex @@ -9,9 +9,9 @@ defmodule DpulCollectionsWeb.IndexingPipeline.DashboardPage do def mount(_params, _session, socket) do socket = assign(socket, - hydration_times: IndexMetricsTracker.index_times(HydrationProducerSource), - transformation_times: IndexMetricsTracker.index_times(TransformationProducerSource), - indexing_times: IndexMetricsTracker.index_times(IndexingProducerSource) + hydration_times: IndexMetricsTracker.index_durations(HydrationProducerSource), + transformation_times: IndexMetricsTracker.index_durations(TransformationProducerSource), + indexing_times: IndexMetricsTracker.index_durations(IndexingProducerSource) ) {:ok, socket, temporary_assigns: [item_count: nil]} @@ -24,7 +24,7 @@ defmodule DpulCollectionsWeb.IndexingPipeline.DashboardPage do defp hydration_times(_params, _node) do hydration_times = - IndexMetricsTracker.index_times(HydrationProducerSource) + IndexMetricsTracker.index_durations(HydrationProducerSource) |> Enum.map(&Map.from_struct/1) {hydration_times, length(hydration_times)} @@ -32,7 +32,7 @@ defmodule DpulCollectionsWeb.IndexingPipeline.DashboardPage do defp transformation_times(_params, _node) do transformation_times = - IndexMetricsTracker.index_times(TransformationProducerSource) + IndexMetricsTracker.index_durations(TransformationProducerSource) |> Enum.map(&Map.from_struct/1) {transformation_times, length(transformation_times)} @@ -40,7 +40,7 @@ defmodule DpulCollectionsWeb.IndexingPipeline.DashboardPage do defp indexing_times(_params, _node) do indexing_times = - IndexMetricsTracker.index_times(IndexingProducerSource) + IndexMetricsTracker.index_durations(IndexingProducerSource) |> Enum.map(&Map.from_struct/1) {indexing_times, length(indexing_times)} diff --git a/test/dpul_collections/index_metrics_tracker_test.exs b/test/dpul_collections/index_metrics_tracker_test.exs index 08b743f9..abcc63d0 100644 --- a/test/dpul_collections/index_metrics_tracker_test.exs +++ b/test/dpul_collections/index_metrics_tracker_test.exs @@ -5,7 +5,7 @@ defmodule DpulCollections.IndexMetricsTrackerTest do alias Phoenix.ActionClauseError use DpulCollections.DataCase - describe "index_times/1" do + describe "index_durations/1" do setup do IndexMetricsTracker.reset() :ok @@ -62,7 +62,7 @@ defmodule DpulCollections.IndexMetricsTrackerTest do } ) - [metric = %IndexMetric{}] = IndexMetricsTracker.index_times(HydrationProducerSource) + [metric = %IndexMetric{}] = IndexMetricsTracker.index_durations(HydrationProducerSource) # Assert # This is 0 because it takes less than a second to run. diff --git a/test/dpul_collections/indexing_pipeline/integration/full_integration_test.exs b/test/dpul_collections/indexing_pipeline/integration/full_integration_test.exs index 25cf1515..58a9bf55 100644 --- a/test/dpul_collections/indexing_pipeline/integration/full_integration_test.exs +++ b/test/dpul_collections/indexing_pipeline/integration/full_integration_test.exs @@ -162,7 +162,7 @@ defmodule DpulCollections.IndexingPipeline.FiggyFullIntegrationTest do # Ensure metrics are being sent. assert_receive {:hydrator_time_to_poll_hit, %{duration: _}} - [hydration_metric_1 | _] = IndexMetricsTracker.index_times(HydrationProducerSource) + [hydration_metric_1 | _] = IndexMetricsTracker.index_durations(HydrationProducerSource) assert hydration_metric_1.duration > 0 end