Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
fix passing range bytes in CAR requests, and reporting entity ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmahmann committed Jul 6, 2023
1 parent 9c90b45 commit db8afcf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/graph_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,11 @@ func (api *GraphGateway) ResolvePath(ctx context.Context, path gateway.Immutable
}

func (api *GraphGateway) GetCAR(ctx context.Context, path gateway.ImmutablePath, params gateway.CarParams) (gateway.ContentPathMetadata, io.ReadCloser, error) {
api.metrics.carParamsMetric.With(prometheus.Labels{"dagScope": string(params.Scope), "entityRanges": "0"}).Inc()
numRanges := "0"
if params.Range != nil {
numRanges = "1"
}
api.metrics.carParamsMetric.With(prometheus.Labels{"dagScope": string(params.Scope), "entityRanges": numRanges}).Inc()
rootCid, err := getRootCid(path)
if err != nil {
return gateway.ContentPathMetadata{}, nil, err
Expand All @@ -1088,7 +1092,7 @@ func (api *GraphGateway) GetCAR(ctx context.Context, path gateway.ImmutablePath,
numBlocksSent := 0
var cw storage.WritableCar
var blockBuffer []blocks.Block
err = api.fetchCAR(ctx, path, gateway.CarParams{Scope: params.Scope}, func(resource string, reader io.Reader) error {
err = api.fetchCAR(ctx, path, params, func(resource string, reader io.Reader) error {
numBlocksThisCall := 0
gb, err := carToLinearBlockGetter(ctx, reader, api.metrics)
if err != nil {
Expand Down

0 comments on commit db8afcf

Please sign in to comment.