diff options
author | 2023-05-09 19:19:48 +0200 | |
---|---|---|
committer | 2023-05-09 18:19:48 +0100 | |
commit | 6392e00653d3b81062ef60d8ae2fa2621873533f (patch) | |
tree | 761d0ff445c2c6a85020cecdc58f92ae1cf78513 /internal/config | |
parent | [bugfix] Don't try to get user when serializing local instance account (#1757) (diff) | |
download | gotosocial-6392e00653d3b81062ef60d8ae2fa2621873533f.tar.xz |
feat: initial tracing support (#1623)
Diffstat (limited to 'internal/config')
-rw-r--r-- | internal/config/config.go | 7 | ||||
-rw-r--r-- | internal/config/defaults.go | 5 | ||||
-rw-r--r-- | internal/config/helpers.gen.go | 100 |
3 files changed, 111 insertions, 1 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index a1570bbaf..b5c228a35 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -126,6 +126,11 @@ type Configuration struct { OIDCLinkExisting bool `name:"oidc-link-existing" usage:"link existing user accounts to OIDC logins based on the stored email value"` OIDCAdminGroups []string `name:"oidc-admin-groups" usage:"Membership of one of the listed groups makes someone a GtS admin"` + TracingEnabled bool `name:"tracing-enabled" usage:"Enable OTLP Tracing"` + TracingTransport string `name:"tracing-transport" usage:"grpc or jaeger"` + TracingEndpoint string `name:"tracing-endpoint" usage:"Endpoint of your trace collector. Eg., 'localhost:4317' for gRPC, 'http://localhost:14268/api/traces' for jaeger"` + TracingInsecureTransport bool `name:"tracing-insecure" usage:"Disable HTTPS for the gRPC transport protocol"` + SMTPHost string `name:"smtp-host" usage:"Host of the smtp server. Eg., 'smtp.eu.mailgun.org'"` SMTPPort int `name:"smtp-port" usage:"Port of the smtp server. Eg., 587"` SMTPUsername string `name:"smtp-username" usage:"Username to authenticate with the smtp server as. Eg., 'postmaster@mail.example.org'"` @@ -153,7 +158,7 @@ type Configuration struct { AdminTransPath string `name:"path" usage:"the path of the file to import from/export to"` AdminMediaPruneDryRun bool `name:"dry-run" usage:"perform a dry run and only log number of items eligible for pruning"` - RequestIDHeader string `name:"request-id-header" usage:"Header to extract the Request ID from. Eg.,'X-Request-Id'"` + RequestIDHeader string `name:"request-id-header" usage:"Header to extract the Request ID from. Eg.,'X-Request-Id'."` } type CacheConfiguration struct { diff --git a/internal/config/defaults.go b/internal/config/defaults.go index 1dc446e4c..54672c159 100644 --- a/internal/config/defaults.go +++ b/internal/config/defaults.go @@ -109,6 +109,11 @@ var Defaults = Configuration{ SMTPFrom: "GoToSocial", SMTPDiscloseRecipients: false, + TracingEnabled: false, + TracingTransport: "grpc", + TracingEndpoint: "", + TracingInsecureTransport: false, + SyslogEnabled: false, SyslogProtocol: "udp", SyslogAddress: "localhost:514", diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go index 236d1ea36..b635f7b8e 100644 --- a/internal/config/helpers.gen.go +++ b/internal/config/helpers.gen.go @@ -1799,6 +1799,106 @@ func GetOIDCAdminGroups() []string { return global.GetOIDCAdminGroups() } // SetOIDCAdminGroups safely sets the value for global configuration 'OIDCAdminGroups' field func SetOIDCAdminGroups(v []string) { global.SetOIDCAdminGroups(v) } +// GetTracingEnabled safely fetches the Configuration value for state's 'TracingEnabled' field +func (st *ConfigState) GetTracingEnabled() (v bool) { + st.mutex.Lock() + v = st.config.TracingEnabled + st.mutex.Unlock() + return +} + +// SetTracingEnabled safely sets the Configuration value for state's 'TracingEnabled' field +func (st *ConfigState) SetTracingEnabled(v bool) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.TracingEnabled = v + st.reloadToViper() +} + +// TracingEnabledFlag returns the flag name for the 'TracingEnabled' field +func TracingEnabledFlag() string { return "tracing-enabled" } + +// GetTracingEnabled safely fetches the value for global configuration 'TracingEnabled' field +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.Lock() + v = st.config.TracingTransport + st.mutex.Unlock() + 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.Lock() + v = st.config.TracingEndpoint + st.mutex.Unlock() + 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.Lock() + v = st.config.TracingInsecureTransport + st.mutex.Unlock() + 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" } + +// 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) } + // GetSMTPHost safely fetches the Configuration value for state's 'SMTPHost' field func (st *ConfigState) GetSMTPHost() (v string) { st.mutex.Lock() |