Skip to content

Commit

Permalink
improve labels for some process names and types
Browse files Browse the repository at this point in the history
  • Loading branch information
bairhys committed Mar 11, 2024
1 parent bc03c4d commit db5f4a2
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions prometheus_frigate_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,46 @@ def collect(self):

yield detector_inference_speed
yield detector_detection_start

# detector process stats
try:
for detector_name, detector_stats in stats['detectors'].items():
p_pid = str(detector_stats['pid'])
label = [p_pid] # pid label
try:
# new frigate:0.13.0-beta3 stat 'cmdline'
label.append(detector_name) # name label
label.append(detector_name) # process label
label.append('detectors') # type label
label.append(self.process_stats[p_pid]['cmdline']) # cmdline label
add_metric(cpu_usages, label, self.process_stats[p_pid], 'cpu')
add_metric(mem_usages, label, self.process_stats[p_pid], 'mem')
del self.process_stats[p_pid]
except KeyError:
pass

except KeyError:
pass

# other named process stats
try:
for process_name, process_stats in stats['processes'].items():
p_pid = str(process_stats['pid'])
label = [p_pid] # pid label
try:
# new frigate:0.13.0-beta3 stat 'cmdline'
label.append(process_name) # name label
label.append(process_name) # process label
label.append(process_name) # type label
label.append(self.process_stats[p_pid]['cmdline']) # cmdline label
add_metric(cpu_usages, label, self.process_stats[p_pid], 'cpu')
add_metric(mem_usages, label, self.process_stats[p_pid], 'mem')
del self.process_stats[p_pid]
except KeyError:
pass

except KeyError:
pass

# remaining process stats
try:
Expand Down

0 comments on commit db5f4a2

Please sign in to comment.