Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #40

Merged
merged 4 commits into from
Apr 26, 2022
Merged
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
3 changes: 2 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
(lang dune 1.0)
(lang dune 2.0)
(name prometheus)
(formatting disabled)
8 changes: 3 additions & 5 deletions examples/example.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ let () =
Logs.info (fun f -> f "Logging initialised.");
print_endline "If run with the option --listen-prometheus=9090, this program serves metrics at\n\
http://localhost:9090/metrics";
let spec = Term.(const main $ Prometheus_unix.opts) in
let info = Term.info "example" in
match Term.eval (spec, info) with
| `Error _ -> exit 1
| _ -> exit 0
let info = Cmd.info "example" in
let cmd = Cmd.v info Term.(const main $ Prometheus_unix.opts) in
exit @@ Cmd.eval cmd
4 changes: 2 additions & 2 deletions prometheus-app.opam
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ homepage: "https://github.com/mirage/prometheus"
doc: "https://mirage.github.io/prometheus/"
bug-reports: "https://github.com/mirage/prometheus/issues"
depends: [
"ocaml" {>= "4.02.3"}
"dune" {>= "1.0"}
"ocaml" {>= "4.08"}
"dune" {>= "2.0"}
"prometheus" {= version}
"fmt" {>= "0.8.7"}
"re"
Expand Down
4 changes: 1 addition & 3 deletions prometheus.opam
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ doc: "https://mirage.github.io/prometheus/"
bug-reports: "https://github.com/mirage/prometheus/issues"
depends: [
"ocaml" {>= "4.01.0"}
"dune"
"dune" {>= "2.0"}
"astring"
"asetmap"
"fmt" {>= "0.8.7"}
"re"
"lwt" {>= "2.5.0"}
"alcotest" {with-test}
]
build: [
["dune" "build" "-p" name "-j" jobs]
Expand Down
2 changes: 1 addition & 1 deletion src/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(name prometheus)
(public_name prometheus)
(libraries lwt astring asetmap fmt re))
(libraries lwt astring asetmap re))
8 changes: 4 additions & 4 deletions src/prometheus.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ end
module type NAME = sig
type t = private string
val v : string -> t
val pp : t Fmt.t
val pp : Format.formatter -> t -> unit
val compare : t -> t -> int
end

Expand All @@ -17,12 +17,12 @@ module Name(N : NAME_SPEC) : NAME = struct

let v name =
if not (Re.execp N.valid name) then
failwith (Fmt.str "Invalid name %S" name);
failwith (Format.asprintf "Invalid name %S" name);
name

let compare = String.compare

let pp = Fmt.string
let pp = Format.pp_print_string
end

let alphabet = Re.(alt [ rg 'a' 'z'; rg 'A' 'Z' ])
Expand Down Expand Up @@ -108,7 +108,7 @@ module CollectorRegistry = struct

let register t info collector =
if MetricFamilyMap.mem info t.metrics
then failwith (Fmt.str "%a already registered" MetricName.pp info.MetricInfo.name);
then failwith (Format.asprintf "%a already registered" MetricName.pp info.MetricInfo.name);
t.metrics <- MetricFamilyMap.add info collector t.metrics

let collect t =
Expand Down
2 changes: 1 addition & 1 deletion src/prometheus.mli
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module type NAME = sig
val v : string -> t
(** Raises an exception if the name is not valid. *)

val pp : t Fmt.t
val pp : Format.formatter -> t -> unit

val compare : t -> t -> int
end
Expand Down
13 changes: 3 additions & 10 deletions tests/dune
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
(executables
(names test)
(libraries prometheus prometheus-app alcotest))

(alias
(name runtest)
(test
(name test)
(package prometheus-app)
(deps
(:< test.exe))
(action
(run %{<} -e -v)))
(libraries prometheus prometheus-app alcotest))