Michael Dijkstra
February 21, 2019
To date the Calibre CLI has been used for testing performance following deployments, creating custom reports and dashboards and improving performance workflows. With our latest release you can get even more access to Calibre's features directly from the command line or in your node application.
You can now make direct requests to the GraphQL API which opens up numerous possibilities to integrate Calibre into your delivery pipelines, reporting tools and workflow.
For example, you can read individual metrics with the following query:
1calibre request --query='query GetSite($site: String!) {2 organisation: {3 site(slug: $site) {4 metricsHistory(measurement: $measurement, page: $page) {5 current6 oneMonth7 threeMonth8 sixMonth9 }10 }11 }12}' --site='<slug>' --measurement='<metric>' --page='<uuid>'
Or you could update a metric budget to include a new page with the following mutation:
1calibre request --query='mutation UpdateMetricBudget($site: String!, $uuid: String!, $pages: [String!]) {2 updateMetricBudget(3 site: $site4 uuid: $uuid5 attributes: { pages: $pages }6 ) {7 uuid8 }9}' --site='<slug>' --uuid='<budget uuid>' --pages='["<page uuid>"]'
You can see the full GraphQL schema in our new API Documentation.
It's now possible to download the artifacts that Calibre generates for each snapshot or one off test.
1calibre site download-snapshot-artifacts --site=<slug> <id>
Downloads the artifacts of a snapshot to ./snapshot-artifacts/<uuid>.
This also generates manifest.json, which makes it possible to programmatically read and use the assets from each test.
1calibre test download-artifact <uuid>
Downloads the artifacts of a test to ./test-artifacts/<uuid>
With the addition of the ability to make GraphQL requests directly to the Calibre API we implemented a new GraphQL module in the node API.
1const { GraphQL } = '/calibre'23const query = `4 query Site($slug: String!){5 organisation {6 site(slug: $slug) {7 name8 slug9 }10 }11 }12 `1314const result = GraphQL.request({ query, slug: 'calibre' })
Check out our Node.js examples to see it in action.
Update existing applications to the latest release with one of the following options:
If you haven't tried the CLI yet, here's a short guide to get you started automating your performance system in no time.
Michael Dijkstra
Michael is a Platform Developer at Calibre. He’s a product-minded developer with more than 10 years experience across the entire product stack. Find him on LinkedIn.
We will send you our latest web performance articles and notifications about new Calibre features.