Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fwiedmann/heartbeat

Simple HTTP endpoint with Prometheus metrics
https://github.com/fwiedmann/heartbeat

endpoint golang healthcheck heartbeat metrics prometheus

Last synced: about 23 hours ago
JSON representation

Simple HTTP endpoint with Prometheus metrics

Awesome Lists containing this project

README

        




Heartbeat


Simple HTTP healthcheck endpoint with Prometheus metrics


Latest release
·
Docker Hub
·
Report bug
·
Request feature

![badge](https://action-badges.now.sh/fwiedmann/heartbeat)

## Table of contents

- [Quick start](#quick-start)
- [Avialable flags](#available-flags)
- [Metrics](#metrics)
- [Custom Configuration](#custom-configuration)
- [Options description](#options-description)
- [Build](#build)
- [Copyright and license](#copyright-and-license)

## Quick start

Deploy Heartbeat to your Kubernetes cluster

```bash
kubectl apply -f https://raw.githubusercontent.com/fwiedmann/heartbeat/master/k8s/namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/fwiedmann/heartbeat/master/k8s/configMap.yaml
kubectl apply -f https://raw.githubusercontent.com/fwiedmann/heartbeat/master/k8s/deployment.yaml
```

Run Heartbeat as single Docker container with / without config.yaml

```bash
docker run --rm -d -p 8080:8080 -p 9100:9100 wiedmannfelix/heartbeat:latest

docker run --rm -d -p 8080:8080 -p 9100:9100 -v config.yaml:/code/config.yaml wiedmannfelix/heartbeat:latest
```

Run Heartbeat binary directly on your host

```bash
wget https://github.com/fwiedmann/heartbeat/releases/download/1.0.0/heartbeat

chmod +x heartbeat

./heartbeat &
```

## Available flags

```bash
Usage:
Heartbeat [flags]

Flags:
--config string config file for endpoint configuration (default "./config.yaml")
-h, --help help for Heartbeat
--loglevel string Set loglevel. Default is info (default "info")
```

## Metrics

| Metric | Type | Description |
| --------------------------------------- | ----- | -------------------------------------- |
| heartbeat_version{version=""} | Gauge | Prints the latest version of Heartbeat |
| heartbeat_requester{host="", method=""} | Gauge | Counter of request by each requester |
| heartbeat_total_requests{method=""} | Gauge | Total Number of requests |

## Custom Configuration

Basic config file:

```yaml
heartbeatEndpoint:
port: 8080
path: "/heartbeat"
responseCode: 200
responseMessage: "OK"
metricsEndpoint:
enabled: true
port: 9100
path: "/metrics"
```

### Options description

| Endpoint | Option | Type | Default vaule |
| --------- | ---------------- | ------ | ------------- |
| Heartbeat | path | srting | "/heartbeat" |
| Heartbeat | port | int | 8080 |
| Heartbeat | response message | srting | "OK" |
| Heartbeat | response code | int | 200 |
| Metrics | path | srting | "/metrics" |
| Metrics | port | int | 9100 |
| Metrics | enabled | bool | true |

## Build

```bash
make build

# or
go build -o heartbeat -ldflags "-X main.HeartbeatVersion="
```

## Copyright and license

[MIT License](https://reponame/blob/master/LICENSE).