[chore] Simplify the OTEL setup (#4110)

# Description

This simplifies our OTEL setup by:

* Getting rid of some deprecated things.
* Using `autoexport` and letting things get configured by the `OTEL_` environment variables.
* Removing all the unnecessary config options.

## Checklist

Please put an x inside each checkbox to indicate that you've read and followed it: `[ ]` -> `[x]`

If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).

- [x] I/we have read the [GoToSocial contribution guidelines](https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CONTRIBUTING.md).
- [x] I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
- [x] I/we have not leveraged AI to create the proposed changes.
- [x] I/we have performed a self-review of added code.
- [x] I/we have written code that is legible and maintainable by others.
- [ ] I/we have commented the added code, particularly in hard-to-understand areas.
- [x] I/we have made any necessary changes to documentation.
- [ ] I/we have added tests that cover new code.
- [x] I/we have run tests and they pass locally with the changes.
- [x] I/we have run `go fmt ./...` and `golangci-lint run`.

Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4110
Reviewed-by: tobi <kipvandenbos@noreply.codeberg.org>
Co-authored-by: Daenney <daenney@noreply.codeberg.org>
Co-committed-by: Daenney <daenney@noreply.codeberg.org>
This commit is contained in:
Daenney
2025-05-05 16:22:45 +00:00
committed by tobi
parent ad71066973
commit ecbdc4227b
145 changed files with 21740 additions and 1319 deletions

View File

