Compare commits

..

No commits in common. "2c52df1fae92c3e0eedcee3a4f507d99ccb1d62f" and "54dc4d0ef7d52938f10cb892c76be8b6fb518e7c" have entirely different histories.

11 changed files with 42 additions and 24 deletions

3
.gitignore vendored
View file

@ -7,3 +7,6 @@ _opam
*.install
*.exe
*.tmp
src/lib/version.ml
src/lib/.git_index_path
src/lib/.git_index.lnk

View file

@ -1,10 +0,0 @@
repos:
- repo: local
hooks:
- id: ocamlformat
name: ocamlformat check
entry: make format-check
language: system
files: \.(ml|mli)$
pass_filenames: false
stages: [pre-push]

View file

@ -29,9 +29,6 @@ format:
format-check:
@dune build $(DUNE_OPTS) @fmt --display=quiet
setup-githooks:
uvx pre-commit install --hook-type pre-push
WATCH ?= @all
watch:
@dune build $(WATCH) -w $(OPTS)

View file

@ -49,8 +49,7 @@
(>= 0.27)
(< 0.28)))
(mtime
(>= "1.4"))
dune-build-info)
(>= "1.4")))
(depopts atomic trace thread-local-storage lwt eio picos)
(conflicts
(trace

View file

@ -26,7 +26,6 @@ depends: [
"ocaml-lsp-server" {with-dev-setup}
"ocamlformat" {with-dev-setup & >= "0.27" & < "0.28"}
"mtime" {>= "1.4"}
"dune-build-info"
]
depopts: ["atomic" "trace" "thread-local-storage" "lwt" "eio" "picos"]
conflicts: [

View file

@ -1,3 +1,26 @@
(rule
(target .git_index_path)
(deps (universe) gen_git_index_path.sh)
(action
(with-stdout-to
.git_index_path
(run sh gen_git_index_path.sh))))
(rule
(target .git_index.lnk)
(action
(run ln -sf %{read-lines:.git_index_path} %{target})))
(rule
(target version.ml)
(deps
(file .git_index.lnk)
gen_version.sh)
(action
(with-stdout-to
version.ml
(run sh gen_version.sh))))
(library
(name opentelemetry)
(public_name opentelemetry)
@ -21,7 +44,6 @@
(re_export opentelemetry.ambient-context)
(re_export opentelemetry.atomic)
(re_export hmap)
(re_export dune-build-info)
mtime
mtime.clock.os
pbrt

View file

@ -0,0 +1,2 @@
#!/bin/sh
git rev-parse --git-path index 2>/dev/null || echo /dev/null

6
src/lib/gen_version.sh Normal file
View file

@ -0,0 +1,6 @@
#!/bin/sh
v=$(git describe --exact-match HEAD 2>/dev/null | sed 's/^v//')
[ -z "$v" ] && v=dev
h=$(git rev-parse HEAD 2>/dev/null)
[ -z "$h" ] && h=unknown
printf 'let version = "%s"\nlet git_hash = "%s"\n' "$v" "$h"

View file

@ -21,7 +21,7 @@ let service_instance_id = ref None
let service_version = ref None
(** @since NEXT_RELEASE *)
let sdk_version : string = Version.version
let sdk_version : string = Version.(spf "%s at %s" version git_hash)
let instrumentation_library =
make_instrumentation_scope ~version:sdk_version ~name:"opentelemetry" ()

View file

@ -1,4 +0,0 @@
let version =
match Build_info.V1.version () with
| None -> "dev"
| Some v -> Build_info.V1.Version.to_string v

View file

@ -1,3 +1,7 @@
val version : string
(** Version of the library, e.g. ["0.12"]. ["dev"] if not built from a release.
*)
(** Version of the library, e.g. ["0.12"]. ["dev"] if not built from a release
tag. *)
val git_hash : string
(** Full git commit hash at build time, e.g. ["b92159c1..."]. ["unknown"] if git
was unavailable. *)