nlewo / comin

GitOps For NixOS Machines
MIT License
241 stars 11 forks source link

Add Prometheus exporter #22

Closed nlewo closed 3 months ago

nlewo commented 3 months ago

It listen on 4243 and exported metrics looks like:

curl localhost:4243/metrics
# HELP comin_deployement_info Info of the last deployement.
# TYPE comin_deployement_info gauge
comin_deployement_info{commit_id="04f98665dd81f176bb3db48b47633a876909149b",status="done"} 1
# HELP comin_fetch_count Number of fetches per status
# TYPE comin_fetch_count counter
comin_fetch_count{remote_name="local",status="succeeded"} 809
comin_fetch_count{remote_name="origin",status="succeeded"} 29
zowoq commented 3 months ago

Thank you for implementing this. We don't need to change any of the exporter settings so we see an error with our config?

error: The option `services.comin.exporter' is used but not defined.
  services.comin = {
    enable = true;
    remotes = [
      {
        url = "https://github.com/nix-community/infra.git";
        name = "origin";
        poller.period = 300; # every 5 minutes
        branches.main.name = "master";
        branches.testing.name = ""; # disable testing branch
      }
    ];
  };
zowoq commented 3 months ago

I've checked that the exporter works, thank you!