Skip to content

Commit

Permalink
Expose the unified metric provider interface as a service
Browse files Browse the repository at this point in the history
  • Loading branch information
dayko2019 committed Sep 4, 2023
1 parent 2534abe commit 61e2ec1
Show file tree
Hide file tree
Showing 10 changed files with 2,533 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ require (
github.com/stretchr/testify v1.8.0
go.uber.org/zap v1.21.0
google.golang.org/grpc v1.47.0
google.golang.org/protobuf v1.28.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.25.0
k8s.io/apimachinery v0.25.0
Expand Down Expand Up @@ -90,7 +91,6 @@ require (
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.25.0 // indirect
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import (
metricprovider "github.com/traas-stack/kapacity/pkg/metric/provider"
"github.com/traas-stack/kapacity/pkg/metric/provider/metricsapi"
"github.com/traas-stack/kapacity/pkg/metric/provider/prometheus"
metricservice "github.com/traas-stack/kapacity/pkg/metric/service"
"github.com/traas-stack/kapacity/pkg/portrait/algorithm/externaljob/jobcontroller"
"github.com/traas-stack/kapacity/pkg/portrait/algorithm/externaljob/resultfetcher"
portraitgenerator "github.com/traas-stack/kapacity/pkg/portrait/generator"
Expand Down Expand Up @@ -274,6 +275,8 @@ func main() {

if grpcServerAddr != "" && grpcServerAddr != "0" {
server := internalgrpc.NewServer(grpcServerAddr)
metricProviderServer := metricservice.NewProviderServer(metricProvider)
metricProviderServer.RegisterTo(server.ServiceRegistrar())
if err := mgr.Add(server); err != nil {
setupLog.Error(err, "unable to set up gRPC server")
os.Exit(1)
Expand Down
Loading

0 comments on commit 61e2ec1

Please sign in to comment.