Skip to content

Commit

Permalink
Operator API
Browse files Browse the repository at this point in the history
  • Loading branch information
Spikhalskiy committed Feb 21, 2022
1 parent 61b9b65 commit 730763e
Show file tree
Hide file tree
Showing 10 changed files with 365 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[submodule "proto/api"]
path = proto/api
url = https://github.com/temporalio/api
url = https://github.com/Spikhalskiy/api
branch = operator-api
[submodule "develop/docker-compose/grafana/provisioning/temporalio-dashboards"]
path = develop/docker-compose/grafana/provisioning/temporalio-dashboards
url = https://github.com/temporalio/dashboards
14 changes: 13 additions & 1 deletion common/metrics/defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -792,10 +792,22 @@ const (
NumAdminScopes
)

// -- Operation scopes for Admin service --
const (
// OperatorAddSearchAttributesScope is the metric scope for operator.AddSearchAttributes
OperatorAddSearchAttributesScope = iota + NumAdminScopes
// OperatorRemoveSearchAttributesScope is the metric scope for operator.RemoveSearchAttributes
OperatorRemoveSearchAttributesScope
// OperatorListSearchAttributesScope is the metric scope for operator.GetSearchAttributes
OperatorListSearchAttributesScope

NumOperatorScopes
)

// -- Operation scopes for Frontend service --
const (
// FrontendStartWorkflowExecutionScope is the metric scope for frontend.StartWorkflowExecution
FrontendStartWorkflowExecutionScope = iota + NumAdminScopes
FrontendStartWorkflowExecutionScope = iota + NumOperatorScopes
// FrontendPollWorkflowTaskQueueScope is the metric scope for frontend.PollWorkflowTaskQueue
FrontendPollWorkflowTaskQueueScope
// FrontendPollActivityTaskQueueScope is the metric scope for frontend.PollActivityTaskQueue
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,5 @@ require (
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
)

replace go.temporal.io/api => github.com/spikhalskiy/api-go v1.7.1-0.20220214152639-56b3b94f7f21
8 changes: 2 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@ github.com/smartystreets/assertions v1.1.1/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYl
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM=
github.com/smartystreets/gunit v1.4.2/go.mod h1:ZjM1ozSIMJlAz/ay4SG8PeKF00ckUp+zMHZXV9/bvak=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spikhalskiy/api-go v1.7.1-0.20220214152639-56b3b94f7f21 h1:Db/70O2Qor2jczh012ZGoXKP4I9/si+7ifYDi239Fyg=
github.com/spikhalskiy/api-go v1.7.1-0.20220214152639-56b3b94f7f21/go.mod h1:HAD4ieSewx7651I9hHKNalm5GtmOyZ7MSfK7anw2pAA=
github.com/streadway/quantile v0.0.0-20150917103942-b0c588724d25 h1:7z3LSn867ex6VSaahyKadf4WtSsJIgne6A1WLOAGM8A=
github.com/streadway/quantile v0.0.0-20150917103942-b0c588724d25/go.mod h1:lbP8tGiBjZ5YWIc2fzuRpTaz0b/53vT6PEs3QuAWzuU=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down Expand Up @@ -476,9 +478,6 @@ go.opentelemetry.io/otel/sdk/metric v0.27.0/go.mod h1:lOgrT5C3ORdbqp2LsDrx+pBj6g
go.opentelemetry.io/otel/trace v1.4.0 h1:4OOUrPZdVFQkbzl/JSdvGCWIdw5ONXXxzHlaLlWppmo=
go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.temporal.io/api v1.6.1-0.20211110205628-60c98e9cbfe2/go.mod h1:IlUgOTGfmJuOkGrCZdptNxyXKE9CQz6oOx7/aH9bFY4=
go.temporal.io/api v1.7.1-0.20220211205804-a4f685c2448b h1:VVkp66hR7QpeJ2lwgx+Wr6zXYUvhfnCybwQyRDfdebg=
go.temporal.io/api v1.7.1-0.20220211205804-a4f685c2448b/go.mod h1:HAD4ieSewx7651I9hHKNalm5GtmOyZ7MSfK7anw2pAA=
go.temporal.io/sdk v1.13.0 h1:8PW27o/uYAf1C1u8WUd6LNa6He2nYkBhdUX3c5gif5o=
go.temporal.io/sdk v1.13.0/go.mod h1:TCof7U/xas2FyDnx/UUEv4c/O/S41Lnhva+6JVer+Jo=
go.temporal.io/version v0.3.0 h1:dMrei9l9NyHt8nG6EB8vAwDLLTwx2SvRyucCSumAiig=
Expand Down Expand Up @@ -593,7 +592,6 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211109214657-ef0fda0de508/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
Expand Down Expand Up @@ -688,7 +686,6 @@ golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210903071746-97244b99971b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211110154304-99a53858aa08/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down Expand Up @@ -881,7 +878,6 @@ google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEc
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
Expand Down
24 changes: 24 additions & 0 deletions service/frontend/fx.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ var Module = fx.Options(
fx.Provide(HandlerProvider),
fx.Provide(func(so []grpc.ServerOption) *grpc.Server { return grpc.NewServer(so...) }),
fx.Provide(AdminHandlerProvider),
fx.Provide(OperatorHandlerProvider),
fx.Provide(NewVersionChecker),
fx.Provide(ServiceResolverProvider),
fx.Provide(NewServiceProvider),
Expand All @@ -97,6 +98,7 @@ func NewServiceProvider(
server *grpc.Server,
handler Handler,
adminHandler *AdminHandler,
operatorHandler *OperatorHandlerImpl,
versionChecker *VersionChecker,
visibilityMgr manager.VisibilityManager,
logger resource.SnTaggedLogger,
Expand All @@ -109,6 +111,7 @@ func NewServiceProvider(
server,
handler,
adminHandler,
operatorHandler,
versionChecker,
visibilityMgr,
logger,
Expand Down Expand Up @@ -398,6 +401,27 @@ func AdminHandlerProvider(
return NewAdminHandler(args)
}

func OperatorHandlerProvider(
esConfig *esclient.Config,
esClient esclient.Client,
logger resource.SnTaggedLogger,
sdkSystemClient sdkclient.Client,
metricsClient metrics.Client,
saProvider searchattribute.Provider,
saManager searchattribute.Manager,
) *OperatorHandlerImpl {
args := NewOperatorHandlerImplArgs{
esConfig,
esClient,
logger,
sdkSystemClient,
metricsClient,
saProvider,
saManager,
}
return NewOperatorHandlerImpl(args)
}

func HandlerProvider(
params *resource.BootstrapParams,
serviceConfig *Config,
Expand Down
11 changes: 9 additions & 2 deletions service/frontend/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
package frontend

import (
"go.temporal.io/api/operatorservice/v1"
"go.temporal.io/api/workflowservice/v1"

healthpb "google.golang.org/grpc/health/grpc_health_v1"
Expand All @@ -35,17 +36,23 @@ import (
)

type (
// Handler is interface wrapping frontend handler
// Handler is interface wrapping frontend workflow handler
Handler interface {
workflowservice.WorkflowServiceServer
common.Daemon

// Health is the health check method for this rpc handler
// HealthServer is the health check method for the whole frontend server
healthpb.HealthServer
// UpdateHealthStatus sets the health status for this rpc handler.
// This health status will be used within the rpc health check handler
UpdateHealthStatus(status HealthStatus)

GetConfig() *Config
}

// OperatorHandler is interface wrapping frontend workflow handler
OperatorHandler interface {
operatorservice.OperatorServiceServer
common.Daemon
}
)
Loading

0 comments on commit 730763e

Please sign in to comment.