Skip to content

Commit

Permalink
introduce options to reva tracer
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
butonic committed Dec 2, 2022
1 parent 5e9f241 commit 69c0dff
Show file tree
Hide file tree
Showing 21 changed files with 153 additions and 112 deletions.
19 changes: 17 additions & 2 deletions cmd/revad/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func RunWithOptions(mainConf map[string]interface{}, pidFile string, opts ...Opt
type coreConf struct {
MaxCPUs string `mapstructure:"max_cpus"`
TracingEnabled bool `mapstructure:"tracing_enabled"`
TracingInsecure bool `mapstructure:"tracing_insecure"`
TracingExporter string `mapstructure:"tracing_exporter"`
TracingEndpoint string `mapstructure:"tracing_endpoint"`
TracingCollector string `mapstructure:"tracing_collector"`
Expand Down Expand Up @@ -150,9 +151,23 @@ func initServers(mainConf map[string]interface{}, log *zerolog.Logger, tp trace.

func initTracing(conf *coreConf) trace.TracerProvider {
if conf.TracingEnabled {
rtrace.InitDefaultTracerProvider(conf.TracingExporter, conf.TracingCollector, conf.TracingEndpoint)
opts := []rtrace.Option{
rtrace.WithExporter(conf.TracingExporter),
rtrace.WithEndpoint(conf.TracingEndpoint),
rtrace.WithCollector(conf.TracingCollector),
rtrace.WithServiceName(conf.TracingServiceName),
}
if conf.TracingEnabled {
opts = append(opts, rtrace.WithEnabled())
}
if conf.TracingInsecure {
opts = append(opts, rtrace.WithInsecure())
}
tp := rtrace.NewTracerProvider(opts...)
rtrace.SetDefaultTracerProvider(tp)
return tp
}
return rtrace.GetTracerProvider(conf.TracingEnabled, conf.TracingExporter, conf.TracingCollector, conf.TracingEndpoint, conf.TracingServiceName)
return rtrace.DefaultProvider()
}

func initCPUCount(conf *coreConf, log *zerolog.Logger) {
Expand Down
3 changes: 1 addition & 2 deletions internal/grpc/services/storageprovider/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import (
"github.com/cs3org/reva/v2/pkg/storage"
"github.com/cs3org/reva/v2/pkg/storage/fs/registry"
"github.com/cs3org/reva/v2/pkg/storagespace"
rtrace "github.com/cs3org/reva/v2/pkg/trace"
"github.com/cs3org/reva/v2/pkg/utils"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
Expand Down Expand Up @@ -680,7 +679,7 @@ func (s *service) Move(ctx context.Context, req *provider.MoveRequest) (*provide
}

func (s *service) Stat(ctx context.Context, req *provider.StatRequest) (*provider.StatResponse, error) {
ctx, span := rtrace.DefaultProvider().Tracer(tracerName).Start(ctx, "stat")
ctx, span := appctx.GetTracerProvider(ctx).Tracer(tracerName).Start(ctx, "stat")
defer span.End()

span.SetAttributes(attribute.KeyValue{
Expand Down
4 changes: 2 additions & 2 deletions internal/http/services/owncloud/ocdav/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type copy struct {
}

func (s *svc) handlePathCopy(w http.ResponseWriter, r *http.Request, ns string) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "copy")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "copy")
defer span.End()

if r.Body != http.NoBody {
Expand Down Expand Up @@ -302,7 +302,7 @@ func (s *svc) executePathCopy(ctx context.Context, client gateway.GatewayAPIClie
}

func (s *svc) handleSpacesCopy(w http.ResponseWriter, r *http.Request, spaceID string) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "spaces_copy")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "spaces_copy")
defer span.End()

if r.Body != http.NoBody {
Expand Down
7 changes: 4 additions & 3 deletions internal/http/services/owncloud/ocdav/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ import (
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net"
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/spacelookup"
"github.com/cs3org/reva/v2/pkg/appctx"
"github.com/cs3org/reva/v2/pkg/errtypes"
rstatus "github.com/cs3org/reva/v2/pkg/rgrpc/status"
"github.com/cs3org/reva/v2/pkg/utils"
)

func (s *svc) handlePathDelete(w http.ResponseWriter, r *http.Request, ns string) (status int, err error) {
ctx := r.Context()
ctx, span := s.tracerProvider.Tracer(tracerName).Start(ctx, "path_delete")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(ctx, "path_delete")
defer span.End()

if r.Body != http.NoBody {
Expand All @@ -57,7 +58,7 @@ func (s *svc) handlePathDelete(w http.ResponseWriter, r *http.Request, ns string
}

func (s *svc) handleDelete(ctx context.Context, w http.ResponseWriter, r *http.Request, ref *provider.Reference) (status int, err error) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(ctx, "delete")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(ctx, "delete")
defer span.End()

req := &provider.DeleteRequest{Ref: ref}
Expand Down Expand Up @@ -114,7 +115,7 @@ func (s *svc) handleDelete(ctx context.Context, w http.ResponseWriter, r *http.R

func (s *svc) handleSpacesDelete(w http.ResponseWriter, r *http.Request, spaceID string) (status int, err error) {
ctx := r.Context()
ctx, span := s.tracerProvider.Tracer(tracerName).Start(ctx, "spaces_delete")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(ctx, "spaces_delete")
defer span.End()

if r.Body != http.NoBody {
Expand Down
4 changes: 2 additions & 2 deletions internal/http/services/owncloud/ocdav/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
)

func (s *svc) handlePathGet(w http.ResponseWriter, r *http.Request, ns string) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "get")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "get")
defer span.End()

fn := path.Join(ns, r.URL.Path)
Expand Down Expand Up @@ -153,7 +153,7 @@ func copyHeader(dst, src http.Header) {
}

func (s *svc) handleSpacesGet(w http.ResponseWriter, r *http.Request, spaceID string) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "spaces_get")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "spaces_get")
defer span.End()

sublog := appctx.GetLogger(ctx).With().Str("path", r.URL.Path).Str("spaceid", spaceID).Str("handler", "get").Logger()
Expand Down
4 changes: 2 additions & 2 deletions internal/http/services/owncloud/ocdav/head.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import (
)

func (s *svc) handlePathHead(w http.ResponseWriter, r *http.Request, ns string) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "head")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "head")
defer span.End()

fn := path.Join(ns, r.URL.Path)
Expand Down Expand Up @@ -96,7 +96,7 @@ func (s *svc) handleHead(ctx context.Context, w http.ResponseWriter, r *http.Req
}

func (s *svc) handleSpacesHead(w http.ResponseWriter, r *http.Request, spaceID string) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "spaces_head")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "spaces_head")
defer span.End()

sublog := appctx.GetLogger(ctx).With().Str("spaceid", spaceID).Str("path", r.URL.Path).Logger()
Expand Down
6 changes: 3 additions & 3 deletions internal/http/services/owncloud/ocdav/locks.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ The LockManager also defaults to exclusive locks:
}
*/
func (s *svc) handleLock(w http.ResponseWriter, r *http.Request, ns string) (retStatus int, retErr error) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), fmt.Sprintf("%s %v", r.Method, r.URL.Path))
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), fmt.Sprintf("%s %v", r.Method, r.URL.Path))
defer span.End()

