mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-09 04:17:56 -04:00
Merge pull request #47 from imandra-ai/wip-cleanup-core-library
move protobuf code to opentelemetry.proto
This commit is contained in:
commit
211c328498
81 changed files with 48 additions and 65 deletions
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
|
|
@ -40,12 +40,12 @@ jobs:
|
||||||
|
|
||||||
- run: opam exec -- dune build @install -p opentelemetry,opentelemetry-lwt,opentelemetry-client-ocurl,opentelemetry-cohttp-lwt,opentelemetry-client-cohttp-lwt
|
- run: opam exec -- dune build @install -p opentelemetry,opentelemetry-lwt,opentelemetry-client-ocurl,opentelemetry-cohttp-lwt,opentelemetry-client-cohttp-lwt
|
||||||
|
|
||||||
- run: opam pin ocaml-protoc 2.3 -y
|
- run: opam pin ocaml-protoc 2.4 -y
|
||||||
|
|
||||||
- run: opam exec -- dune build @lint
|
- run: opam exec -- dune build @lint
|
||||||
|
|
||||||
# check that nothing changed
|
# check that nothing changed
|
||||||
- run: git diff --quiet --exit-code
|
- run: git diff --exit-code
|
||||||
|
|
||||||
- run: opam exec -- dune build @runtest
|
- run: opam exec -- dune build @runtest
|
||||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||||
|
|
|
||||||
40
dune-project
40
dune-project
|
|
@ -30,14 +30,6 @@
|
||||||
ambient-context
|
ambient-context
|
||||||
(odoc :with-doc)
|
(odoc :with-doc)
|
||||||
(alcotest :with-test)
|
(alcotest :with-test)
|
||||||
(opentelemetry-client-cohttp-lwt
|
|
||||||
(and
|
|
||||||
:with-test
|
|
||||||
(= :version)))
|
|
||||||
(opentelemetry-client-ocurl
|
|
||||||
(and
|
|
||||||
:with-test
|
|
||||||
(= :version)))
|
|
||||||
(pbrt
|
(pbrt
|
||||||
(>= 2.3))
|
(>= 2.3))
|
||||||
(ocaml-lsp-server :with-dev-setup)
|
(ocaml-lsp-server :with-dev-setup)
|
||||||
|
|
@ -70,15 +62,7 @@
|
||||||
(>= "5.3"))
|
(>= "5.3"))
|
||||||
(lwt_ppx
|
(lwt_ppx
|
||||||
(>= "2.0"))
|
(>= "2.0"))
|
||||||
(alcotest :with-test)
|
(alcotest :with-test))
|
||||||
(opentelemetry-client-cohttp-lwt
|
|
||||||
(and
|
|
||||||
:with-test
|
|
||||||
(= :version)))
|
|
||||||
(opentelemetry-client-ocurl
|
|
||||||
(and
|
|
||||||
:with-test
|
|
||||||
(= :version))))
|
|
||||||
(tags
|
(tags
|
||||||
(instrumentation tracing opentelemetry datadog lwt)))
|
(instrumentation tracing opentelemetry datadog lwt)))
|
||||||
|
|
||||||
|
|
@ -99,11 +83,7 @@
|
||||||
(ezcurl
|
(ezcurl
|
||||||
(>= 0.2.3))
|
(>= 0.2.3))
|
||||||
ocurl
|
ocurl
|
||||||
(alcotest :with-test)
|
(alcotest :with-test))
|
||||||
(opentelemetry-client-cohttp-lwt
|
|
||||||
(and
|
|
||||||
:with-test
|
|
||||||
(= :version))))
|
|
||||||
(synopsis "Collector client for opentelemetry, using http + ezcurl"))
|
(synopsis "Collector client for opentelemetry, using http + ezcurl"))
|
||||||
|
|
||||||
(package
|
(package
|
||||||
|
|
@ -120,15 +100,7 @@
|
||||||
(>= "5.3"))
|
(>= "5.3"))
|
||||||
(cohttp-lwt
|
(cohttp-lwt
|
||||||
(>= "4.0.0"))
|
(>= "4.0.0"))
|
||||||
(alcotest :with-test)
|
(alcotest :with-test))
|
||||||
(opentelemetry-client-cohttp-lwt
|
|
||||||
(and
|
|
||||||
:with-test
|
|
||||||
(= :version)))
|
|
||||||
(opentelemetry-client-ocurl
|
|
||||||
(and
|
|
||||||
:with-test
|
|
||||||
(= :version))))
|
|
||||||
(synopsis "Opentelemetry tracing for Cohttp HTTP servers"))
|
(synopsis "Opentelemetry tracing for Cohttp HTTP servers"))
|
||||||
|
|
||||||
(package
|
(package
|
||||||
|
|
@ -150,9 +122,5 @@
|
||||||
(>= "2.0"))
|
(>= "2.0"))
|
||||||
cohttp-lwt
|
cohttp-lwt
|
||||||
cohttp-lwt-unix
|
cohttp-lwt-unix
|
||||||
(alcotest :with-test)
|
(alcotest :with-test))
|
||||||
(opentelemetry-client-ocurl
|
|
||||||
(and
|
|
||||||
:with-test
|
|
||||||
(= :version))))
|
|
||||||
(synopsis "Collector client for opentelemetry, using cohttp + lwt"))
|
(synopsis "Collector client for opentelemetry, using cohttp + lwt"))
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ depends: [
|
||||||
"cohttp-lwt"
|
"cohttp-lwt"
|
||||||
"cohttp-lwt-unix"
|
"cohttp-lwt-unix"
|
||||||
"alcotest" {with-test}
|
"alcotest" {with-test}
|
||||||
"opentelemetry-client-ocurl" {with-test & = version}
|
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
["dune" "subst"] {dev}
|
["dune" "subst"] {dev}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ depends: [
|
||||||
"ezcurl" {>= "0.2.3"}
|
"ezcurl" {>= "0.2.3"}
|
||||||
"ocurl"
|
"ocurl"
|
||||||
"alcotest" {with-test}
|
"alcotest" {with-test}
|
||||||
"opentelemetry-client-cohttp-lwt" {with-test & = version}
|
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
["dune" "subst"] {dev}
|
["dune" "subst"] {dev}
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@ depends: [
|
||||||
"lwt" {>= "5.3"}
|
"lwt" {>= "5.3"}
|
||||||
"cohttp-lwt" {>= "4.0.0"}
|
"cohttp-lwt" {>= "4.0.0"}
|
||||||
"alcotest" {with-test}
|
"alcotest" {with-test}
|
||||||
"opentelemetry-client-cohttp-lwt" {with-test & = version}
|
|
||||||
"opentelemetry-client-ocurl" {with-test & = version}
|
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
["dune" "subst"] {dev}
|
["dune" "subst"] {dev}
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,6 @@ depends: [
|
||||||
"lwt" {>= "5.3"}
|
"lwt" {>= "5.3"}
|
||||||
"lwt_ppx" {>= "2.0"}
|
"lwt_ppx" {>= "2.0"}
|
||||||
"alcotest" {with-test}
|
"alcotest" {with-test}
|
||||||
"opentelemetry-client-cohttp-lwt" {with-test & = version}
|
|
||||||
"opentelemetry-client-ocurl" {with-test & = version}
|
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
["dune" "subst"] {dev}
|
["dune" "subst"] {dev}
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,6 @@ depends: [
|
||||||
"ambient-context"
|
"ambient-context"
|
||||||
"odoc" {with-doc}
|
"odoc" {with-doc}
|
||||||
"alcotest" {with-test}
|
"alcotest" {with-test}
|
||||||
"opentelemetry-client-cohttp-lwt" {with-test & = version}
|
|
||||||
"opentelemetry-client-ocurl" {with-test & = version}
|
|
||||||
"pbrt" {>= "2.3"}
|
"pbrt" {>= "2.3"}
|
||||||
"ocaml-lsp-server" {with-dev-setup}
|
"ocaml-lsp-server" {with-dev-setup}
|
||||||
"ocamlformat" {with-dev-setup & >= "0.24" & < "0.25"}
|
"ocamlformat" {with-dev-setup & >= "0.24" & < "0.25"}
|
||||||
|
|
|
||||||
7
src/core/dune
Normal file
7
src/core/dune
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
(library
|
||||||
|
(name opentelemetry)
|
||||||
|
(synopsis "API for opentelemetry instrumentation")
|
||||||
|
(flags :standard -warn-error -a+8)
|
||||||
|
(libraries opentelemetry.proto ambient-context ptime ptime.clock.os pbrt threads
|
||||||
|
opentelemetry.atomic)
|
||||||
|
(public_name opentelemetry))
|
||||||
|
|
@ -19,6 +19,8 @@ end
|
||||||
|
|
||||||
This is mostly useful internally. Users should not need to touch it. *)
|
This is mostly useful internally. Users should not need to touch it. *)
|
||||||
module Proto = struct
|
module Proto = struct
|
||||||
|
open Opentelemetry_proto
|
||||||
|
|
||||||
module Common = struct
|
module Common = struct
|
||||||
include Common_types
|
include Common_types
|
||||||
include Common_pp
|
include Common_pp
|
||||||
|
|
@ -887,6 +889,7 @@ end
|
||||||
|
|
||||||
See {{: https://opentelemetry.io/docs/reference/specification/overview/#metric-signal} the spec} *)
|
See {{: https://opentelemetry.io/docs/reference/specification/overview/#metric-signal} the spec} *)
|
||||||
module Metrics = struct
|
module Metrics = struct
|
||||||
|
open Opentelemetry_proto
|
||||||
open Metrics_types
|
open Metrics_types
|
||||||
|
|
||||||
type t = Metrics_types.metric
|
type t = Metrics_types.metric
|
||||||
|
|
@ -989,6 +992,7 @@ end
|
||||||
|
|
||||||
See {{: https://opentelemetry.io/docs/reference/specification/overview/#log-signal} the spec} *)
|
See {{: https://opentelemetry.io/docs/reference/specification/overview/#log-signal} the spec} *)
|
||||||
module Logs = struct
|
module Logs = struct
|
||||||
|
open Opentelemetry_proto
|
||||||
open Logs_types
|
open Logs_types
|
||||||
|
|
||||||
type t = log_record
|
type t = log_record
|
||||||
1
src/proto/.ocamlformat-ignore
Normal file
1
src/proto/.ocamlformat-ignore
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
*
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
(library
|
(library
|
||||||
(name opentelemetry)
|
(name opentelemetry_proto)
|
||||||
(synopsis "API for opentelemetry instrumentation")
|
(public_name opentelemetry.proto)
|
||||||
|
(synopsis "Protobuf generated code for opentelemetry")
|
||||||
(flags :standard -warn-error -a+8)
|
(flags :standard -warn-error -a+8)
|
||||||
(libraries ambient-context ptime ptime.clock.os pbrt threads
|
(libraries pbrt))
|
||||||
opentelemetry.atomic)
|
|
||||||
(public_name opentelemetry))
|
|
||||||
|
|
||||||
; ### protobuf rules ###
|
; ### protobuf rules ###
|
||||||
|
|
||||||
4
tests/cohttp/dune
Normal file
4
tests/cohttp/dune
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
(tests
|
||||||
|
(names test_get_url)
|
||||||
|
(package opentelemetry-client-cohttp-lwt)
|
||||||
|
(libraries opentelemetry opentelemetry-client-cohttp-lwt))
|
||||||
|
|
@ -1,2 +1 @@
|
||||||
ocurl url = http://localhost:3000
|
|
||||||
cohttp url = http://localhost:3000
|
cohttp url = http://localhost:3000
|
||||||
|
|
@ -1,17 +1,9 @@
|
||||||
let url = "http://localhost:3000"
|
let url = "http://localhost:3000"
|
||||||
|
|
||||||
let ocurl () =
|
|
||||||
let config = Opentelemetry_client_ocurl.Config.make ~url () in
|
|
||||||
Opentelemetry_client_ocurl.with_setup ~config () @@ fun () ->
|
|
||||||
let url = Opentelemetry_client_ocurl.get_url () in
|
|
||||||
print_endline @@ Printf.sprintf "ocurl url = %s" url
|
|
||||||
|
|
||||||
let cohttp () =
|
let cohttp () =
|
||||||
let config = Opentelemetry_client_cohttp_lwt.Config.make ~url () in
|
let config = Opentelemetry_client_cohttp_lwt.Config.make ~url () in
|
||||||
Opentelemetry_client_cohttp_lwt.with_setup ~config () @@ fun () ->
|
Opentelemetry_client_cohttp_lwt.with_setup ~config () @@ fun () ->
|
||||||
let url = Opentelemetry_client_cohttp_lwt.get_url () in
|
let url = Opentelemetry_client_cohttp_lwt.get_url () in
|
||||||
print_endline @@ Printf.sprintf "cohttp url = %s" url
|
print_endline @@ Printf.sprintf "cohttp url = %s" url
|
||||||
|
|
||||||
let () =
|
let () = cohttp ()
|
||||||
ocurl ();
|
|
||||||
cohttp ()
|
|
||||||
5
tests/core/dune
Normal file
5
tests/core/dune
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
(tests
|
||||||
|
(names test_trace_context )
|
||||||
|
(package opentelemetry)
|
||||||
|
(libraries opentelemetry))
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
(tests
|
|
||||||
(names test_trace_context test_get_url)
|
|
||||||
(libraries opentelemetry opentelemetry-client-ocurl
|
|
||||||
opentelemetry-client-cohttp-lwt))
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
(tests
|
(tests
|
||||||
(names test_implicit_scope_sync)
|
(names test_implicit_scope_sync)
|
||||||
|
(package opentelemetry-client-cohttp-lwt)
|
||||||
(libraries alcotest opentelemetry opentelemetry-client-cohttp-lwt))
|
(libraries alcotest opentelemetry opentelemetry-client-cohttp-lwt))
|
||||||
|
|
|
||||||
5
tests/ocurl/dune
Normal file
5
tests/ocurl/dune
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
(tests
|
||||||
|
(names test_get_url)
|
||||||
|
(package opentelemetry-client-ocurl)
|
||||||
|
(libraries opentelemetry opentelemetry-client-ocurl))
|
||||||
1
tests/ocurl/test_get_url.expected
Normal file
1
tests/ocurl/test_get_url.expected
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
ocurl url = http://localhost:3000
|
||||||
9
tests/ocurl/test_get_url.ml
Normal file
9
tests/ocurl/test_get_url.ml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
let url = "http://localhost:3000"
|
||||||
|
|
||||||
|
let ocurl () =
|
||||||
|
let config = Opentelemetry_client_ocurl.Config.make ~url () in
|
||||||
|
Opentelemetry_client_ocurl.with_setup ~config () @@ fun () ->
|
||||||
|
let url = Opentelemetry_client_ocurl.get_url () in
|
||||||
|
print_endline @@ Printf.sprintf "ocurl url = %s" url
|
||||||
|
|
||||||
|
let () = ocurl ()
|
||||||
Loading…
Add table
Reference in a new issue