Skip to content

Commit

Permalink
Added grpc_client_handed_total prometheus metric for datacatalog (fly…
Browse files Browse the repository at this point in the history
…teorg#437)

* Added grpc_client_handed_total prometheus metric for datacatalog

Signed-off-by: Prafulla Mahindrakar <[email protected]>

* fixed lint issues

Signed-off-by: Prafulla Mahindrakar <[email protected]>
  • Loading branch information
pmahindrakar-oss authored May 17, 2022
1 parent 0301f2a commit 25802b0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions pkg/controller/nodes/task/catalog/datacatalog/datacatalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import (
"github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery/catalog"
"github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery/io"
"github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery/ioutils"
grpcMiddleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpcRetry "github.com/grpc-ecosystem/go-grpc-middleware/retry"
grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/pkg/errors"

"github.com/flyteorg/flytestdlib/logger"
Expand Down Expand Up @@ -377,9 +379,14 @@ func NewDataCatalog(ctx context.Context, endpoint string, insecureConnection boo
opts = append(opts, grpc.WithTransportCredentials(creds))
}

retryInterceptor := grpc.WithUnaryInterceptor(grpcRetry.UnaryClientInterceptor(grpcOptions...))
retryInterceptor := grpcRetry.UnaryClientInterceptor(grpcOptions...)

opts = append(opts, retryInterceptor)
finalUnaryInterceptor := grpcMiddleware.ChainUnaryClient(
grpcPrometheus.UnaryClientInterceptor,
retryInterceptor,
)

opts = append(opts, grpc.WithUnaryInterceptor(finalUnaryInterceptor))
clientConn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return nil, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestResourceVersionCaching_Get_NotInCache(t *testing.T) {

func fromHashToByteArray(input [32]byte) []byte {
output := make([]byte, 32)
for idx, val := range input {
for idx, val := range input { //nolint
output[idx] = val
}
return output
Expand Down

0 comments on commit 25802b0

Please sign in to comment.