@@ -2306,81 +2306,6 @@ func GetTracingEnabled() bool { return global.GetTracingEnabled() }
// SetTracingEnabled safely sets the value for global configuration 'TracingEnabled' field
func SetTracingEnabled(v bool) { global.SetTracingEnabled(v) }
// GetTracingTransport safely fetches the Configuration value for state's 'TracingTransport' field
func (st *ConfigState) GetTracingTransport() (v string) {
st.mutex.RLock()
v = st.config.TracingTransport
st.mutex.RUnlock()
return
}
// SetTracingTransport safely sets the Configuration value for state's 'TracingTransport' field
func (st *ConfigState) SetTracingTransport(v string) {
st.mutex.Lock()
defer st.mutex.Unlock()
st.config.TracingTransport = v
st.reloadToViper()
}
// TracingTransportFlag returns the flag name for the 'TracingTransport' field
func TracingTransportFlag() string { return "tracing-transport" }
// GetTracingTransport safely fetches the value for global configuration 'TracingTransport' field
func GetTracingTransport() string { return global.GetTracingTransport() }
// SetTracingTransport safely sets the value for global configuration 'TracingTransport' field
func SetTracingTransport(v string) { global.SetTracingTransport(v) }
// GetTracingEndpoint safely fetches the Configuration value for state's 'TracingEndpoint' field
func (st *ConfigState) GetTracingEndpoint() (v string) {
st.mutex.RLock()
v = st.config.TracingEndpoint
st.mutex.RUnlock()
return
}
// SetTracingEndpoint safely sets the Configuration value for state's 'TracingEndpoint' field
func (st *ConfigState) SetTracingEndpoint(v string) {
st.mutex.Lock()
defer st.mutex.Unlock()
st.config.TracingEndpoint = v
st.reloadToViper()
}
// TracingEndpointFlag returns the flag name for the 'TracingEndpoint' field
func TracingEndpointFlag() string { return "tracing-endpoint" }
// GetTracingEndpoint safely fetches the value for global configuration 'TracingEndpoint' field
func GetTracingEndpoint() string { return global.GetTracingEndpoint() }
// SetTracingEndpoint safely sets the value for global configuration 'TracingEndpoint' field
func SetTracingEndpoint(v string) { global.SetTracingEndpoint(v) }
// GetTracingInsecureTransport safely fetches the Configuration value for state's 'TracingInsecureTransport' field
func (st *ConfigState) GetTracingInsecureTransport() (v bool) {
st.mutex.RLock()
v = st.config.TracingInsecureTransport
st.mutex.RUnlock()
return
}
// SetTracingInsecureTransport safely sets the Configuration value for state's 'TracingInsecureTransport' field
func (st *ConfigState) SetTracingInsecureTransport(v bool) {
st.mutex.Lock()
defer st.mutex.Unlock()
st.config.TracingInsecureTransport = v
st.reloadToViper()
}
// TracingInsecureTransportFlag returns the flag name for the 'TracingInsecureTransport' field
func TracingInsecureTransportFlag() string { return "tracing-insecure-transport" }
// GetTracingInsecureTransport safely fetches the value for global configuration 'TracingInsecureTransport' field
func GetTracingInsecureTransport() bool { return global.GetTracingInsecureTransport() }
// SetTracingInsecureTransport safely sets the value for global configuration 'TracingInsecureTransport' field
func SetTracingInsecureTransport(v bool) { global.SetTracingInsecureTransport(v) }
// GetMetricsEnabled safely fetches the Configuration value for state's 'MetricsEnabled' field
func (st *ConfigState) GetMetricsEnabled() (v bool) {
st.mutex.RLock()
@@ -2406,81 +2331,6 @@ func GetMetricsEnabled() bool { return global.GetMetricsEnabled() }
// SetMetricsEnabled safely sets the value for global configuration 'MetricsEnabled' field
func SetMetricsEnabled(v bool) { global.SetMetricsEnabled(v) }
// GetMetricsAuthEnabled safely fetches the Configuration value for state's 'MetricsAuthEnabled' field
func (st *ConfigState) GetMetricsAuthEnabled() (v bool) {
st.mutex.RLock()
v = st.config.MetricsAuthEnabled
st.mutex.RUnlock()
return
}
// SetMetricsAuthEnabled safely sets the Configuration value for state's 'MetricsAuthEnabled' field
func (st *ConfigState) SetMetricsAuthEnabled(v bool) {
st.mutex.Lock()
defer st.mutex.Unlock()
st.config.MetricsAuthEnabled = v
st.reloadToViper()
}
// MetricsAuthEnabledFlag returns the flag name for the 'MetricsAuthEnabled' field
func MetricsAuthEnabledFlag() string { return "metrics-auth-enabled" }
// GetMetricsAuthEnabled safely fetches the value for global configuration 'MetricsAuthEnabled' field
func GetMetricsAuthEnabled() bool { return global.GetMetricsAuthEnabled() }
// SetMetricsAuthEnabled safely sets the value for global configuration 'MetricsAuthEnabled' field
func SetMetricsAuthEnabled(v bool) { global.SetMetricsAuthEnabled(v) }
// GetMetricsAuthUsername safely fetches the Configuration value for state's 'MetricsAuthUsername' field
func (st *ConfigState) GetMetricsAuthUsername() (v string) {
st.mutex.RLock()
v = st.config.MetricsAuthUsername
st.mutex.RUnlock()
return
}
// SetMetricsAuthUsername safely sets the Configuration value for state's 'MetricsAuthUsername' field
func (st *ConfigState) SetMetricsAuthUsername(v string) {
st.mutex.Lock()
defer st.mutex.Unlock()
st.config.MetricsAuthUsername = v
st.reloadToViper()
}
// MetricsAuthUsernameFlag returns the flag name for the 'MetricsAuthUsername' field
func MetricsAuthUsernameFlag() string { return "metrics-auth-username" }
// GetMetricsAuthUsername safely fetches the value for global configuration 'MetricsAuthUsername' field
func GetMetricsAuthUsername() string { return global.GetMetricsAuthUsername() }
// SetMetricsAuthUsername safely sets the value for global configuration 'MetricsAuthUsername' field
func SetMetricsAuthUsername(v string) { global.SetMetricsAuthUsername(v) }
// GetMetricsAuthPassword safely fetches the Configuration value for state's 'MetricsAuthPassword' field
func (st *ConfigState) GetMetricsAuthPassword() (v string) {
st.mutex.RLock()
v = st.config.MetricsAuthPassword
st.mutex.RUnlock()
return
}
// SetMetricsAuthPassword safely sets the Configuration value for state's 'MetricsAuthPassword' field
func (st *ConfigState) SetMetricsAuthPassword(v string) {
st.mutex.Lock()
defer st.mutex.Unlock()
st.config.MetricsAuthPassword = v
st.reloadToViper()
}
// MetricsAuthPasswordFlag returns the flag name for the 'MetricsAuthPassword' field
func MetricsAuthPasswordFlag() string { return "metrics-auth-password" }
// GetMetricsAuthPassword safely fetches the value for global configuration 'MetricsAuthPassword' field
func GetMetricsAuthPassword() string { return global.GetMetricsAuthPassword() }
// SetMetricsAuthPassword safely sets the value for global configuration 'MetricsAuthPassword' field
func SetMetricsAuthPassword(v string) { global.SetMetricsAuthPassword(v) }
// GetSMTPHost safely fetches the Configuration value for state's 'SMTPHost' field
func (st *ConfigState) GetSMTPHost() (v string) {
st.mutex.RLock()