Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metrics to encoder v2 #1080

Merged
merged 9 commits into from
Jan 8, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add grpc metrics to encoder v2
dmanc committed Jan 8, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 8186b3676b76516cd946bf54158d2b1abc10970b
1 change: 1 addition & 0 deletions disperser/cmd/encoder/main.go
Original file line number Diff line number Diff line change
@@ -115,6 +115,7 @@ func RunEncoderServer(ctx *cli.Context) error {
logger,
prover,
metrics,
grpcMetrics,
)

return server.Start()
27 changes: 19 additions & 8 deletions disperser/encoder/server_v2.go
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ import (
"github.com/Layr-Labs/eigenda/encoding/rs"
"github.com/Layr-Labs/eigenda/relay/chunkstore"
"github.com/Layr-Labs/eigensdk-go/logging"
grpcprom "github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/reflection"
@@ -31,21 +32,30 @@ type EncoderServerV2 struct {
logger logging.Logger
prover encoding.Prover
metrics *Metrics
grpcMetrics *grpcprom.ServerMetrics
close func()

runningRequests chan struct{}
requestPool chan struct{}
}

func NewEncoderServerV2(config ServerConfig, blobStore *blobstore.BlobStore, chunkWriter chunkstore.ChunkWriter, logger logging.Logger, prover encoding.Prover, metrics *Metrics) *EncoderServerV2 {
func NewEncoderServerV2(
config ServerConfig,
blobStore *blobstore.BlobStore,
chunkWriter chunkstore.ChunkWriter,
logger logging.Logger,
prover encoding.Prover,
metrics *Metrics,
grpcMetrics *grpcprom.ServerMetrics,
) *EncoderServerV2 {
return &EncoderServerV2{
config: config,
blobStore: blobStore,
chunkWriter: chunkWriter,
logger: logger.With("component", "EncoderServer"),
prover: prover,
metrics: metrics,

config: config,
blobStore: blobStore,
chunkWriter: chunkWriter,
logger: logger.With("component", "EncoderServerV2"),
prover: prover,
metrics: metrics,
grpcMetrics: grpcMetrics,
runningRequests: make(chan struct{}, config.MaxConcurrentRequests),
requestPool: make(chan struct{}, config.RequestPoolSize),
}
@@ -62,6 +72,7 @@ func (s *EncoderServerV2) Start() error {
gs := grpc.NewServer()
reflection.Register(gs)
pb.RegisterEncoderServer(gs, s)
s.grpcMetrics.InitializeMetrics(gs)

// Register Server for Health Checks
name := pb.Encoder_ServiceDesc.ServiceName
9 changes: 5 additions & 4 deletions relay/chunk_provider.go
Original file line number Diff line number Diff line change
@@ -4,14 +4,15 @@ import (
"bytes"
"context"
"fmt"
"sync"
"time"

v2 "github.com/Layr-Labs/eigenda/core/v2"
"github.com/Layr-Labs/eigenda/encoding"
"github.com/Layr-Labs/eigenda/encoding/rs"
"github.com/Layr-Labs/eigenda/relay/cache"
"github.com/Layr-Labs/eigenda/relay/chunkstore"
"github.com/Layr-Labs/eigensdk-go/logging"
"sync"
"time"
)

type chunkProvider struct {
@@ -110,7 +111,7 @@ func (s *chunkProvider) GetFrames(ctx context.Context, mMap metadataMap) (frameM
go func() {
frames, err := s.frameCache.Get(ctx, *boundKey)
if err != nil {
s.logger.Errorf("Failed to get frames for blob %v: %v", boundKey.blobKey, err)
s.logger.Errorf("Failed to get frames for blob %v: %v", boundKey.blobKey.Hex(), err)
completionChannel <- &framesResult{
key: boundKey.blobKey,
err: err,
@@ -129,7 +130,7 @@ func (s *chunkProvider) GetFrames(ctx context.Context, mMap metadataMap) (frameM
for len(fMap) < len(keys) {
result := <-completionChannel
if result.err != nil {
return nil, fmt.Errorf("error fetching frames for blob %v: %w", result.key, result.err)
return nil, fmt.Errorf("error fetching frames for blob %v: %w", result.key.Hex(), result.err)
}
fMap[result.key] = result.data
}