Skip to content

Commit 496ad82

Browse files
committed
feat(tracing): Enable tracing for the graph service
The graph service uses the `otelchi` middleware now to get at least some basic tracing enabled.
1 parent 8ebae5f commit 496ad82

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

services/graph/pkg/service/v0/service.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/go-chi/chi/v5/middleware"
1616
ldapv3 "github.com/go-ldap/ldap/v3"
1717
"github.com/jellydator/ttlcache/v3"
18+
"github.com/riandyrn/otelchi"
1819
microstore "go-micro.dev/v4/store"
1920

2021
"github.com/opencloud-eu/reva/v2/pkg/events"
@@ -28,6 +29,7 @@ import (
2829
"github.com/opencloud-eu/opencloud/pkg/registry"
2930
"github.com/opencloud-eu/opencloud/pkg/roles"
3031
"github.com/opencloud-eu/opencloud/pkg/service/grpc"
32+
"github.com/opencloud-eu/opencloud/pkg/tracing"
3133
settingssvc "github.com/opencloud-eu/opencloud/protogen/gen/opencloud/services/settings/v0"
3234
"github.com/opencloud-eu/opencloud/services/graph/pkg/identity"
3335
graphm "github.com/opencloud-eu/opencloud/services/graph/pkg/middleware"
@@ -128,6 +130,14 @@ func NewService(opts ...Option) (Graph, error) { //nolint:maintidx
128130

129131
m := chi.NewMux()
130132
m.Use(options.Middleware...)
133+
m.Use(
134+
otelchi.Middleware(
135+
"graph",
136+
otelchi.WithChiRoutes(m),
137+
otelchi.WithTracerProvider(options.TraceProvider),
138+
otelchi.WithPropagators(tracing.GetPropagator()),
139+
),
140+
)
131141

132142
spacePropertiesCache := ttlcache.New(
133143
ttlcache.WithTTL[string, interface{}](

0 commit comments

Comments
 (0)