Skip to content

Commit

Permalink
feat: include tracing for grpc openInApp function
Browse files Browse the repository at this point in the history
  • Loading branch information
jvillafanez committed Jul 25, 2024
1 parent 6204b07 commit 9e0cdaa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions services/collaboration/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func Server(cfg *config.Config) *cli.Command {
grpc.AppURLs(appUrls),
grpc.Config(cfg),
grpc.Logger(logger),
grpc.TraceProvider(traceProvider),
)
defer teardown()
if err != nil {
Expand Down
12 changes: 11 additions & 1 deletion services/collaboration/pkg/server/grpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@ package grpc

import (
appproviderv1beta1 "github.com/cs3org/go-cs3apis/cs3/app/provider/v1beta1"
"github.com/owncloud/ocis/v2/ocis-pkg/tracing"
svc "github.com/owncloud/ocis/v2/services/collaboration/pkg/service/grpc/v0"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"google.golang.org/grpc"
)

// Server initializes a new grpc service ready to run
// THIS SERVICE IS REGISTERED AGAINST REVA, NOT GO-MICRO
func Server(opts ...Option) (*grpc.Server, func(), error) {
grpcOpts := []grpc.ServerOption{}
options := newOptions(opts...)

grpcOpts := []grpc.ServerOption{
grpc.StatsHandler(
otelgrpc.NewServerHandler(
otelgrpc.WithTracerProvider(options.TraceProvider),
otelgrpc.WithPropagators(tracing.GetPropagator()),
),
),
}
grpcServer := grpc.NewServer(grpcOpts...)

handle, teardown, err := svc.NewHandler(
Expand Down

0 comments on commit 9e0cdaa

Please sign in to comment.