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

Disable v1 blobstore dynamo collector in v2 #1213

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion disperser/cmd/dataapi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func RunDataApi(ctx *cli.Context) error {
subgraphClient = dataapi.NewSubgraphClient(subgraphApi, logger)
chainState = coreeth.NewChainState(tx, client)
indexedChainState = thegraph.MakeIndexedChainState(config.ChainStateConfig, chainState, logger)
metrics = dataapi.NewMetrics(blobMetadataStore, config.MetricsConfig.HTTPPort, logger)
metrics = dataapi.NewMetrics(config.ServerVersion, blobMetadataStore, config.MetricsConfig.HTTPPort, logger)
server = dataapi.NewServer(
dataapi.Config{
ServerMode: config.ServerMode,
Expand Down
6 changes: 4 additions & 2 deletions disperser/dataapi/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ type Metrics struct {
logger logging.Logger
}

func NewMetrics(blobMetadataStore *blobstore.BlobMetadataStore, httpPort string, logger logging.Logger) *Metrics {
func NewMetrics(serverVersion uint, blobMetadataStore *blobstore.BlobMetadataStore, httpPort string, logger logging.Logger) *Metrics {
namespace := "eigenda_dataapi"
reg := prometheus.NewRegistry()
reg.MustRegister(collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}))
reg.MustRegister(collectors.NewGoCollector())
reg.MustRegister(NewDynamoDBCollector(blobMetadataStore, logger))
if serverVersion == 1 {
reg.MustRegister(NewDynamoDBCollector(blobMetadataStore, logger))
}
metrics := &Metrics{
NumRequests: promauto.With(reg).NewCounterVec(
prometheus.CounterOpts{
Expand Down
5 changes: 3 additions & 2 deletions disperser/dataapi/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ var (

config = dataapi.Config{ServerMode: "test", SocketAddr: ":8080", AllowOrigins: []string{"*"}, DisperserHostname: "localhost:32007", ChurnerHostname: "localhost:32009"}

serverVersion = uint(1)
mockTx = &coremock.MockWriter{}
metrics = dataapi.NewMetrics(nil, "9001", mockLogger)
metrics = dataapi.NewMetrics(serverVersion, nil, "9001", mockLogger)
opId0, _ = core.OperatorIDFromHex("e22dae12a0074f20b8fc96a0489376db34075e545ef60c4845d264a732568311")
opId1, _ = core.OperatorIDFromHex("e23cae12a0074f20b8fc96a0489376db34075e545ef60c4845d264b732568312")
mockChainState, _ = coremock.NewChainDataMock(map[uint8]map[core.OperatorID]int{
Expand All @@ -71,7 +72,7 @@ var (
1: 10,
2: 10,
})
testDataApiServer = dataapi.NewServer(config, blobstore, prometheusClient, subgraphClient, mockTx, mockChainState, mockIndexedChainState, mockLogger, dataapi.NewMetrics(nil, "9001", mockLogger), &MockGRPCConnection{}, nil, nil)
testDataApiServer = dataapi.NewServer(config, blobstore, prometheusClient, subgraphClient, mockTx, mockChainState, mockIndexedChainState, mockLogger, dataapi.NewMetrics(serverVersion, nil, "9001", mockLogger), &MockGRPCConnection{}, nil, nil)
expectedRequestedAt = uint64(5567830000000000000)
expectedDataLength = 32
expectedBatchId = uint32(99)
Expand Down
5 changes: 3 additions & 2 deletions disperser/dataapi/v2/server_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ var (

dynamoClient dynamodb.Client

serverVersion = uint(2)
mockLogger = testutils.GetLogger()
blobstore = inmem.NewBlobStore()
mockPrometheusApi = &prommock.MockPrometheusApi{}
Expand Down Expand Up @@ -103,7 +104,7 @@ var (
1: 10,
2: 10,
})
testDataApiServer = dataapi.NewServer(config, blobstore, prometheusClient, subgraphClient, mockTx, mockChainState, mockIndexedChainState, mockLogger, dataapi.NewMetrics(nil, "9001", mockLogger), &MockGRPCConnection{}, nil, nil)
testDataApiServer = dataapi.NewServer(config, blobstore, prometheusClient, subgraphClient, mockTx, mockChainState, mockIndexedChainState, mockLogger, dataapi.NewMetrics(serverVersion, nil, "9001", mockLogger), &MockGRPCConnection{}, nil, nil)

operatorInfoV1 = &subgraph.IndexedOperatorInfo{
Id: "0xa96bfb4a7ca981ad365220f336dc5a3de0816ebd5130b79bbc85aca94bc9b6ac",
Expand Down Expand Up @@ -223,7 +224,7 @@ func setup(m *testing.M) {
panic("failed to create dynamodb client: " + err.Error())
}
blobMetadataStore = blobstorev2.NewBlobMetadataStore(dynamoClient, logger, metadataTableName)
testDataApiServerV2 = serverv2.NewServerV2(config, blobMetadataStore, prometheusClient, subgraphClient, mockTx, mockChainState, mockIndexedChainState, mockLogger, dataapi.NewMetrics(nil, "9001", mockLogger))
testDataApiServerV2 = serverv2.NewServerV2(config, blobMetadataStore, prometheusClient, subgraphClient, mockTx, mockChainState, mockIndexedChainState, mockLogger, dataapi.NewMetrics(serverVersion, nil, "9001", mockLogger))
}

// makeCommitment returns a test hardcoded BlobCommitments
Expand Down
Loading