Collection of potentially interesting examples of AppSignal custom metrics.
An example represents an interesting metric from a typical web application. For each example there's a:
- brief description of the metric and motivation,
- code snippet of the measurement within your application (ruby),
- code snippet of the visualization via dashboard graph (yml),
- screenshot(s) of the visualization.
Ideally.
Count whenever a new session is created (i.e. a user logs in).
Appsignal.increment_counter('session_creation_count', 1)
-
title: "Newly created sessions"
kind: "count"
format: "throughput"
fields:
- session_creation_count
Record the execution time of each back-end API call.
time = Benchmark.ms { MyAPI.call(params) }
Appsignal.add_distribution_value('back_end_api_call', time)
-
title: 'API call time'
kind: measurement
format: duration
fields:
- back_end_api_call
-
title: 'API call throughput'
kind: measurement
format: throughput
fields:
- back_end_api_call_count
Count API errors by type (i.e. HTTP response code).
unless response.success?
Appsignal.increment_counter("backend_api_error_#{response.code}", 1)
end
-
title: 'API errors'
kind: count
filter: 'backend_api_error_[0-9]+'
format: number
- fork this repo,
- add your example in one single commit,
- open a pull request
- thanks!