Merge pull request #6204 from dragonchaser/issue-5002-eventhistory-debug

add debug to eventhistory
This commit is contained in:
Christian Richter
2023-05-02 20:11:49 +02:00
committed by GitHub
5 changed files with 45 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
Enhancement: Add debug server to eventhistory
We added a debug server to eventhistory.
https://github.com/owncloud/ocis/pull/6204
https://github.com/owncloud/ocis/issues/5002

View File

@@ -64,7 +64,7 @@ We also suggest to use the last port in your extensions' range as a debug/metric
| 9255-9259 | [postprocessing]({{ ref "../postprocessing/_index.md" >}}) |
| 9260-9264 | FREE |
| 9265-9269 | FREE |
| 9270-9274 | FREE |
| 9270-9274 | [eventhistory]({{< ref "../eventhistory/_index.md" >}}) |
| 9275-9279 | FREE |
| 9280-9284 | FREE |
| 9285-9289 | FREE |

View File

@@ -8,6 +8,8 @@ import (
"github.com/cs3org/reva/v2/pkg/store"
"github.com/oklog/run"
"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"
"github.com/owncloud/ocis/v2/ocis-pkg/version"
"github.com/owncloud/ocis/v2/services/eventhistory/pkg/config"
@@ -85,6 +87,25 @@ func Server(cfg *config.Config) *cli.Command {
cancel()
})
{
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()
},

View File

@@ -13,8 +13,9 @@ type Config struct {
Service Service `yaml:"-"`
Log *Log `yaml:"log"`
Debug Debug `yaml:"debug"`
Tracing *Tracing `yaml:"tracing"`
Log *Log `yaml:"log"`
Debug Debug `yaml:"debug"`
GRPC GRPCConfig `yaml:"grpc"`
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
@@ -50,3 +51,11 @@ type Events struct {
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"EVENTHISTORY_EVENTS_TLS_ROOT_CA_CERTIFICATE" desc:"The root CA certificate used to validate the server's TLS certificate. If provided NOTIFICATIONS_EVENTS_TLS_INSECURE will be seen as false."`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_EVENTS_ENABLE_TLS;EVENTHISTORY_EVENTS_ENABLE_TLS" desc:"Enable TLS for the connection to the events broker. The events broker is the ocis service which receives and delivers events between the services.."`
}
// Tracing defines the available tracing configuration.
type Tracing struct {
Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;EVENTHISTORY_TRACING_ENABLED" desc:"Activates tracing."`
Type string `yaml:"type" env:"OCIS_TRACING_TYPE;EVENTHISTORY_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;EVENTHISTORY_TRACING_ENDPOINT" desc:"The endpoint of the tracing agent."`
Collector string `yaml:"collector" env:"OCIS_TRACING_COLLECTOR;EVENTHISTORY_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."`
}

View File

@@ -18,6 +18,12 @@ func FullDefaultConfig() *config.Config {
// DefaultConfig return the default configuration
func DefaultConfig() *config.Config {
return &config.Config{
Debug: config.Debug{
Addr: "127.0.0.1:9270",
Token: "",
Pprof: false,
Zpages: false,
},
Service: config.Service{
Name: "eventhistory",
},