Packages
prom_ex
1.11.0
1.12.0
1.11.0
1.10.0
1.9.0
1.8.0
1.7.1
1.7.0
retired
1.6.0
1.5.0
1.4.1
1.4.0
1.3.0
1.2.2
1.2.1
1.2.0
1.1.1
1.1.0
1.0.1
1.0.0
0.1.15-beta
0.1.14-beta
0.1.13-beta
0.1.12-beta
0.1.11-alpha
0.1.10-alpha
0.1.9-alpha
0.1.8-alpha
0.1.7-alpha
0.1.6-alpha
0.1.5-alpha
0.1.4-alpha
0.1.3-alpha
0.1.2-alpha
0.1.1-alpha
0.1.0-alpha
Prometheus metrics and Grafana dashboards for all of your favorite Elixir libraries
Current section
Files
Jump to
Current section
Files
lib/prom_ex/storage/core.ex
# TODO: For version 2.0.0 have all of the supported adapters be
# optional deps.
# if Code.ensure_loaded?(TelemetryMetricsPrometheus.Core) do
defmodule PromEx.Storage.Core do
@moduledoc """
This store uses [TelemetryMetricsPrometheus.Core](https://github.com/beam-telemetry/telemetry_metrics_prometheus_core) as the storage
mechanism for metrics.
"""
alias TelemetryMetricsPrometheus.Core
@behaviour PromEx.Storage
@dialyzer {:no_return, child_spec: 2}
@impl true
def scrape(name) do
if Process.whereis(name) do
Core.scrape(name)
else
:prom_ex_down
end
end
@impl true
def child_spec(name, metrics) do
opts = [
name: name,
metrics: metrics,
require_seconds: false,
consistent_units: true,
start_async: false
]
Core.child_spec(opts)
end
end