-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prometheus pull method of metrics gathering suits better such application as it doesn't require gatherer to be configure always. It also provides metrics in much more "standardized" way as prometheus_phoenix and prometheus_plugs are quite norm when coming to the respective library metrics gathering. There are also predefined Grafana's dashboards that can be found there: https://github.com/deadtrickster/beam-dashboards
- Loading branch information
Showing
18 changed files
with
125 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
defmodule Imager.Instrumenter.Cache do | ||
use Prometheus.Metric | ||
|
||
@counter [ | ||
name: :cache_hits_total, | ||
help: "Count of cached images hits", | ||
labels: [:type, :store] | ||
] | ||
|
||
def passthrough({store, _}), | ||
do: Counter.inc(name: :cache_hits_total, labels: [:passthrough, store]) | ||
|
||
def cache_hit({store, _}), | ||
do: Counter.inc(name: :cache_hits_total, labels: [:cache, store]) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
defmodule Imager.Instrumenter.Processing do | ||
use Prometheus.Metric | ||
|
||
@counter [ | ||
name: :processed_total, | ||
help: "Count of processed images", | ||
labels: [:status, :store] | ||
] | ||
@counter [ | ||
name: :process_commands_total, | ||
help: "Processing commands defined", | ||
labels: [:command, :argument] | ||
] | ||
|
||
def succeeded({store, _}), | ||
do: Counter.inc(name: :processed_total, labels: ["ok", store]) | ||
|
||
def failed({store, _}), | ||
do: Counter.inc(name: :processed_total, labels: ["failed", store]) | ||
|
||
def command({command, argument}) do | ||
Counter.inc( | ||
name: :process_commands_total, | ||
labels: [command, argument] | ||
) | ||
end | ||
|
||
def command(list) when is_list(list), do: Enum.each(list, &command/1) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
defmodule Imager.Instrumenter.Storage do | ||
use Prometheus.Metric | ||
|
||
@counter [ | ||
name: :store_retrieved_total, | ||
help: "Count of retrieves from the given store", | ||
labels: [:store] | ||
] | ||
@counter [ | ||
name: :store_saved_total, | ||
help: "Count of saves into the given store", | ||
labels: [:store] | ||
] | ||
|
||
@summary [ | ||
name: :store_retrieved_bytes, | ||
help: "Bytes retrieved from the store", | ||
labels: [:store] | ||
] | ||
@summary [ | ||
name: :store_saved_bytes, | ||
help: "Saved bytes to given store", | ||
labels: [:store] | ||
] | ||
|
||
def retrieved(stream, store) do | ||
Counter.inc(name: :store_retrieved_total, labels: [store]) | ||
|
||
Stream.each(stream, &Summary.observe([name: :store_retrieved_bytes, labels: [store]], byte_size(&1))) | ||
end | ||
|
||
def saved(stream, store) do | ||
Counter.inc(name: :store_saved_total, labels: [store]) | ||
|
||
Stream.each(stream, &Summary.observe([name: :store_saved_bytes, labels: [store]], byte_size(&1))) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
defmodule ImagerWeb.Plug.MetricsExporter do | ||
use Prometheus.PlugExporter | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
defmodule ImagerWeb.Plug.PipelineInstrumenter do | ||
use Prometheus.PlugPipelineInstrumenter | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.