Skip to content

Metrics

Opengist offers built-in support for Prometheus metrics to help you monitor the performance and usage of your instance. These metrics provide insights into application health, user activity, and database statistics.

Enabling metrics

By default, the metrics server is disabled for security and performance reasons. To enable it, update your configuration as stated in the configuration cheat sheet:

yaml
metrics.enabled: true

Alternatively, you can use the environment variable:

bash
OG_METRICS_ENABLED=true

Once enabled, metrics are available on a separate server at http://0.0.0.0:6158/metrics by default.

Configuration

The metrics server runs on a separate port from the main application. By default, it binds to 0.0.0.0 (all interfaces) on port 6158.

Config KeyEnvironment VariableDefaultDescription
metrics.enabledOG_METRICS_ENABLEDfalseEnable or disable the metrics server
metrics.hostOG_METRICS_HOST0.0.0.0The host on which the metrics server binds
metrics.portOG_METRICS_PORT6158The port on which the metrics server listens

Example configuration:

yaml
metrics.enabled: true
metrics.host: 0.0.0.0
metrics.port: 6158

Available metrics

Opengist-specific metrics

Metric NameTypeDescription
opengist_users_totalGaugeTotal number of registered users
opengist_gists_totalGaugeTotal number of gists in the system
opengist_ssh_keys_totalGaugeTotal number of SSH keys added by users

Standard HTTP metrics

In addition to the Opengist-specific metrics, standard Prometheus HTTP metrics are also available through the Echo Prometheus middleware. These include request durations, request counts, and request/response sizes.

These standard metrics follow the Prometheus naming convention and include labels for HTTP method, status code, and handler path.

Security Considerations

The metrics server binds to 0.0.0.0 by default, making it accessible on all network interfaces. This default works well for containerized deployments (Docker, Kubernetes) where network isolation is handled at the infrastructure level.

For bare-metal or VM deployments where the metrics port may be exposed, consider restricting to localhost by setting metrics.host: 127.0.0.1 to only allow local access.