Skip to content

Instantly share code, notes, and snippets.

@demmer
Last active August 29, 2015 14:09
Show Gist options
  • Save demmer/48a572f979a3acdae510 to your computer and use it in GitHub Desktop.
Save demmer/48a572f979a3acdae510 to your computer and use it in GitHub Desktop.
Events and Metrics

Events, Meet Metrics

You shouldn't have to go to separate applications for different data types. Juttle allows you to seamlessly combine events like log data, code deploys, and change windows with metrics like CPU, memory, disk or statsd and JMX metrics.

This example plots a typical metric (response time) and overlays server errors combed from logs on the host "sea.0" as vertical bars.

Your Turn:

  • Line 3: Changing the hosts from "sea.0" to "sjc.1" or ["sea.0", "sea.1"]
  • Line 8: Change the calculation from max to avg or min
export sub demo_metrics(from) {
demo cdn -every :1 second: -period :1 second:
-nhosts 3 -dos 0.7 -dos_router markov
metrics "response_ms" -from from
}
export sub demo_events(from) {
demo cdn -nhosts 3 -dos .7 -dos_router markov
events -from from
}
import "data.juttle" as d; // Load the demo data configuration
const hosts = ["sea.0"]; // Declare the list of host(s) to look at
// Compute the maximum response time of the host(s) on a time chart
d.demo_metrics -from :5 minutes ago: |
filter service = "search" && host in hosts |
batch 5 |
reduce value = max(value) by host |
@timechart -by host -name response_time -title "Response time correlated with errors";
// Overlay server error event markers on the chart
d.demo_events -from :5 minutes ago: |
filter name = "server_error" && host in hosts |
@events -on response_time -labelField host -textField name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment