Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion implementations/elixir/examples/get_started/setup.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Mix.install([
{:ockam, path: "../../ockam/ockam"},
{:ockam_typed_cbor, override: true,
path: "../../ockam/ockam_typed_cbor"},
{:ranch, "~> 2.1"}
{:ranch, "~> 2.2"}
])

Application.load(:ockam)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Mix.install([
{:ockam, path: "../../ockam/ockam"},
{:ockam_typed_cbor, override: true,
path: "../../ockam/ockam_typed_cbor"},
{:ranch, "~> 2.1"}
{:ranch, "~> 2.2"}
])

Application.load(:ockam)
2 changes: 1 addition & 1 deletion implementations/elixir/ockam/ockam/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ defmodule Ockam.MixProject do
{:ockam_typed_cbor, path: "../ockam_typed_cbor"},
{:gen_state_machine, "~> 3.0"},
{:telemetry, "~> 1.0", optional: true},
{:ranch, "~> 2.1", optional: true},
{:ranch, "~> 2.2", optional: true},
{:ex_doc, "~> 0.25", only: :dev, runtime: false},
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.1", only: [:dev], runtime: false},
Expand Down
6 changes: 0 additions & 6 deletions implementations/elixir/ockam/ockam_cloud_node/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ defmodule Ockam.CloudNode.MixProject do
{:ex_doc, "~> 0.25", only: :dev, runtime: false},
{:ockam_services, path: "../ockam_services"},
{:ockam_kafka, path: "../ockam_kafka"},
{:telemetry, "~> 1.0", override: true},
{:telemetry_poller, "~> 1.0"},
{:telemetry_metrics, "~> 0.6.1"},
{:telemetry_metrics_prometheus, "~> 1.1.0"},
# Needed to avoid conflict on ranch version used by cowboy (telemetry_metrics_prometheus dep)
{:ranch, "~> 2.1.0", override: true},
{:sched_ex, "~> 1.0"}
]
end
Expand Down
92 changes: 44 additions & 48 deletions implementations/elixir/ockam/ockam_cloud_node/mix.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule Ockam.Metrics.Application do
def start(_type, _args) do
children =
if Application.get_env(:ockam_metrics, :prometheus_port, nil) do
[Ockam.Metrics.Prometheus]
[Ockam.Metrics.Prometheus, Ockam.Metrics.Exporter.child_spec([])]
else
[]
end ++
Expand Down
23 changes: 23 additions & 0 deletions implementations/elixir/ockam/ockam_metrics/lib/exporter.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
defmodule Ockam.Metrics.Exporter do
defmodule MyPlug do
import Plug.Conn

def init(options) do
# initialize options
options
end

def call(conn, _opts) do
body = TelemetryMetricsPrometheus.Core.scrape()

conn
|> put_resp_content_type("text/plain")
|> send_resp(200, body)
end
end

def child_spec(_options) do
port = String.to_integer(Application.fetch_env!(:ockam_metrics, :prometheus_port))
{Plug.Cowboy, plug: MyPlug, scheme: :http, options: [port: port]}
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ defmodule Ockam.Metrics.Prometheus do
%{
id: TelemetryMetricsPrometheus,
start: {
TelemetryMetricsPrometheus,
TelemetryMetricsPrometheus.Core,
:start_link,
[
[
metrics: prepare_tags(metrics, shared_tags),
port: String.to_integer(Application.fetch_env!(:ockam_metrics, :prometheus_port))
metrics: prepare_tags(metrics, shared_tags)
]
]
}
Expand Down
5 changes: 2 additions & 3 deletions implementations/elixir/ockam/ockam_metrics/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ defmodule Ockam.Metrics.MixProject do
{:telemetry, "~> 1.0", override: true},
{:telemetry_poller, "~> 1.0"},
{:telemetry_metrics, "~> 0.6.1"},
{:telemetry_metrics_prometheus, "~> 1.1.0"},
# Needed to avoid conflic on ranch version used by cowboy (telemetry_metrics_prometheus dep)
{:ranch, "~> 2.1.0", override: true}
{:telemetry_metrics_prometheus_core, "~> 1.2.1"},
{:plug_cowboy, "~> 2.7.3"}
]
end

Expand Down
4 changes: 2 additions & 2 deletions implementations/elixir/ockam/ockam_services/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ defmodule Ockam.Services.MixProject do
{:ockam, path: "../ockam"},
{:ockam_metrics, path: "../ockam_metrics"},
{:ockam_abac, path: "../ockam_abac"},
{:ranch, "~> 2.1.0", override: true},
{:ranch, "~> 2.2"},
## Token lease manager
{:httpoison, "~> 2.1"},
{:poison, "~> 5.0.0"},

## Used for Ockam.Services.API.Endpoint' dispatch table implementation
{:cowboy, "~> 2.10.0"}
{:cowboy, "~> 2.13.0"}
]
end

Expand Down
Loading