Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/taoensso/tufte

Simple performance monitoring library for Clojure/Script
https://github.com/taoensso/tufte

benchmarking clojure clojurescript epl performance-monitoring profiling taoensso

Last synced: 3 months ago
JSON representation

Simple performance monitoring library for Clojure/Script

Awesome Lists containing this project

README

        

Taoensso open source
[**Documentation**](#documentation) | [Latest releases](#latest-releases) | [Get support][GitHub issues]

# Tufte

### Simple performance monitoring library for Clojure/Script

**Tufte** allows you to **easily monitor the ongoing performance** of your Clojure and ClojureScript applications in production and other environments.

It provides **sensible application-level metrics**, and gives them to you as **Clojure data** that can be easily analyzed programatically.

Carte Figurative

> [Carte Figurative](https://en.wikipedia.org/wiki/Charles_Joseph_Minard#The_map_of_Napoleon's_Russian_campaign), one of [Edward Tufte](https://en.wikipedia.org/wiki/Edward_Tufte)'s favourite data visualizations.

## Latest release/s

- `2023-09-27` `2.6.3`: [release info](../../releases/tag/v2.6.3)

[![Main tests][Main tests SVG]][Main tests URL]
[![Graal tests][Graal tests SVG]][Graal tests URL]

See [here][GitHub releases] for earlier releases.

## Why Tufte?

- Small, **fast**, cross-platform Clojure/Script codebase
- Sensible **application-level metrics** without the obscure JVM-level noise
- **Metrics as Clojure maps**: easily aggregate, **analyse**, log, serialize to db, etc.
- **Tiny**, flexible API: [`p`](https://taoensso.github.io/tufte/taoensso.tufte.html#var-p), [`profiled`](https://taoensso.github.io/tufte/taoensso.tufte.html#var-profiled), [`profile`](https://taoensso.github.io/tufte/taoensso.tufte.html#var-profile)
- Great **compile-time elision** and **runtime filtering** support
- Arbitrary Clojure/Script **form-level** profiling
- Full support for **thread-local** and **multi-threaded** profiling

## 10-second example

```clojure
(require '[taoensso.tufte :as tufte :refer [defnp p profiled profile]])

;; Request to send `profile` stats to `println`:
(tufte/add-basic-println-handler! {})

;;; Define a couple dummy fns to simulate doing some expensive work
(defn get-x [] (Thread/sleep 500) "x val")
(defn get-y [] (Thread/sleep (rand-int 1000)) "y val")

;; Let's check how these fns perform:

(profile ; Profile any `p` forms called during body execution
{} ; Profiling options; we'll use the defaults for now
(dotimes [_ 5]
(p :get-x (get-x))
(p :get-y (get-y))))

;; The following will be printed to *out*:
;;
;; pId nCalls Min 50% ≤ 90% ≤ 95% ≤ 99% ≤ Max Mean MAD Clock Total
;; :get-x 5 501ms 503ms 505ms 505ms 505ms 505ms 503ms ±0% 2.52s 53%
;; :get-y 5 78ms 396ms 815ms 815ms 815ms 815ms 452ms ±48% 2.25s 47%
;;
;; Accounted 4.78s 100%
;; Clock 4.78s 100%
```

## Documentation

- [Wiki][GitHub wiki] (getting started, usage, etc.)
- API reference: [cljdoc][cljdoc docs], [Codox][Codox docs]

## Funding

You can [help support][sponsor] continued work on this project, thank you!! 🙏

## License

Copyright © 2016-2024 [Peter Taoussanis][].
Licensed under [EPL 1.0](LICENSE.txt) (same as Clojure).

[GitHub releases]: ../../releases
[GitHub issues]: ../../issues
[GitHub wiki]: ../../wiki

[Peter Taoussanis]: https://www.taoensso.com
[sponsor]: https://www.taoensso.com/sponsor

[Codox docs]: https://taoensso.github.io/tufte/
[cljdoc docs]: https://cljdoc.org/d/com.taoensso/tufte/

[Clojars SVG]: https://img.shields.io/clojars/v/com.taoensso/tufte.svg
[Clojars URL]: https://clojars.org/com.taoensso/tufte

[Main tests SVG]: https://github.com/taoensso/tufte/actions/workflows/main-tests.yml/badge.svg
[Main tests URL]: https://github.com/taoensso/tufte/actions/workflows/main-tests.yml
[Graal tests SVG]: https://github.com/taoensso/tufte/actions/workflows/graal-tests.yml/badge.svg
[Graal tests URL]: https://github.com/taoensso/tufte/actions/workflows/graal-tests.yml