add debug to userlog
Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
Enhancement: Add debug server to userlog
|
||||||
|
|
||||||
|
We added a debug server to userlog.
|
||||||
|
|
||||||
|
https://github.com/owncloud/ocis/pull/6202
|
||||||
|
https://github.com/owncloud/ocis/issues/5002
|
||||||
@@ -52,7 +52,7 @@ We also suggest to use the last port in your extensions' range as a debug/metric
|
|||||||
| 9195-9199 | FREE |
|
| 9195-9199 | FREE |
|
||||||
| 9200-9204 | [proxy]({{< ref "../proxy/_index.md" >}}) |
|
| 9200-9204 | [proxy]({{< ref "../proxy/_index.md" >}}) |
|
||||||
| 9205-9209 | [proxy]({{< ref "../proxy/_index.md" >}}) |
|
| 9205-9209 | [proxy]({{< ref "../proxy/_index.md" >}}) |
|
||||||
| 9210-9214 | FREE |
|
| 9210-9214 | [userlog]{{< ref "../userlog/_index.md" >}} |
|
||||||
| 9215-9219 | [storage-system]({{< ref "../storage-system/_index.md" >}}) |
|
| 9215-9219 | [storage-system]({{< ref "../storage-system/_index.md" >}}) |
|
||||||
| 9220-9224 | [search]({{< ref "../search/_index.md" >}}) |
|
| 9220-9224 | [search]({{< ref "../search/_index.md" >}}) |
|
||||||
| 9225-9229 | FREE |
|
| 9225-9229 | FREE |
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import (
|
|||||||
"github.com/cs3org/reva/v2/pkg/store"
|
"github.com/cs3org/reva/v2/pkg/store"
|
||||||
"github.com/oklog/run"
|
"github.com/oklog/run"
|
||||||
"github.com/owncloud/ocis/v2/ocis-pkg/config/configlog"
|
"github.com/owncloud/ocis/v2/ocis-pkg/config/configlog"
|
||||||
|
"github.com/owncloud/ocis/v2/ocis-pkg/handlers"
|
||||||
|
"github.com/owncloud/ocis/v2/ocis-pkg/service/debug"
|
||||||
ogrpc "github.com/owncloud/ocis/v2/ocis-pkg/service/grpc"
|
ogrpc "github.com/owncloud/ocis/v2/ocis-pkg/service/grpc"
|
||||||
"github.com/owncloud/ocis/v2/ocis-pkg/version"
|
"github.com/owncloud/ocis/v2/ocis-pkg/version"
|
||||||
ehsvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/eventhistory/v0"
|
ehsvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/eventhistory/v0"
|
||||||
@@ -129,6 +131,25 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
server := debug.NewService(
|
||||||
|
debug.Logger(logger),
|
||||||
|
debug.Name(cfg.Service.Name),
|
||||||
|
debug.Version(version.GetString()),
|
||||||
|
debug.Address(cfg.Debug.Addr),
|
||||||
|
debug.Token(cfg.Debug.Token),
|
||||||
|
debug.Pprof(cfg.Debug.Pprof),
|
||||||
|
debug.Zpages(cfg.Debug.Zpages),
|
||||||
|
debug.Health(handlers.Health),
|
||||||
|
debug.Ready(handlers.Ready),
|
||||||
|
)
|
||||||
|
|
||||||
|
gr.Add(server.ListenAndServe, func(_ error) {
|
||||||
|
_ = server.Shutdown(ctx)
|
||||||
|
cancel()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return gr.Run()
|
return gr.Run()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,9 @@ type Config struct {
|
|||||||
|
|
||||||
Service Service `yaml:"-"`
|
Service Service `yaml:"-"`
|
||||||
|
|
||||||
Log *Log `yaml:"log"`
|
Tracing *Tracing `yaml:"tracing"`
|
||||||
Debug Debug `yaml:"debug"`
|
Log *Log `yaml:"log"`
|
||||||
|
Debug Debug `yaml:"debug"`
|
||||||
|
|
||||||
HTTP HTTP `yaml:"http"`
|
HTTP HTTP `yaml:"http"`
|
||||||
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||||
@@ -70,3 +71,11 @@ type HTTP struct {
|
|||||||
type TokenManager struct {
|
type TokenManager struct {
|
||||||
JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;USERLOG_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."`
|
JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;USERLOG_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tracing defines the available tracing configuration.
|
||||||
|
type Tracing struct {
|
||||||
|
Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;USERLOG_TRACING_ENABLED" desc:"Activates tracing."`
|
||||||
|
Type string `yaml:"type" env:"OCIS_TRACING_TYPE;USERLOG_TRACING_TYPE" desc:"The type of tracing. Defaults to \"\", which is the same as \"jaeger\". Allowed tracing types are \"jaeger\" and \"\" as of now."`
|
||||||
|
Endpoint string `yaml:"endpoint" env:"OCIS_TRACING_ENDPOINT;USERLOG_TRACING_ENDPOINT" desc:"The endpoint of the tracing agent."`
|
||||||
|
Collector string `yaml:"collector" env:"OCIS_TRACING_COLLECTOR;USERLOG_TRACING_COLLECTOR" desc:"The HTTP endpoint for sending spans directly to a collector, i.e. http://jaeger-collector:14268/api/traces. Only used if the tracing endpoint is unset."`
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,6 +20,12 @@ func FullDefaultConfig() *config.Config {
|
|||||||
// DefaultConfig return the default configuration
|
// DefaultConfig return the default configuration
|
||||||
func DefaultConfig() *config.Config {
|
func DefaultConfig() *config.Config {
|
||||||
return &config.Config{
|
return &config.Config{
|
||||||
|
Debug: config.Debug{
|
||||||
|
Addr: "127.0.0.1:9210",
|
||||||
|
Token: "",
|
||||||
|
Pprof: false,
|
||||||
|
Zpages: false,
|
||||||
|
},
|
||||||
Service: config.Service{
|
Service: config.Service{
|
||||||
Name: "userlog",
|
Name: "userlog",
|
||||||
},
|
},
|
||||||
@@ -82,6 +88,18 @@ func EnsureDefaults(cfg *config.Config) {
|
|||||||
if cfg.Commons != nil {
|
if cfg.Commons != nil {
|
||||||
cfg.HTTP.TLS = cfg.Commons.HTTPServiceTLS
|
cfg.HTTP.TLS = cfg.Commons.HTTPServiceTLS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// provide with defaults for shared tracing, since we need a valid destination address for "envdecode".
|
||||||
|
if cfg.Tracing == nil && cfg.Commons != nil && cfg.Commons.Tracing != nil {
|
||||||
|
cfg.Tracing = &config.Tracing{
|
||||||
|
Enabled: cfg.Commons.Tracing.Enabled,
|
||||||
|
Type: cfg.Commons.Tracing.Type,
|
||||||
|
Endpoint: cfg.Commons.Tracing.Endpoint,
|
||||||
|
Collector: cfg.Commons.Tracing.Collector,
|
||||||
|
}
|
||||||
|
} else if cfg.Tracing == nil {
|
||||||
|
cfg.Tracing = &config.Tracing{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanitize sanitizes the config
|
// Sanitize sanitizes the config
|
||||||
|
|||||||
Reference in New Issue
Block a user