mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Initial Prometheus metrics implementation (#2334)
* feat: Initial OTEL metrics * docs: add metrics documentation * fix: metrics endpoint conditional check * feat: metrics endpoint basic auth * fix: make metrics-auth-enabled default false * fix: go fmt helpers.gen.go * fix: add metric-related env vars to envparsing.sh * fix: metrics docs * fix: metrics related stuff in envparsing.sh * fix: metrics docs * chore: metrics docs wording * fix: metrics stuff in envparsing? * bump otel versions --------- Co-authored-by: Tsuribori <user@acertaindebian> Co-authored-by: Tsuribori <none@example.org> Co-authored-by: tsmethurst <tobi.smethurst@protonmail.com>
This commit is contained in:
@@ -14,3 +14,4 @@ We consider these topics advanced because applying them incorrectly does have th
|
||||
* [Process sandboxing](security/sandboxing.md)
|
||||
* [Firewall configuration](security/firewall.md)
|
||||
* [Tracing](tracing.md)
|
||||
* [Metrics](metrics.md)
|
||||
|
37
docs/advanced/metrics.md
Normal file
37
docs/advanced/metrics.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Metrics
|
||||
|
||||
GoToSocial comes with [OpenTelemetry][otel] based metrics built-in with pull-style Prometheus exporter. Currently the following metrics are collected:
|
||||
|
||||
* Go performance and runtime metrics
|
||||
* Gin (HTTP) metrics
|
||||
* Bun (database) metrics
|
||||
|
||||
How to configure metrics is explained in the [Observability configuration reference][obs].
|
||||
|
||||
For a quickstart, add the following to your GoToSocial configuration and restart your instance:
|
||||
|
||||
```yaml
|
||||
metrics-enabled: true
|
||||
metrics-auth-enabled: true
|
||||
metrics-auth-username: some_username
|
||||
metrics-auth-password: some_password
|
||||
```
|
||||
|
||||
This will expose the metrics under the endpoint `/metrics`, protected with HTTP Basic Authentication.
|
||||
|
||||
A following is an example how to configure a job for collecting the metrics in Prometheus `scrape_configs`:
|
||||
|
||||
```yaml
|
||||
- job_name: gotosocial
|
||||
metrics_path: /metrics
|
||||
scheme: https
|
||||
basic_auth:
|
||||
username: some_username
|
||||
password: some_password
|
||||
static_configs:
|
||||
- targets:
|
||||
- example.org
|
||||
```
|
||||
|
||||
[otel]: https://opentelemetry.io/
|
||||
[obs]: ../configuration/observability.md
|
Reference in New Issue
Block a user