Skip to content

Commit

Permalink
Merge pull request #329 from owncloud/simplify-config
Browse files Browse the repository at this point in the history
Simplify config
  • Loading branch information
kulmann committed Aug 12, 2020
2 parents 75e9506 + ded9a01 commit a26c819
Show file tree
Hide file tree
Showing 28 changed files with 236 additions and 10 deletions.
7 changes: 7 additions & 0 deletions changelog/unreleased/simplify-tracing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: Simplify tracing config

We now apply the oCIS tracing config to all services which have tracing. With this it is possible
to set one tracing config for all services at the same time.

https://github.com/owncloud/product/issues/92
https://github.com/owncloud/ocis/pull/329
26 changes: 18 additions & 8 deletions docs/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,24 @@ to get started:
-p 9411:9411 \
jaegertracing/all-in-one:1.17
```
2. Every single oCIS service has its own environment variables for enabling and configuring tracing. You can, for example,
enable tracing in Reva when starting the oCIS single binary like this:
```console
REVA_TRACING_ENABLED=true \
REVA_TRACING_ENDPOINT=localhost:6831 \
REVA_TRACING_COLLECTOR=http://localhost:14268/api/traces \
./bin/ocis server
```
2. Every single oCIS service has its own environment variables for enabling and configuring tracing.
1. You can enable and configure tracing on each service individually. For example, enable tracing
in Reva when starting the oCIS single binary like this:
```console
REVA_TRACING_ENABLED=true \
REVA_TRACING_ENDPOINT=localhost:6831 \
REVA_TRACING_COLLECTOR=http://localhost:14268/api/traces \
./bin/ocis server
```
2. Enabling and configuring tracing on oCIS itself will forward the configuration to all services:
```console
OCIS_TRACING_ENABLED=true \
OCIS_TRACING_ENDPOINT=localhost:6831 \
OCIS_TRACING_COLLECTOR=http://localhost:14268/api/traces \
./bin/ocis server
```
If you want to set individual tracing configuration for each service, make sure to set
`OCIS_TRACING_ENABLED=false`.
3. Make the actual request that you want to trace.
4. Open up the [Jaeger UI](http://localhost:16686) to analyze request traces.

Expand Down
9 changes: 9 additions & 0 deletions pkg/command/glauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ func configureGLAuth(cfg *config.Config) *svcconfig.Config {
cfg.GLAuth.Log.Level = cfg.Log.Level
cfg.GLAuth.Log.Pretty = cfg.Log.Pretty
cfg.GLAuth.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.GLAuth.Tracing.Enabled = cfg.Tracing.Enabled
cfg.GLAuth.Tracing.Type = cfg.Tracing.Type
cfg.GLAuth.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.GLAuth.Tracing.Collector = cfg.Tracing.Collector
cfg.GLAuth.Tracing.Service = cfg.Tracing.Service
}

return cfg.GLAuth
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/graph-explorer.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ func configureGraphExplorer(cfg *config.Config) *svcconfig.Config {
cfg.GraphExplorer.Log.Pretty = cfg.Log.Pretty
cfg.GraphExplorer.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.GraphExplorer.Tracing.Enabled = cfg.Tracing.Enabled
cfg.GraphExplorer.Tracing.Type = cfg.Tracing.Type
cfg.GraphExplorer.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.GraphExplorer.Tracing.Collector = cfg.Tracing.Collector
cfg.GraphExplorer.Tracing.Service = cfg.Tracing.Service
}

return cfg.GraphExplorer
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ func configureGraph(cfg *config.Config) *svcconfig.Config {
cfg.Graph.Log.Pretty = cfg.Log.Pretty
cfg.Graph.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Graph.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Graph.Tracing.Type = cfg.Tracing.Type
cfg.Graph.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Graph.Tracing.Collector = cfg.Tracing.Collector
cfg.Graph.Tracing.Service = cfg.Tracing.Service
}

return cfg.Graph
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/konnectd.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func configureKonnectd(cfg *config.Config) *svcconfig.Config {
cfg.Konnectd.Log.Color = cfg.Log.Color
cfg.Konnectd.HTTP.TLS = false

if cfg.Tracing.Enabled {
cfg.Konnectd.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Konnectd.Tracing.Type = cfg.Tracing.Type
cfg.Konnectd.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Konnectd.Tracing.Collector = cfg.Tracing.Collector
cfg.Konnectd.Tracing.Service = cfg.Tracing.Service
}

return cfg.Konnectd
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/ocs.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ func configureOCS(cfg *config.Config) *svcconfig.Config {
cfg.OCS.Log.Pretty = cfg.Log.Pretty
cfg.OCS.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.OCS.Tracing.Enabled = cfg.Tracing.Enabled
cfg.OCS.Tracing.Type = cfg.Tracing.Type
cfg.OCS.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.OCS.Tracing.Collector = cfg.Tracing.Collector
cfg.OCS.Tracing.Service = cfg.Tracing.Service
}

return cfg.OCS
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/phoenix_ocis.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ func configurePhoenix(cfg *config.Config) *svcconfig.Config {
cfg.Phoenix.Log.Pretty = cfg.Log.Pretty
cfg.Phoenix.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Phoenix.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Phoenix.Tracing.Type = cfg.Tracing.Type
cfg.Phoenix.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Phoenix.Tracing.Collector = cfg.Tracing.Collector
cfg.Phoenix.Tracing.Service = cfg.Tracing.Service
}

// disable ocis-hello extension
cfg.Phoenix.Phoenix.Config.ExternalApps = []svcconfig.ExternalApp{}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/phoenix_simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ func configurePhoenix(cfg *config.Config) *svcconfig.Config {
cfg.Phoenix.Log.Pretty = cfg.Log.Pretty
cfg.Phoenix.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Phoenix.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Phoenix.Tracing.Type = cfg.Tracing.Type
cfg.Phoenix.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Phoenix.Tracing.Collector = cfg.Tracing.Collector
cfg.Phoenix.Tracing.Service = cfg.Tracing.Service
}

// disable built in apps
cfg.Phoenix.Phoenix.Config.Apps = []string{}
// enable ocis-hello extension
Expand Down
12 changes: 12 additions & 0 deletions pkg/command/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ func configureProxy(cfg *config.Config) *svcconfig.Config {
cfg.Proxy.Log.Pretty = cfg.Log.Pretty
cfg.Proxy.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Proxy.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Proxy.Tracing.Type = cfg.Tracing.Type
cfg.Proxy.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Proxy.Tracing.Collector = cfg.Tracing.Collector
cfg.Proxy.Tracing.Service = cfg.Tracing.Service
}

if cfg.Reva.Reva.JWTSecret != "" {
cfg.Proxy.TokenManager.JWTSecret = cfg.Reva.Reva.JWTSecret
}

return cfg.Proxy
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/revaauthbasic.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func configureRevaAuthBasic(cfg *config.Config) *svcconfig.Config {
cfg.Reva.Log.Pretty = cfg.Log.Pretty
cfg.Reva.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Reva.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Reva.Tracing.Type = cfg.Tracing.Type
cfg.Reva.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Reva.Tracing.Collector = cfg.Tracing.Collector
cfg.Reva.Tracing.Service = cfg.Tracing.Service
}

return cfg.Reva
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/revaauthbearer.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func configureRevaAuthBearer(cfg *config.Config) *svcconfig.Config {
cfg.Reva.Log.Pretty = cfg.Log.Pretty
cfg.Reva.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Reva.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Reva.Tracing.Type = cfg.Tracing.Type
cfg.Reva.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Reva.Tracing.Collector = cfg.Tracing.Collector
cfg.Reva.Tracing.Service = cfg.Tracing.Service
}

return cfg.Reva
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/revafrontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func configureRevaFrontend(cfg *config.Config) *svcconfig.Config {
cfg.Reva.Log.Pretty = cfg.Log.Pretty
cfg.Reva.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Reva.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Reva.Tracing.Type = cfg.Tracing.Type
cfg.Reva.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Reva.Tracing.Collector = cfg.Tracing.Collector
cfg.Reva.Tracing.Service = cfg.Tracing.Service
}

return cfg.Reva
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/revagateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func configureRevaGateway(cfg *config.Config) *svcconfig.Config {
cfg.Reva.Log.Pretty = cfg.Log.Pretty
cfg.Reva.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Reva.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Reva.Tracing.Type = cfg.Tracing.Type
cfg.Reva.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Reva.Tracing.Collector = cfg.Tracing.Collector
cfg.Reva.Tracing.Service = cfg.Tracing.Service
}

return cfg.Reva
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/revasharing.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func configureRevaSharing(cfg *config.Config) *svcconfig.Config {
cfg.Reva.Log.Pretty = cfg.Log.Pretty
cfg.Reva.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Reva.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Reva.Tracing.Type = cfg.Tracing.Type
cfg.Reva.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Reva.Tracing.Collector = cfg.Tracing.Collector
cfg.Reva.Tracing.Service = cfg.Tracing.Service
}

return cfg.Reva
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/revastorageeos.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func configureRevaStorageEOS(cfg *config.Config) *svcconfig.Config {
cfg.Reva.Log.Pretty = cfg.Log.Pretty
cfg.Reva.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Reva.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Reva.Tracing.Type = cfg.Tracing.Type
cfg.Reva.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Reva.Tracing.Collector = cfg.Tracing.Collector
cfg.Reva.Tracing.Service = cfg.Tracing.Service
}

return cfg.Reva
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/revastorageeosdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func configureRevaStorageEOSData(cfg *config.Config) *svcconfig.Config {
cfg.Reva.Log.Pretty = cfg.Log.Pretty
cfg.Reva.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Reva.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Reva.Tracing.Type = cfg.Tracing.Type
cfg.Reva.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Reva.Tracing.Collector = cfg.Tracing.Collector
cfg.Reva.Tracing.Service = cfg.Tracing.Service
}

return cfg.Reva
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/revastoragehome.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func configureRevaStorageHome(cfg *config.Config) *svcconfig.Config {
cfg.Reva.Log.Pretty = cfg.Log.Pretty
cfg.Reva.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Reva.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Reva.Tracing.Type = cfg.Tracing.Type
cfg.Reva.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Reva.Tracing.Collector = cfg.Tracing.Collector
cfg.Reva.Tracing.Service = cfg.Tracing.Service
}

return cfg.Reva
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/revastoragehomedata.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func configureRevaStorageHomeData(cfg *config.Config) *svcconfig.Config {
cfg.Reva.Log.Pretty = cfg.Log.Pretty
cfg.Reva.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Reva.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Reva.Tracing.Type = cfg.Tracing.Type
cfg.Reva.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Reva.Tracing.Collector = cfg.Tracing.Collector
cfg.Reva.Tracing.Service = cfg.Tracing.Service
}

return cfg.Reva
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/revastorageoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func configureRevaStorageOC(cfg *config.Config) *svcconfig.Config {
cfg.Reva.Log.Pretty = cfg.Log.Pretty
cfg.Reva.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Reva.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Reva.Tracing.Type = cfg.Tracing.Type
cfg.Reva.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Reva.Tracing.Collector = cfg.Tracing.Collector
cfg.Reva.Tracing.Service = cfg.Tracing.Service
}

return cfg.Reva
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/revastorageocdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func configureRevaStorageOCData(cfg *config.Config) *svcconfig.Config {
cfg.Reva.Log.Pretty = cfg.Log.Pretty
cfg.Reva.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Reva.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Reva.Tracing.Type = cfg.Tracing.Type
cfg.Reva.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Reva.Tracing.Collector = cfg.Tracing.Collector
cfg.Reva.Tracing.Service = cfg.Tracing.Service
}

return cfg.Reva
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/revastoragepubliclink.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func configureRevaStoragePublicLink(cfg *config.Config) *svcconfig.Config {
cfg.Reva.Log.Pretty = cfg.Log.Pretty
cfg.Reva.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Reva.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Reva.Tracing.Type = cfg.Tracing.Type
cfg.Reva.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Reva.Tracing.Collector = cfg.Tracing.Collector
cfg.Reva.Tracing.Service = cfg.Tracing.Service
}

return cfg.Reva
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/revastorageroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func configureRevaStorageRoot(cfg *config.Config) *svcconfig.Config {
cfg.Reva.Log.Pretty = cfg.Log.Pretty
cfg.Reva.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Reva.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Reva.Tracing.Type = cfg.Tracing.Type
cfg.Reva.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Reva.Tracing.Collector = cfg.Tracing.Collector
cfg.Reva.Tracing.Service = cfg.Tracing.Service
}

return cfg.Reva
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/command/revausers.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func configureRevaUsers(cfg *config.Config) *svcconfig.Config {
cfg.Reva.Log.Pretty = cfg.Log.Pretty
cfg.Reva.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Reva.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Reva.Tracing.Type = cfg.Tracing.Type
cfg.Reva.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Reva.Tracing.Collector = cfg.Tracing.Collector
cfg.Reva.Tracing.Service = cfg.Tracing.Service
}

return cfg.Reva
}

Expand Down
12 changes: 12 additions & 0 deletions pkg/command/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ func configureSettings(cfg *config.Config) *svcconfig.Config {
cfg.Settings.Log.Pretty = cfg.Log.Pretty
cfg.Settings.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Settings.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Settings.Tracing.Type = cfg.Tracing.Type
cfg.Settings.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Settings.Tracing.Collector = cfg.Tracing.Collector
cfg.Settings.Tracing.Service = cfg.Tracing.Service
}

if cfg.Reva.Reva.JWTSecret != "" {
cfg.Settings.TokenManager.JWTSecret = cfg.Reva.Reva.JWTSecret
}

return cfg.Settings
}

Expand Down
Loading

0 comments on commit a26c819

Please sign in to comment.