Skip to content

Commit

Permalink
Merge branch 'fix-restart-loop' into 'main'
Browse files Browse the repository at this point in the history
Add debug for bad unhandled image name

See merge request ix.ai/cioban!95
  • Loading branch information
tlex committed Jun 20, 2024
2 parents 68980b5 + 04baeff commit ddc8b67
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion cioban/cioban.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,22 @@ def get_services(self):
# this will allow us to set a metric `service_info`
for service in self.docker.services.list():
image = service.attrs['Spec']['TaskTemplate']['ContainerSpec']['Image'].split('@sha256:')
prometheus.PROM_SVC_INFO.labels(service.name,service.id,service.short_id,image[0],image[1]).set(1)
try:
prometheus.PROM_SVC_INFO.labels(
name=service.name,
id=service.id,
short_id=service.short_id,
image_name=image[0],
image_sha256=image[1]
).set(1)
except IndexError:
prometheus.PROM_SVC_INFO.labels(
name=service.name,
id=service.id,
short_id=service.short_id,
image_name=image[0],
image_sha256='N/A'
).set(1)

services = self.docker.services.list(filters=self.settings['filter_services'])
for blacklist_service in self.settings['blacklist_services']:
Expand Down

0 comments on commit ddc8b67

Please sign in to comment.