mirage / prometheus

OCaml library for reporting metrics to a Prometheus server
Apache License 2.0
49 stars 27 forks source link

Can’t integrate with latest MirageOS #16

Closed argent-smith closed 6 years ago

argent-smith commented 6 years ago

Thanks for the great package (I use it in my Unix OCaml apps) but…

I’ve just encountered a dependency hell when tried to integrate Prometheus with recent MirageOS project: P. requires cohttp < 1.0 and cohttp-mirage requires cohttp >= 1.0.0

Is this solvable?

talex5 commented 6 years ago

Try pinning the dev version (opam pin add prometheus-app --dev).

argent-smith commented 6 years ago
#=== ERROR while installing prometheus-app.0.4 ================================#
# opam-version 1.2.2
# os           darwin
# command      jbuilder build -p prometheus-app -j 4
# path         /Users/paul/.opam/rpiterm/build/prometheus-app.0.4
# compiler     4.05.0
# exit-code    1
# env-file     /Users/paul/.opam/rpiterm/build/prometheus-app.0.4/prometheus-app-88781-d12e8f.env
# stdout-file  /Users/paul/.opam/rpiterm/build/prometheus-app.0.4/prometheus-app-88781-d12e8f.out
# stderr-file  /Users/paul/.opam/rpiterm/build/prometheus-app.0.4/prometheus-app-88781-d12e8f.err
### stderr ###
# Error: This variant pattern is expected to have type Prometheus.metric_type
# [...]
#     ocamlopt app/prometheus_app.{cmx,o} (exit 2)
# (cd _build/default && /Users/paul/.opam/rpiterm/bin/ocamlopt.opt -w -40 -w A-4-58 -strict-sequence -safe-string -g -I /Users/paul/.opam/rpiterm/lib/asetmap -I /Users/paul/.opam/rpiterm/lib/astring -I /Users/paul/.opam/rpiterm/lib/base -I /Users/paul/.opam/rpiterm/lib/base/caml -I /Users/paul/.opam/rpiterm/lib/base/shadow_stdlib -I /Users/paul/.opam/rpiterm/lib/base64 -I /Users/paul/.opam/rpiterm/lib/bytes -I /Users/paul/.opam/rpiterm/lib/cohttp -I /Users/paul/.opam/rpiterm/lib/cohttp-lwt -I /Users/paul/.opam/rpiterm/lib/fieldslib -I /Users/paul/.opam/rpiterm/lib/fmt -I /Users/paul/.opam/rpiterm/lib/lwt -I /Users/paul/.opam/rpiterm/lib/ocaml -I /Users/paul/.opam/rpiterm/lib/prometheus -I /Users/paul/.opam/rpiterm/lib/re -I /Users/paul/.opam/rpiterm/lib/result -I /Users/paul/.opam/rpiterm/lib/sexplib -I /Users/paul/.opam/rpiterm/lib/sexplib/0 -I /Users/paul/.opam/rpiterm/lib/stringext -I /Users/paul/.opam/rpiterm/lib/uchar -I /Users/paul/.opam/rpiterm/lib/uri -no-alias-deps -I app -o app/prometheus_app.cmx -c -impl app/prometheus_app.ml)
# File "app/prometheus_app.ml", line 21, characters 6-15:
# Error: This variant pattern is expected to have type Prometheus.metric_type
#        The constructor Histogram does not belong to type Prometheus.metric_type
#       ocamlc app/prometheus_unix.{cmo,cmt} (exit 2)
# (cd _build/default && /Users/paul/.opam/rpiterm/bin/ocamlc.opt -w -40 -w A-4-58 -strict-sequence -safe-string -g -bin-annot -I /Users/paul/.opam/rpiterm/lib/asetmap -I /Users/paul/.opam/rpiterm/lib/astring -I /Users/paul/.opam/rpiterm/lib/base -I /Users/paul/.opam/rpiterm/lib/base/caml -I /Users/paul/.opam/rpiterm/lib/base/shadow_stdlib -I /Users/paul/.opam/rpiterm/lib/base64 -I /Users/paul/.opam/rpiterm/lib/bytes -I /Users/paul/.opam/rpiterm/lib/cmdliner -I /Users/paul/.opam/rpiterm/lib/cohttp -I /Users/paul/.opam/rpiterm/lib/cohttp-lwt -I /Users/paul/.opam/rpiterm/lib/cohttp-lwt-unix -I /Users/paul/.opam/rpiterm/lib/conduit -I /Users/paul/.opam/rpiterm/lib/conduit-lwt -I /Users/paul/.opam/rpiterm/lib/conduit-lwt-unix -I /Users/paul/.opam/rpiterm/lib/fieldslib -I /Users/paul/.opam/rpiterm/lib/fmt -I /Users/paul/.opam/rpiterm/lib/ipaddr -I /Users/paul/.opam/rpiterm/lib/ipaddr/unix -I /Users/paul/.opam/rpiterm/lib/logs -I /Users/paul/.opam/rpiterm/lib/lwt -I /Users/paul/.opam/rpiterm/lib/magic-mime -I /Users/paul/.opam/rpiterm/lib/ocaml -I /Users/paul/.opam/rpiterm/lib/prometheus -I /Users/paul/.opam/rpiterm/lib/re -I /Users/paul/.opam/rpiterm/lib/result -I /Users/paul/.opam/rpiterm/lib/sexplib -I /Users/paul/.opam/rpiterm/lib/sexplib/0 -I /Users/paul/.opam/rpiterm/lib/stringext -I /Users/paul/.opam/rpiterm/lib/uchar -I /Users/paul/.opam/rpiterm/lib/uri -I /Users/paul/.opam/rpiterm/lib/uri/services -I app -no-alias-deps -I app -o app/prometheus_unix.cmo -c -impl app/prometheus_unix.ml)
# File "app/prometheus_unix.ml", line 16, characters 32-49:
# Error: Unbound module Sample_set
talex5 commented 6 years ago

Ah, you might need to pin prometheus itself too.

argent-smith commented 6 years ago

Pinned prometheus as well, nevermind

argent-smith commented 6 years ago

Now it compiles, thank you.

argent-smith commented 6 years ago

Everything works perfectly, at least in my unikernel ;) Thanks again for a great library! 🥇

talex5 commented 6 years ago

Good :-) I'm made a new release, and it's in opam now, so you should be able to remote the pins again.

argent-smith commented 6 years ago

I did. Thanks!