MCPcopy
hub / github.com/grpc/grpc-go / NewService

Function NewService

orca/service.go:94–110  ·  view source on GitHub ↗

NewService creates a new ORCA service implementation configured using the provided options.

(opts ServiceOptions)

Source from the content-addressed store, hash-verified

92// NewService creates a new ORCA service implementation configured using the
93// provided options.
94func NewService(opts ServiceOptions) (*Service, error) {
95 // The default minimum supported reporting interval value can be overridden
96 // for testing purposes through the orca internal package.
97 if opts.ServerMetricsProvider == nil {
98 return nil, fmt.Errorf("ServerMetricsProvider not specified")
99 }
100 if !opts.allowAnyMinReportingInterval {
101 if opts.MinReportingInterval < 0 || opts.MinReportingInterval < minReportingInterval {
102 opts.MinReportingInterval = minReportingInterval
103 }
104 }
105 service := &Service{
106 minReportingInterval: opts.MinReportingInterval,
107 smProvider: opts.ServerMetricsProvider,
108 }
109 return service, nil
110}
111
112// Register creates a new ORCA service implementation configured using the
113// provided options and registers the same on the provided grpc Server.

Callers 1

RegisterFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected