Hello everyone,
I would like to monitor my gitlab docker container with the built in gitlab-monitor and prometheus which is running in another container. I’m particularly interessted in
“git pull/push timings – git_pull_time_milliseconds, git_push_time_milliseconds”
as mentioned here: https://gitlab.com/gitlab-org/gitlab-monitor
gitlab-monitor is up and running after I enabled it in gitlab.rb. I can also verify that I get values from gitlab-monitor. But the git pull/push timings are somehow missing. I dont really understand ruby code but I can see something interesting in git.rb https://gitlab.com/gitlab-org/gitlab-monitor/blob/master/lib/gitlab_monitor/git.rb
class GitProber
def initialize(opts, metrics: PrometheusMetrics.new)
@metrics = metrics
@labels = opts[:labels] || {}
@git = Git.new(opts[:source])
end
def probe_pull
@metrics.add "git_pull_time_milliseconds", (@git.pull.time * 1000).to_i, **@labels
self
end
def probe_push
@metrics.add "git_push_time_milliseconds", (@git.push.time * 1000).to_i, **@labels
self
end
def write_to(target)
target.write(@metrics.to_s)
end
end
and in the gitlab-monitor.yml example here: https://gitlab.com/gitlab-org/gitlab-monitor/blob/master/config/gitlab-monitor.yml.example
# Probes config
probes:
# Each key corresponds to an endpoint, so here metrics are available at http://localhost:9168/git.
# The server will search for a prober using the format `KeyProber`, so here it will be `GitProber`.
# If there's no prober matching the format above, `class_name` key should be provided (see `git_process` below).
git:
# Methods to call on the prober
methods:
- probe_pull
- probe_push
# Options to pass to the prober class initializer
opts:
source: /home/git/repo
git_process: &git_process
class_name: GitProcessProber # `class_name` is redundant here
methods:
- probe_git
opts:
quantiles: true
In my gitlab gitlab-monitor.yml this part
# Each key corresponds to an endpoint, so here metrics are available at http://localhost:9168/git.
# The server will search for a prober using the format `KeyProber`, so here it will be `GitProber`.
# If there's no prober matching the format above, `class_name` key should be provided (see `git_process` below).
git:
# Methods to call on the prober
methods:
- probe_pull
- probe_push
# Options to pass to the prober class initializer
opts:
source: /home/git/repo
is missing. And when I try to add this part it gets deleted everytime I start all the containers with docker-compose on my local machine. I dont know if I even have to add this part here and if thats really the criticals part why I dont get these values but this is as far as I came.
Here is the Gitlab part in the docker-compose.yml file
gitlab:
image: 'gitlab/gitlab-ce:latest'
restart: always
hostname: '0.0.0.0'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://0.0.0.0'
ports:
- "55550:22"
- "55551:80"
- "55552:443"
- "55553:9168"
volumes:
- '/srv/gitlab/config:/etc/gitlab'
- '/srv/gitlab/logs:/var/log/gitlab'
- '/srv/gitlab/data:/var/opt/gitlab'