Skip to content

Instantly share code, notes, and snippets.

@apurvadave
Forked from demmer/README.md
Last active August 29, 2015 14:16
Show Gist options
  • Save apurvadave/aacee678edea3f990a50 to your computer and use it in GitHub Desktop.
Save apurvadave/aacee678edea3f990a50 to your computer and use it in GitHub Desktop.

Using pace for instant replay of data

This example highlights the use of the pace processor to provide simulated live playback of data.

The first example shows historical data instantly, with live data streaming in. The second example uses pace to playback all of the data, with historical data playing back at 4x original speed.

Your Turn:

  • Line 13: Change the -x 4 to -x [some other number] to see how you can control playback
  • Line 13: add -from :now: to see how pace can timeshift data. In this case the first point shows up as "now" instead of 5 minutes ago.

Make sure you rerun the program after you make changes by clicking the stop button and then the play button.

demo search_cluster metrics 'response_ms' // Get response_ms metrics from our search demo data
-from :5 minutes ago: // Get data from 2 minutes ago and ingest live data
| batch :2 seconds: // Group into 2 second intervals
| reduce p90 = percentile('value', .9) by service // Calculate p90 response time
| @timechart -valueField 'p90' // Plot data on a chart
-keyField 'service' // Every service should be a line on the chart
-title 'Response time (ms) by Service';
demo search_cluster metrics 'response_ms' // Get response_ms metrics from our search demo data
-from :5 minutes ago: // Get data from 2 minutes ago and ingest live data
| batch :2 seconds: // Group into 2 second intervals
| reduce p90 = percentile('value', .9) by service // Calculate p90 response time
| pace -x 4 // playback data, 4x original speed
| @timechart -valueField 'p90' // Plot data on a chart
-keyField 'service' // Every service should be a line on the chart
-title 'Response time (ms) by Service - Instant replay using pace'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment