From 6c84f2518ca0a73a6cd27cb14336fb5152c6c64b Mon Sep 17 00:00:00 2001 From: Michael Guarino Date: Mon, 16 Jul 2018 17:07:18 -0400 Subject: [PATCH] Clean up monitoring leftovers --- lib/exlasticsearch/monitoring.ex | 8 -------- lib/exlasticsearch/repo.ex | 32 ++++++++++++++++++-------------- mix.exs | 2 +- 3 files changed, 19 insertions(+), 23 deletions(-) delete mode 100644 lib/exlasticsearch/monitoring.ex diff --git a/lib/exlasticsearch/monitoring.ex b/lib/exlasticsearch/monitoring.ex deleted file mode 100644 index 11bee01..0000000 --- a/lib/exlasticsearch/monitoring.ex +++ /dev/null @@ -1,8 +0,0 @@ -defmodule ExlasticSearch.Monitoring do - @moduledoc """ - Module responsible for any statsd monitoring of elasticsearch events. - """ - @implementation Application.get_env(:exlasticsearch, :monitoring) - - defdelegate increment(key, value), to: @implementation -end \ No newline at end of file diff --git a/lib/exlasticsearch/repo.ex b/lib/exlasticsearch/repo.ex index acc3ea9..7a28d08 100644 --- a/lib/exlasticsearch/repo.ex +++ b/lib/exlasticsearch/repo.ex @@ -21,8 +21,10 @@ defmodule ExlasticSearch.Repo do Creates an index as defined in `model` """ @spec create_index(atom) :: response - def create_index(model), - do: es_url() |> Index.create(model.__es_index__(), model.__es_settings__()) + def create_index(model) do + es_url() + |> Index.create(model.__es_index__(), model.__es_settings__()) + end @doc """ Updates the index for `model` @@ -52,15 +54,19 @@ defmodule ExlasticSearch.Repo do Updates an index's mappings to the current definition in `model` """ @spec create_mapping(atom) :: response - def create_mapping(model), - do: es_url() |> Mapping.put(model.__es_index__(), model.__doc_type__(), model.__es_mappings__()) + def create_mapping(model) do + es_url() + |> Mapping.put(model.__es_index__(), model.__doc_type__(), model.__es_mappings__()) + end @doc """ Removes the index defined in `model` """ @spec delete_index(atom) :: response - def delete_index(model), - do: es_url() |> Index.delete(model.__es_index__()) + def delete_index(model) do + es_url() + |> Index.delete(model.__es_index__()) + end @doc """ Checks if the index for `model` exists @@ -124,8 +130,10 @@ defmodule ExlasticSearch.Repo do Removes `struct` from the index of its model """ @spec delete(struct) :: response - def delete(%{__struct__: model} = struct), - do: es_url() |> Document.delete(model.__es_index__(), model.__doc_type__(), Indexable.id(struct)) + def delete(%{__struct__: model} = struct) do + es_url() + |> Document.delete(model.__es_index__(), model.__doc_type__(), Indexable.id(struct)) + end @doc """ @@ -143,16 +151,12 @@ defmodule ExlasticSearch.Repo do struct to the `ExlasticSearch.Indexable` protocol """ def bulk(operations, opts \\ []) do - ExlasticSearch.Monitoring.increment("elasticsearch.batch_operations", length(operations)) bulk_request = operations |> Enum.map(&bulk_operation/1) |> Enum.concat() - result = es_url() - |> Bulk.post(bulk_request, [], opts) - - Logger.debug fn -> "ES Bulk response #{inspect(result)}" end - result + es_url() + |> Bulk.post(bulk_request, [], opts) end def index_stream(stream, parallelism \\ 10, demand \\ 10) do diff --git a/mix.exs b/mix.exs index 843bcac..82053c2 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Exlasticsearch.MixProject do use Mix.Project - @version "0.2.2" + @version "0.2.3" def project do [