Skip to content

Commit

Permalink
Adds docs for the overseer API
Browse files Browse the repository at this point in the history
  • Loading branch information
robacarp committed Jan 1, 2025
1 parent cec82db commit c03b9a0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mosquito/api/overseer.cr
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
module Mosquito
# A utility for inspecting the state of Mosquito Overseers.
class Api::Overseer
# The instance ID of the overseer being inspected.
getter :instance_id
private getter :metadata

# Creates a new Api::Overseer by its instance ID.
def initialize(@instance_id : String)
@metadata = Metadata.new Observability::Overseer.metadata_key(@instance_id), readonly: true
end

# Retrieves a list of all overseers in the backend.
def self.all : Array(self)
Mosquito.backend.list_overseers.map do |id|
new id
end
end

# Retrieves a list of executors managed by this overseer.
def executors : Array(Executor)
if executor_list = @metadata["executors"]?
executor_list.split(",").map do |name|
Expand All @@ -23,6 +28,7 @@ module Mosquito
end
end

# The time the overseer last sent a heartbeat.
def last_heartbeat : Time?
metadata.heartbeat?
end
Expand Down

0 comments on commit c03b9a0

Please sign in to comment.