This repository holds a Golang prometheus exporter based on the Habanalabs ML library.
Note requires access to the lamatriz dockerhub org
********
go-hlml and habana-metric exporter should reside in the same directory !!!
********
$ docker run -it --privileged --network=host -v /dev:/dev habana-metric-exporter:0.6.1 --port <PORT_NUMBER> (default port number 41611)
# In other window
$ curl localhost:41611/metrics
- Install Docker v20+
-
Clone metric-exporter repo and move to the dev branch
git clone --recursive https://github.com/habanaai/metric-exporter.gitcd metric-exportergit checkout dev
-
Modify metric-exporter/scripts/setup-env.sh to contain your github token and your installed Golang version.
#!/usr/bin/env bash set -eu export SYNAPSE_VERSION="1.1.0" # Replace this value with your desired Synapse version export SYNAPSE_BUILD="614" # Replace this value with your desired Synapse build number export SYNAPSE_DIST="ubuntu18.04" # Replace this with your desired dist version export GITHUB_BRANCH="dev" # Replace this value with your desired metric-exporter branch export GITHUB_TOKEN=${GITHUB_TOKEN:-""} # Add your key here export GOHLML_BRANCH="dev" # Replace this value with your desired gohlml branch export DOCKER_IMG_NAME="habanaai/metric-exporter" export DOCKER_IMG_TAG="0.6.1" # This is the user defined tag for the generated container export GO_VERSION="1.17.3" # Replace with version of Golang currently installed on host -
Build gohlml module
go env -w GOPRIVATE=github.com/habanaaiGO111MODULE=on go get github.com/habanaai/gohlml@devGO111MODULE=on go build -mod=readonly
-
Build docker image
cd build/dockerbash docker-build.sh local # build using a local copybash docker-build.sh remote # build using a copy from github
The kubernetes daemonset is setup to run in the monitoring namespace. To run the daemonset, service and serviceMonitor you can run:
cd go
kubectl apply -f manifests
Note that the Prometheus-operator must be configured with the correct namespaces or else metrics from other namespaces won't be collected. Note the kube-prometheus in La Matriz github properly has the habana namespace set