span.SetAttributes(attribute.String("component", "ocdav"))
Expand All @@ -400,7 +400,7 @@ func (s *svc) handleLock(w http.ResponseWriter, r *http.Request, ns string) (ret
}

func (s *svc) handleSpacesLock(w http.ResponseWriter, r *http.Request, spaceID string) (retStatus int, retErr error) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), fmt.Sprintf("%s %v", r.Method, r.URL.Path))
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), fmt.Sprintf("%s %v", r.Method, r.URL.Path))
defer span.End()

span.SetAttributes(attribute.String("component", "ocdav"))
Expand Down Expand Up @@ -558,7 +558,7 @@ func writeLockInfo(w io.Writer, token string, ld LockDetails) (int, error) {
}

func (s *svc) handleUnlock(w http.ResponseWriter, r *http.Request, ns string) (status int, err error) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), fmt.Sprintf("%s %v", r.Method, r.URL.Path))
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), fmt.Sprintf("%s %v", r.Method, r.URL.Path))
defer span.End()

span.SetAttributes(attribute.String("component", "ocdav"))
Expand Down
4 changes: 2 additions & 2 deletions internal/http/services/owncloud/ocdav/mkcol.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
)

func (s *svc) handlePathMkcol(w http.ResponseWriter, r *http.Request, ns string) (status int, err error) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "mkcol")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "mkcol")
defer span.End()

fn := path.Join(ns, r.URL.Path)
Expand Down Expand Up @@ -89,7 +89,7 @@ func (s *svc) handlePathMkcol(w http.ResponseWriter, r *http.Request, ns string)
}

func (s *svc) handleSpacesMkCol(w http.ResponseWriter, r *http.Request, spaceID string) (status int, err error) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "spaces_mkcol")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "spaces_mkcol")
defer span.End()

sublog := appctx.GetLogger(ctx).With().Str("path", r.URL.Path).Str("spaceid", spaceID).Str("handler", "mkcol").Logger()
Expand Down
4 changes: 2 additions & 2 deletions internal/http/services/owncloud/ocdav/move.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
)

func (s *svc) handlePathMove(w http.ResponseWriter, r *http.Request, ns string) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "move")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "move")
defer span.End()

