Skip to content

Commit

Permalink
index_times -> index_durations
Browse files Browse the repository at this point in the history
  • Loading branch information
tpendragon committed Nov 27, 2024
1 parent 7614264 commit 2bd2e78
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions lib/dpul_collections/index_metrics_tracker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions lib/dpul_collections_web/indexing_pipeline/dashboard_page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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]}
Expand All @@ -24,23 +24,23 @@ 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)}
end

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)}
end

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)}
Expand Down
4 changes: 2 additions & 2 deletions test/dpul_collections/index_metrics_tracker_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2bd2e78

Please sign in to comment.