Skip to content
forked from kashalls/kromgo

A go project that exposes your specific prometheus metrics safely.

Notifications You must be signed in to change notification settings

blackjid/kromgo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kromgo

A simple go project that allows you to expose prometheus metrics "safely" to a public source. Uses the official prometheus go api client. Better than exposing a grafana image rendering instance to the WWW.

It allows you to define your own metric names and your own prometheus queries as long as they return a single value at the end. There is config support to allow you to format the response with strings before and after the value.

You can use shields.io and use either the Dynamic JSON Badge or the Endpoint Badge and add dynamic coloring with ranges you set.

Config Example

  • Reads configuration file from /kromgo/config.yaml
  • Requires PROMETHEUS_URL be set in ENV.
  • Optional PORT to change server port.

Performance

Queries take around 5ms ~ 75ms to complete depending on how many breaks my prometheus server takes. This was running on my home-cluster and runs 3 instances, so depending on the query YMMV.

Example Request

Endpoint Response

This format is provided to support Shield.io's Endpoint Badge endpoint.

HTTP GET localhost:8080/query?format=endpoint&metric=node_cpu_usage

{
    "color": "green",
    "label": "node_cpu_usage",
    "message": "17.5",
    "schemaVersion": 1
}

Raw Response

HTTP GET localhost:8080/query?metric=node_cpu_usage

[
    {
        "metric": {},
        "value": [
            1702664619.78,
            "17.5"
        ]
    }
]

🤝 Gratitude and Thanks

Thanks to all of the people at the Home Operations Discord community. Be sure to check it out, its a blast!

About

A go project that exposes your specific prometheus metrics safely.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 88.8%
  • Dockerfile 11.2%