if r.Body != http.NoBody {
Expand Down Expand Up @@ -104,7 +104,7 @@ func (s *svc) handlePathMove(w http.ResponseWriter, r *http.Request, ns string)
}

func (s *svc) handleSpacesMove(w http.ResponseWriter, r *http.Request, srcSpaceID string) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "spaces_move")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "spaces_move")
defer span.End()

if r.Body != http.NoBody {
Expand Down
6 changes: 2 additions & 4 deletions internal/http/services/owncloud/ocdav/ocdav.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import (
"github.com/cs3org/reva/v2/pkg/storage/favorite"
"github.com/cs3org/reva/v2/pkg/storage/favorite/registry"
"github.com/cs3org/reva/v2/pkg/storage/utils/templates"
rtrace "github.com/cs3org/reva/v2/pkg/trace"
"github.com/cs3org/reva/v2/pkg/utils"
"github.com/jellydator/ttlcache/v2"
"github.com/mitchellh/mapstructure"
Expand Down Expand Up @@ -199,11 +198,11 @@ func New(m map[string]interface{}, log *zerolog.Logger) (global.Service, error)
return nil, err
}

return NewWith(conf, fm, ls, log, rtrace.DefaultProvider(), nil)
return NewWith(conf, fm, ls, log, nil)
}

// NewWith returns a new ocdav service
func NewWith(conf *Config, fm favorite.Manager, ls LockSystem, _ *zerolog.Logger, tp trace.TracerProvider, gwc gateway.GatewayAPIClient) (global.Service, error) {
func NewWith(conf *Config, fm favorite.Manager, ls LockSystem, _ *zerolog.Logger, gwc gateway.GatewayAPIClient) (global.Service, error) {
s := &svc{
c: conf,
webDavHandler: new(WebDavHandler),
Expand All @@ -216,7 +215,6 @@ func NewWith(conf *Config, fm favorite.Manager, ls LockSystem, _ *zerolog.Logger
favoritesManager: fm,
LockSystem: ls,
userIdentifierCache: ttlcache.NewCache(),
tracerProvider: tp,
}
_ = s.userIdentifierCache.SetTTL(60 * time.Second)

Expand Down
3 changes: 1 addition & 2 deletions internal/http/services/owncloud/ocdav/ocdav_blackbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import (
"github.com/cs3org/reva/v2/pkg/utils"
"github.com/cs3org/reva/v2/tests/cs3mocks/mocks"
"github.com/stretchr/testify/mock"
"go.opentelemetry.io/otel/trace"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -139,7 +138,7 @@ var _ = Describe("ocdav", func() {
handler, err = ocdav.NewWith(&ocdav.Config{
FilesNamespace: "/users/{{.Username}}",
WebdavNamespace: "/users/{{.Username}}",
}, nil, ocdav.NewCS3LS(client), nil, trace.NewNoopTracerProvider(), client)
}, nil, ocdav.NewCS3LS(client), nil, client)
Expect(err).ToNot(HaveOccurred())

userspace = &cs3storageprovider.StorageSpace{
Expand Down
4 changes: 2 additions & 2 deletions internal/http/services/owncloud/ocdav/proppatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import (
)

func (s *svc) handlePathProppatch(w http.ResponseWriter, r *http.Request, ns string) (status int, err error) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "proppatch")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "proppatch")
defer span.End()

fn := path.Join(ns, r.URL.Path)
Expand Down Expand Up @@ -93,7 +93,7 @@ func (s *svc) handlePathProppatch(w http.ResponseWriter, r *http.Request, ns str
}

func (s *svc) handleSpacesProppatch(w http.ResponseWriter, r *http.Request, spaceID string) (status int, err error) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "spaces_proppatch")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "spaces_proppatch")
defer span.End()

sublog := appctx.GetLogger(ctx).With().Str("path", r.URL.Path).Str("spaceid", spaceID).Logger()
Expand Down
2 changes: 1 addition & 1 deletion internal/http/services/owncloud/ocdav/publicfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (h *PublicFileHandler) Handler(s *svc) http.Handler {

// ns is the namespace that is prefixed to the path in the cs3 namespace
func (s *svc) handlePropfindOnToken(w http.ResponseWriter, r *http.Request, ns string, onContainer bool) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "token_propfind")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "token_propfind")
defer span.End()

tokenStatInfo := ctx.Value(tokenStatInfoKey{}).(*provider.ResourceInfo)
Expand Down
4 changes: 2 additions & 2 deletions internal/http/services/owncloud/ocdav/put.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func isContentRange(r *http.Request) bool {
}

func (s *svc) handlePathPut(w http.ResponseWriter, r *http.Request, ns string) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "put")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "put")
defer span.End()

