whoami

command module
v0.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 2 Imported by: 0

README

Whoami

Whoami is an app developed to demo the capabilities of Kubernetes. It provides endpoints to stress-test and get information on the running system.

Screenshot

Preview

Available Endpoints

  • /: the app's landing page only shows the hostname, the list of network interfaces and their IP address and the HTTP request that generated the response. See Environment for how to slightly tweak this page.
  • /cpustress: shows an overview of the CPU usage. You can also send all the CPU threads to maximum load for a chosen amount of time.
  • /memstress: shows an overview of the memory usage. You can also pick a time interval during which the application will continuously perform bite-sized allocations until completely running out of memory (if you picked a high enough interval, otherwise the allocations will stop but the memory won't be reclaimed by the OS until the next run of the garbage collector).
  • /metrics: useful metrics on the Go runtime, provided by Prometheus.
  • /readiness and /healthz: produce a JSON report on the current status of the container. Orchestrators such as Kubernetes can use the HTTP status code returned by these endpoints to manage containers autonomously.
  • /zee, /captainkube, /phippy, /goldie: some cute pictures followed by the system info (as in /).

Environment

  • LOG_INTERVAL: controls how often the app logs CPU and memory usage to the console* (example: 10s for 10 seconds). A non-positive value disables logging entirely;
  • READINESS_DELAY: controls how long it'll take for the app to report itself as ready to handle new incoming requests (15 seconds by default)* (example: 1m for one minute);
  • HEALTH_DELAY: controls how long it'll take for the app to report a healthy status* (example: 20s for seconds);
  • NAME_APPLICATION: you can optionally show an image in the landing page as per by /goldie, /zee, /captainkube, /phippy. Possible values: goldie, zee, captainkube, phippy.

(*) The value of those variables is fed to time.ParseDuration so any value accepted by that function is also accepted by those environment variables.

License

This code is published under the terms of the MIT license. As long as you credit us, you're free to use this code for any purpose you like!

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL