-
Notifications
You must be signed in to change notification settings - Fork 105
Conversation
36553d1
to
2aeeb51
Compare
* add more spans to get more insights: - getSeries (minus consolidate/divide when needed, itersToPoints, Fix()) - GetSeriesAggMetric (ringbuffer) - CCache.Search (chunkcache) - CassandraStore.SearchTable (store) * more stats about render: eg oldest_in_ring, points_fetch, points_return * use utility functions to aid with: - creating new spans - logging errors properly. we were abusing "error.kind"
This only covered the cases where we can call WriteErr explicitly, and obviously doesn't work e.g. when bind.Bind returns an error This reverts commit d90a3a6.
in a way that works with our own errors, as well as those emitted by standard/3rd party middlewares like bind.Bind error=true is set for internal errors, not for users doing invalid requests and so on.
api/dataprocessor.go
Outdated
res := s.getSeries(ctx) | ||
res.Points = append(s.itersToPoints(ctx, res.Iters), res.Points...) | ||
func (s *Server) getSeriesFixed(ctx context.Context, req models.Req, consolidator consolidation.Consolidator) []schema.Point { | ||
rctx := newRequestContext(&req, consolidator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it might be nicer to just make ctx
an attribute of rctx
, otherwise having two contexts around can be confusing.
mdata/cache/ccache.go
Outdated
@@ -131,7 +141,9 @@ func (c *CCache) evict(target *accnt.EvictTarget) { | |||
} | |||
} | |||
|
|||
func (c *CCache) Search(metric string, from, until uint32) *CCSearchResult { | |||
func (c *CCache) Search(ctx context.Context, metric string, from, until uint32) *CCSearchResult { | |||
ctx, span := tracing.NewSpan(ctx, c.tracer, "CCache.Search") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised the compiler doesn't complain about this ctx
being unused, I assume that's probably because it's a recycled name, but anyway it's unused
mdata/store_cassandra.go
Outdated
} | ||
|
||
// Basic search of cassandra in given table | ||
// start inclusive, end exclusive | ||
func (c *CassandraStore) SearchTable(key, table string, start, end uint32) ([]chunk.IterGen, error) { | ||
func (c *CassandraStore) SearchTable(ctx context.Context, key, table string, start, end uint32) ([]chunk.IterGen, error) { | ||
ctx, span := tracing.NewSpan(ctx, c.tracer, "CassandraStore.SearchTable") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, unused ctx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually that probably really doesn't matter much since that memory of ctx
is already allocated anyway. the only difference is that by using a _
instead of assigning to ctx
we could save a few ops for overwriting that memory, which is probably not significant
PTAL @replay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now
eg oldest_in_ring, points_fetch, points_return