Sign inSign up

braveokafor/go-hello-world

By braveokafor

•Updated almost 3 years ago

Go "Hello World" application with Prometheus Metrics.

Image
0

521

braveokafor/go-hello-world repository overview

⁠Go Hello World

Build Status Release Status Repo size Image size Docker Pulls

⁠Overview

Introducing the braveokafor/go-hello-world Docker image.
This Go application extends beyond the conventional greeting, integrating Prometheus metrics to provide insights into the operational dynamics of HTTP servers under various conditions.

Grafana Dashboard

⁠Features
  • HTTP Greetings: The application issues a plain text greeting at the root endpoint.
  • Prometheus Metrics: With Prometheus metrics integration, it highlights the total count of HTTP requests, their duration, and the number of in-flight requests.
  • Configurable Delays & Errors: Users have the flexibility to introduce artificial delays and errors into the responses for experimental purposes.
  • Environment-Driven Configuration: The application’s behaviour is customisable through both environment variables and command-line flags.
⁠Endpoints Available
  • / - Greeting message endpoint.
  • /metrics - Endpoint for accessing Prometheus metrics.
  • /healthz - Endpoint providing the application’s health status.
⁠Docker-Compose Deployment & Grafana Dashboards

A docker-compose.yaml file is available in the project repository to facilitate the deployment of the application alongside the necessary monitoring tools.
This configuration allows for an integrated environment where the application’s metrics can be easily visualised and analysed.

Example Grafana dashboards are also provided in the repository, offering a starting point for monitoring the application’s performance and behaviour.

⁠Installation

Download the appropriate binary for your operating system from the GitHub Releases page⁠.

⁠Usage

Run the `go-hello-world`` binary with desired flags, or set the environment variables before starting the utility.

⁠Options

FlagEnvironment VariableDescriptionDefault Value
-portSERVER_PORTPort on which the server runs5000
-min-sleepMIN_SLEEP_MSMin sleep duration in milliseconds to simulate work0
-max-sleepMAX_SLEEP_MSMax sleep duration in milliseconds to simulate work0
-error-rateERROR_RATEError simulation rate0.0
-nameNAMEName to be used in greetingBrave

⁠Examples:

⁠CLI:
# With flags
go-hello-world --error-rate 0.15 --max-sleep 1050 --min-sleep 0 --name Brave --port 5000

# With environment variables
export SERVER_PORT="5000"
export MAX_SLEEP_MS="1050"
export MIN_SLEEP_MS="0"
export ERROR_RATE="0.15"
export NAME="Brave"
go-hello-world
⁠Docker
# With flags
docker run braveokafor/go-hello-world:latest --error-rate 0.15 --max-sleep 1050 --min-sleep 0 --name Brave --port 5000

# With environment variables
docker run -p 5000:5000 -e SERVER_PORT="5000" braveokafor/go-hello-world:latest
⁠Contribution and Support

Issues Issues

While primarily a personal project for learning and usage, suggestions and identified issues are welcomed.
Maintenance may not be continuous, but feedback will be reviewed and addressed as time allows.

⁠Contact & Repository

For additional information, suggestions, or enquiries, please visit the project on GitHub⁠ or connect with me on LinkedIn⁠.

⁠Licence

The project is open-sourced under the MIT Licence, allowing for use, modification, and distribution of the code under the licence’s terms and conditions.

For detailed understanding, refer to the LICENCE⁠ file in the project repository.

Tag summary

Content type

Image

Digest

sha256:73aa18731…

Size

5.9 MB

Last updated

almost 3 years ago

docker pull braveokafor/go-hello-world