mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-09 12:23:32 -04:00
chore: Dockerfile; simple pod.yaml; otelcol config
This commit is contained in:
parent
7e48c7521e
commit
3de749044b
6 changed files with 92 additions and 0 deletions
3
.dockerignore
Normal file
3
.dockerignore
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.git
|
||||
_opam
|
||||
_build
|
||||
21
resources/Dockerfile
Normal file
21
resources/Dockerfile
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
FROM ocaml/opam:debian-10-ocaml-4.12 AS build
|
||||
WORKDIR /home/opam/ocaml-opentelemetry
|
||||
RUN sudo apt-get update && sudo apt-get install pkg-config libcurl4-gnutls-dev -y
|
||||
COPY ./opentelemetry-client-ocurl.opam ./
|
||||
COPY ./opentelemetry-lwt.opam ./
|
||||
COPY ./opentelemetry.opam ./
|
||||
RUN opam update && opam install . --deps-only -y
|
||||
COPY ./dune ./dune
|
||||
COPY ./dune-project ./dune-project
|
||||
COPY ./emit1.sh ./emit1.sh
|
||||
COPY ./src ./src
|
||||
COPY ./tests ./tests
|
||||
COPY ./vendor/atomic ./vendor/atomic
|
||||
COPY ./vendor/opentelemetry-proto/opentelemetry/proto ./vendor/opentelemetry-proto/opentelemetry/proto
|
||||
RUN opam exec -- dune build @all --profile=release
|
||||
CMD ["./emit1.sh"]
|
||||
|
||||
FROM debian:10 as run
|
||||
RUN apt-get update && apt-get install libcurl4-gnutls-dev -y
|
||||
COPY --from=build /home/opam/ocaml-opentelemetry/_build/default/tests/emit1.exe /emit1.exe
|
||||
ENTRYPOINT ["/emit1.exe"]
|
||||
15
resources/Makefile
Normal file
15
resources/Makefile
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
tag=ocaml-otel-test:latest
|
||||
|
||||
docker-build:
|
||||
sudo docker buildx build .. -f ./Dockerfile --tag $(tag)
|
||||
|
||||
docker-push:
|
||||
sudo docker push $(tag)
|
||||
|
||||
kubectl-apply:
|
||||
kubectl apply -f emit-test-pod.yaml
|
||||
|
||||
kubectl-delete:
|
||||
kubectl delete -f emit-test-pod.yaml
|
||||
|
||||
all: docker-build docker-push kubectl-delete kubectl-apply
|
||||
19
resources/emit-test-pod.yaml
Normal file
19
resources/emit-test-pod.yaml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: ocaml-otel-test
|
||||
spec:
|
||||
containers:
|
||||
- name: emit
|
||||
image: ocaml-otel-test:latest
|
||||
env:
|
||||
- name: HOST_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.hostIP
|
||||
# This is picked up by the opentelemetry sdks
|
||||
- name: OTEL_EXPORTER_OTLP_ENDPOINT
|
||||
value: "http://$(HOST_IP):4318"
|
||||
- name: OTEL_RESOURCE_ATTRIBUTES
|
||||
value: "service.name=t1,service.version=1,deployment.environment=poc"
|
||||
|
||||
31
resources/otelcol.yaml
Normal file
31
resources/otelcol.yaml
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
|
||||
processors:
|
||||
batch:
|
||||
timeout: 10s
|
||||
resourcedetection:
|
||||
detectors: [gce, system]
|
||||
|
||||
exporters:
|
||||
logging:
|
||||
loglevel: debug
|
||||
sampling_initial: 5
|
||||
sampling_thereafter: 10
|
||||
|
||||
|
||||
service:
|
||||
telemetry:
|
||||
logs:
|
||||
level: debug
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch, resourcedetection]
|
||||
exporters: [logging]
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch, resourcedetection]
|
||||
exporters: [logging]
|
||||
|
|
@ -6,6 +6,9 @@ let (let@) f x = f x
|
|||
let sleep_inner = ref 0.1
|
||||
let sleep_outer = ref 2.0
|
||||
|
||||
let () = Sys.set_signal Sys.sigint (Sys.Signal_handle (fun _ -> exit 0))
|
||||
|
||||
|
||||
let run () =
|
||||
Printf.printf "collector is on %S\n%!" (Opentelemetry_client_ocurl.get_url());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue