feat: include tracing for grpc openInApp function

This commit is contained in:
Juan Pablo Villafáñez
2024-07-25 13:01:26 +02:00
parent a5d27b2f98
commit 083a2e1484
2 changed files with 12 additions and 1 deletions

View File

@@ -63,6 +63,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 {

View File

@@ -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(