Add filtering by recorded at date to measurements
What does this MR do?
This change adds filtering capabilities by recorded at to instance statistics measurements GraphQL api.
To get data, make sure you run the seed file:
FILTER=instance_statistics rake db:seed_fu
Testing:
Log in to your local GDK and then navigate to: http://localhost:3000/-/graphql-explorer
Assuming that you're admin, you should be able to run the queries.
GraphQL query:
query getMeasurements {
instanceStatisticsMeasurements(identifier:PROJECTS, recordedAfter:"2020-01-01", recordedBefore:"2020-11-01") {
nodes {
identifier
count
recordedAt
}
}
}
Database
Example query:
The recorded_at
column is already covered by an index.
SELECT "analytics_instance_statistics_measurements".* FROM "analytics_instance_statistics_measurements" WHERE "analytics_instance_statistics_measurements"."recorded_at" >= '2019-12-31 23:00:00' AND "analytics_instance_statistics_measurements"."recorded_at" <= '2021-12-31 23:00:00' AND "analytics_instance_statistics_measurements"."identifier" = 1 ORDER BY "analytics_instance_statistics_measurements"."recorded_at" DESC, "analytics_instance_statistics_measurements"."id" DESC LIMIT 100;
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Related to #268000 (closed)
Edited by Adam Hegyi