fn := path.Join(ns, r.URL.Path)
Expand Down Expand Up @@ -305,7 +305,7 @@ func (s *svc) handlePut(ctx context.Context, w http.ResponseWriter, r *http.Requ
}

func (s *svc) handleSpacesPut(w http.ResponseWriter, r *http.Request, spaceID string) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "spaces_put")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "spaces_put")
defer span.End()

sublog := appctx.GetLogger(ctx).With().Str("spaceid", spaceID).Str("path", r.URL.Path).Logger()
Expand Down
6 changes: 3 additions & 3 deletions internal/http/services/owncloud/ocdav/trashbin.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (h *TrashbinHandler) Handler(s *svc) http.Handler {
}

func (h *TrashbinHandler) listTrashbin(w http.ResponseWriter, r *http.Request, s *svc, ref *provider.Reference, refBase, key, itemPath string) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "list_trashbin")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "list_trashbin")
defer span.End()

sublog := appctx.GetLogger(ctx).With().Logger()
Expand Down Expand Up @@ -452,7 +452,7 @@ func (h *TrashbinHandler) itemToPropResponse(ctx context.Context, s *svc, spaceI
}

func (h *TrashbinHandler) restore(w http.ResponseWriter, r *http.Request, s *svc, ref, dst *provider.Reference, key, itemPath string) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "restore")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "restore")
defer span.End()

sublog := appctx.GetLogger(ctx).With().Logger()
Expand Down Expand Up @@ -573,7 +573,7 @@ func (h *TrashbinHandler) restore(w http.ResponseWriter, r *http.Request, s *svc

// delete has only a key
func (h *TrashbinHandler) delete(w http.ResponseWriter, r *http.Request, s *svc, ref *provider.Reference, key, itemPath string) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "erase")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "erase")
defer span.End()

sublog := appctx.GetLogger(ctx).With().Interface("reference", ref).Str("key", key).Str("item_path", itemPath).Logger()
Expand Down
4 changes: 2 additions & 2 deletions internal/http/services/owncloud/ocdav/tus.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import (
)

func (s *svc) handlePathTusPost(w http.ResponseWriter, r *http.Request, ns string) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "tus-post")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "tus-post")
defer span.End()

// read filename from metadata
Expand All @@ -70,7 +70,7 @@ func (s *svc) handlePathTusPost(w http.ResponseWriter, r *http.Request, ns strin
}

func (s *svc) handleSpacesTusPost(w http.ResponseWriter, r *http.Request, spaceID string) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "spaces-tus-post")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "spaces-tus-post")
defer span.End()

// read filename from metadata
Expand Down
4 changes: 2 additions & 2 deletions internal/http/services/owncloud/ocdav/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (h *VersionsHandler) Handler(s *svc, rid *provider.ResourceId) http.Handler
}

func (h *VersionsHandler) doListVersions(w http.ResponseWriter, r *http.Request, s *svc, rid *provider.ResourceId) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "listVersions")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "listVersions")
defer span.End()

sublog := appctx.GetLogger(ctx).With().Interface("resourceid", rid).Logger()
Expand Down Expand Up @@ -209,7 +209,7 @@ func (h *VersionsHandler) doListVersions(w http.ResponseWriter, r *http.Request,
}

func (h *VersionsHandler) doRestore(w http.ResponseWriter, r *http.Request, s *svc, rid *provider.ResourceId, key string) {
ctx, span := s.tracerProvider.Tracer(tracerName).Start(r.Context(), "restore")
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "restore")
defer span.End()

sublog := appctx.GetLogger(ctx).With().Interface("resourceid", rid).Str("key", key).Logger()
Expand Down
18 changes: 16 additions & 2 deletions pkg/micro/ocdav/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type Options struct {
GatewayClient gateway.GatewayAPIClient

TracingEnabled bool
TracingInsecure bool
TracingExporter string
TracingCollector string
TracingEndpoint string
Expand Down Expand Up @@ -206,15 +207,28 @@ func LockSystem(val ocdav.LockSystem) Option {
}

// Tracing enables tracing
func Tracing(exporter, endpoint, collector string) Option {
func Tracing(endpoint, collector string) Option {
return func(o *Options) {
o.TracingEnabled = true
o.TracingExporter = exporter
o.TracingEndpoint = endpoint
o.TracingCollector = collector
}
}

// WithTracingInsecure option
func WithTracingInsecure() Option {
return func(o *Options) {
o.TracingInsecure = true
}
}

// WithTracingExporter option
func WithTracingExporter(exporter string) Option {
return func(o *Options) {
o.TracingExporter = exporter
}
}

// Version provides a function to set the Version config option.
func Version(val string) Option {
return func(o *Options) {
Expand Down
Loading

0 comments on commit 69c0dff

Please sign in to comment.