Pyroscope: Add limit number of series returned by the data source (#95780)

This commit is contained in:
Marc M.
2024-11-08 17:22:29 +02:00
committed by GitHub
parent ea0a6a1f7f
commit 9525891455
19 changed files with 76 additions and 24 deletions
@@ -9,7 +9,7 @@ import (
"github.com/grafana/grafana-plugin-sdk-go/backend/tracing"
typesv1 "github.com/grafana/pyroscope/api/gen/proto/go/types/v1"
"github.com/bufbuild/connect-go"
"connectrpc.com/connect"
querierv1 "github.com/grafana/pyroscope/api/gen/proto/go/querier/v1"
"github.com/grafana/pyroscope/api/gen/proto/go/querier/v1/querierv1connect"
"go.opentelemetry.io/otel/attribute"
@@ -98,7 +98,7 @@ func (c *PyroscopeClient) ProfileTypes(ctx context.Context, start int64, end int
}
}
func (c *PyroscopeClient) GetSeries(ctx context.Context, profileTypeID string, labelSelector string, start int64, end int64, groupBy []string, step float64) (*SeriesResponse, error) {
func (c *PyroscopeClient) GetSeries(ctx context.Context, profileTypeID string, labelSelector string, start int64, end int64, groupBy []string, limit *int64, step float64) (*SeriesResponse, error) {
ctx, span := tracing.DefaultTracer().Start(ctx, "datasource.pyroscope.GetSeries", trace.WithAttributes(attribute.String("profileTypeID", profileTypeID), attribute.String("labelSelector", labelSelector)))
defer span.End()
req := connect.NewRequest(&querierv1.SelectSeriesRequest{
@@ -108,6 +108,7 @@ func (c *PyroscopeClient) GetSeries(ctx context.Context, profileTypeID string, l
End: end,
Step: step,
GroupBy: groupBy,
Limit: limit,
})
resp, err := c.connectClient.SelectSeries(ctx, req)