bitly/tsplot

Query: Filter override ignored. Errors early.

jharshman opened this issue · 0 comments

SetQueryFilter ignored.

A bug in the request function causes it to return an error early when SetQueryFilter has been called. This is due to the method erroring when it checks for a MetricDescriptor set on the MetricQuery.

The resolution is to additionally check to see if SetQueryFilter has set the queryFilter field on MetricQuery. In this scenario, the caller should be expecting to use this filter verbatim in the underlying query to GCM.

Repro:

query := &tsplot.MetricQuery{
  Project: "someproject",
  StartTime: time.Now().Add(-1*time.Hour),
}
query.SetQueryFilter("foobar")
_, err := query.PerformWithClient(gcmClient) // err: MetricQuery missing MetricDescriptor