The reblocks-prometheus Reference Manual

This is the reblocks-prometheus Reference Manual, version 0.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:34:48 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 reblocks-prometheus

This is an addon for Reblocks Common Lisp framework which allows to gather metrics in Prometheus format.

Author

Alexander Artemenko

Home Page

https://40ants.com/reblocks-prometheus

Source Control

(GIT https://github.com/40ants/reblocks-prometheus)

Bug Tracker

https://github.com/40ants/reblocks-prometheus/issues

License

Unlicense

Long Description

<a id="x-28REBLOCKS-PROMETHEUS-DOCS-2FINDEX-3A-40README-2040ANTS-DOC-2FLOCATIVES-3ASECTION-29"></a>

# reblocks-prometheus - This is an addon for Reblocks Common Lisp framework which allows to gather metrics in Prometheus format.

<a id="reblocks-prometheus-asdf-system-details"></a>

## REBLOCKS-PROMETHEUS ASDF System Details

* Description: This is an addon for Reblocks Common Lisp framework which allows to gather metrics in Prometheus format.
* Licence: Unlicense
* Author: Alexander Artemenko
* Homepage: [https://40ants.com/reblocks-prometheus][0a5b]
* Bug tracker: [https://github.com/40ants/reblocks-prometheus/issues][8225]
* Source control: [GIT][d447]
* Depends on: [log4cl-extras][691c], [prometheus][14fa], [prometheus-gc][8b12], [prometheus.collectors.process][563a], [prometheus.collectors.sbcl][a01b], [prometheus.formats.text][b66b], [reblocks][184b]

[![](https://github-actions.40ants.com/40ants/reblocks-prometheus/matrix.svg?only=ci.run-tests)][1638]

![](http://quickdocs.org/badge/reblocks-prometheus.svg)

This is an addon for Reblocks Common Lisp framework which allows to gather
metrics in [Prometheus][df56] format.

<a id="x-28REBLOCKS-PROMETHEUS-DOCS-2FINDEX-3A-3A-40INSTALLATION-2040ANTS-DOC-2FLOCATIVES-3ASECTION-29"></a>

## Installation

You can install this library from Quicklisp, but you want to receive updates quickly, then install it from Ultralisp.org:

“‘
(ql-dist:install-dist "http://dist.ultralisp.org/"
:prompt nil)
(ql:quickload :reblocks-prometheus)
“‘
<a id="x-28REBLOCKS-PROMETHEUS-DOCS-2FINDEX-3A-3A-40USAGE-2040ANTS-DOC-2FLOCATIVES-3ASECTION-29"></a>

## Usage

Inherit your Reblocks application from [‘prometheus-app-mixin‘][db0d] class:

“‘
(defapp app
:subclasses (reblocks-prometheus:prometheus-app-mixin)
:prefix "/")
“‘
A new route ‘/metrics‘ will be added to serve metrics in Prometheus format.

<a id="x-28REBLOCKS-PROMETHEUS-DOCS-2FINDEX-3A-3A-40API-2040ANTS-DOC-2FLOCATIVES-3ASECTION-29"></a>

## API

<a id="x-28REBLOCKS-PROMETHEUS-2FAPP-3APROMETHEUS-APP-MIXIN-20CLASS-29"></a>

### [class](55b0) ‘reblocks-prometheus/app:prometheus-app-mixin‘ ()

A mixin which gathers some stats to report in Prometheus format.

Also, this mixin adds a /metrics slot to the app.

Use [‘stats-registry‘][b3a2] to access the registry slot.

<a id="x-28REBLOCKS-PROMETHEUS-2FAPP-3ASTATS-REGISTRY-20-2840ANTS-DOC-2FLOCATIVES-3AREADER-20REBLOCKS-PROMETHEUS-2FAPP-3APROMETHEUS-APP-MIXIN-29-29"></a>

### [reader](ad33) ‘reblocks-prometheus/app:stats-registry‘ (prometheus-app-mixin) (= (make-registry))

[db0d]: #x-28REBLOCKS-PROMETHEUS-2FAPP-3APROMETHEUS-APP-MIXIN-20CLASS-29
[b3a2]: #x-28REBLOCKS-PROMETHEUS-2FAPP-3ASTATS-REGISTRY-20-2840ANTS-DOC-2FLOCATIVES-3AREADER-20REBLOCKS-PROMETHEUS-2FAPP-3APROMETHEUS-APP-MIXIN-29-29
[0a5b]: https://40ants.com/reblocks-prometheus
[d447]: https://github.com/40ants/reblocks-prometheus
[1638]: https://github.com/40ants/reblocks-prometheus/actions
[55b0]: https://github.com/40ants/reblocks-prometheus/blob/aa4a8fc87d6075484bd74275dbf0122958a41477/src/app.lisp#L31
[ad33]: https://github.com/40ants/reblocks-prometheus/blob/aa4a8fc87d6075484bd74275dbf0122958a41477/src/app.lisp#L32
[8225]: https://github.com/40ants/reblocks-prometheus/issues
[df56]: https://prometheus.io/
[691c]: https://quickdocs.org/log4cl-extras
[14fa]: https://quickdocs.org/prometheus
[8b12]: https://quickdocs.org/prometheus-gc
[563a]: https://quickdocs.org/prometheus.collectors.process
[a01b]: https://quickdocs.org/prometheus.collectors.sbcl
[b66b]: https://quickdocs.org/prometheus.formats.text
[184b]: https://quickdocs.org/reblocks

* * *
###### [generated by [40ANTS-DOC](https://40ants.com/doc/)]

Version

0.1.0

Defsystem Dependencies
  • 40ants-asdf-system (system).
  • cffi-grovel (system).
Dependency

reblocks-prometheus/core (system).

Source

reblocks-prometheus.asd.


2.2 reblocks-prometheus/core

Author

Alexander Artemenko

Home Page

https://40ants.com/reblocks-prometheus

Source Control

(GIT https://github.com/40ants/reblocks-prometheus)

Bug Tracker

https://github.com/40ants/reblocks-prometheus/issues

License

Unlicense

Dependency

reblocks-prometheus/app (system).

Source

reblocks-prometheus.asd.


2.3 reblocks-prometheus/app

Author

Alexander Artemenko

Home Page

https://40ants.com/reblocks-prometheus

Source Control

(GIT https://github.com/40ants/reblocks-prometheus)

Bug Tracker

https://github.com/40ants/reblocks-prometheus/issues

License

Unlicense

Dependencies
Source

reblocks-prometheus.asd.


2.4 reblocks-prometheus/gauges/number-of-pages

Author

Alexander Artemenko

Home Page

https://40ants.com/reblocks-prometheus

Source Control

(GIT https://github.com/40ants/reblocks-prometheus)

Bug Tracker

https://github.com/40ants/reblocks-prometheus/issues

License

Unlicense

Dependencies
  • prometheus (system).
  • reblocks/session (system).
  • reblocks/page (system).
Source

reblocks-prometheus.asd.


2.5 reblocks-prometheus/gauges/number-of-sessions

Author

Alexander Artemenko

Home Page

https://40ants.com/reblocks-prometheus

Source Control

(GIT https://github.com/40ants/reblocks-prometheus)

Bug Tracker

https://github.com/40ants/reblocks-prometheus/issues

License

Unlicense

Dependencies
  • prometheus (system).
  • reblocks/session (system).
  • reblocks/page (system).
Source

reblocks-prometheus.asd.


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.2 reblocks-prometheus/core/file-type.lisp

Source

reblocks-prometheus.asd.

Parent Component

reblocks-prometheus/core (system).

Packages

reblocks-prometheus.


3.1.3 reblocks-prometheus/app/file-type.lisp

Source

reblocks-prometheus.asd.

Parent Component

reblocks-prometheus/app (system).

Packages

reblocks-prometheus/app.

Public Interface
Internals

3.1.4 reblocks-prometheus/gauges/number-of-pages/file-type.lisp

Source

reblocks-prometheus.asd.

Parent Component

reblocks-prometheus/gauges/number-of-pages (system).

Packages

reblocks-prometheus/gauges/number-of-pages.

Public Interface

collect (method).

Internals

number-of-pages-gauge (class).


3.1.5 reblocks-prometheus/gauges/number-of-sessions/file-type.lisp

Source

reblocks-prometheus.asd.

Parent Component

reblocks-prometheus/gauges/number-of-sessions (system).

Packages

reblocks-prometheus/gauges/number-of-sessions.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 reblocks-prometheus/gauges/number-of-pages

Source

file-type.lisp.

Use List

common-lisp.

Internals

number-of-pages-gauge (class).


4.2 reblocks-prometheus/app

Source

file-type.lisp.

Use List

common-lisp.

Public Interface
Internals

4.3 reblocks-prometheus/gauges/number-of-sessions

Source

file-type.lisp.

Use List

common-lisp.

Internals

4.4 reblocks-prometheus

Source

file-type.lisp.

Nickname

reblocks-prometheus/core

Use List

common-lisp.


5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Generic functions

Generic Reader: stats-registry (object)
Package

reblocks-prometheus/app.

Methods
Reader Method: stats-registry ((prometheus-app-mixin prometheus-app-mixin))

automatically generated reader method

Source

file-type.lisp.

Target Slot

registry.


5.1.2 Standalone methods

Method: collect ((gauge number-of-pages-gauge) cb)
Package

prometheus.

Source

file-type.lisp.

Method: collect ((gauge number-of-sessions-gauge) cb)
Package

prometheus.

Source

file-type.lisp.

Method: collect ((gauge number-of-anonymous-sessions-gauge) cb)
Package

prometheus.

Source

file-type.lisp.

Method: initialize-instance :after ((app prometheus-app-mixin) &rest args)
Source

file-type.lisp.


5.1.3 Classes

Class: prometheus-app-mixin

A mixin which gathers some stats to report in Prometheus format.

Also, this mixin adds a /metrics slot to the app.

Use STATS-REGISTRY to access the registry slot.

Package

reblocks-prometheus/app.

Source

file-type.lisp.

Direct methods
Direct slots
Slot: registry
Initform

(prometheus:make-registry)

Readers

stats-registry.

Writers

This slot is read-only.


5.2 Internals


5.2.1 Special variables

Special Variable: *app*
Package

reblocks-prometheus/app.

Source

file-type.lisp.


5.2.2 Ordinary functions

Function: /metrics ()
Package

reblocks-prometheus/app.

Source

file-type.lisp.


5.2.3 Generic functions

Generic Function: serve-stats (app)

Should return a string with metrics in Prometheus format.

Package

reblocks-prometheus/app.

Source

file-type.lisp.

Methods
Method: serve-stats :after ((app prometheus-app-mixin))
Method: serve-stats ((app prometheus-app-mixin))

5.2.4 Classes

Class: number-of-anonymous-sessions-gauge
Package

reblocks-prometheus/gauges/number-of-sessions.

Source

file-type.lisp.

Direct superclasses

gauge.

Direct methods

collect.

Direct Default Initargs
InitargValue
:namereblocks_anonymous_sessions_count
:value0
:helpa number of anonymous session pages (where :user key is absent).
Class: number-of-pages-gauge
Package

reblocks-prometheus/gauges/number-of-pages.

Source

file-type.lisp.

Direct superclasses

gauge.

Direct methods

collect.

Direct Default Initargs
InitargValue
:namereblocks_pages_count
:value0
:helpa number of nonexpired session pages.
Class: number-of-sessions-gauge
Package

reblocks-prometheus/gauges/number-of-sessions.

Source

file-type.lisp.

Direct superclasses

gauge.

Direct methods

collect.

Direct Default Initargs
InitargValue
:namereblocks_sessions_count
:value0
:helpa number of non-anonymous session pages (where :user key is present).

Appendix A Indexes


A.1 Concepts


A.3 Variables

Jump to:   *  
R   S  
Index Entry  Section

*
*app*: Private special variables

R
registry: Public classes

S
Slot, registry: Public classes
Special Variable, *app*: Private special variables


A.4 Data types

Jump to:   C   F   N   P   R   S  
Index Entry  Section

C
Class, number-of-anonymous-sessions-gauge: Private classes
Class, number-of-pages-gauge: Private classes
Class, number-of-sessions-gauge: Private classes
Class, prometheus-app-mixin: Public classes

F
File, file-type.lisp: The reblocks-prometheus/core/file-type․lisp file
File, file-type.lisp: The reblocks-prometheus/app/file-type․lisp file
File, file-type.lisp: The reblocks-prometheus/gauges/number-of-pages/file-type․lisp file
File, file-type.lisp: The reblocks-prometheus/gauges/number-of-sessions/file-type․lisp file
File, reblocks-prometheus.asd: The reblocks-prometheus/reblocks-prometheus․asd file
file-type.lisp: The reblocks-prometheus/core/file-type․lisp file
file-type.lisp: The reblocks-prometheus/app/file-type․lisp file
file-type.lisp: The reblocks-prometheus/gauges/number-of-pages/file-type․lisp file
file-type.lisp: The reblocks-prometheus/gauges/number-of-sessions/file-type․lisp file

N
number-of-anonymous-sessions-gauge: Private classes
number-of-pages-gauge: Private classes
number-of-sessions-gauge: Private classes

P
Package, reblocks-prometheus: The reblocks-prometheus package
Package, reblocks-prometheus/app: The reblocks-prometheus/app package
Package, reblocks-prometheus/gauges/number-of-pages: The reblocks-prometheus/gauges/number-of-pages package
Package, reblocks-prometheus/gauges/number-of-sessions: The reblocks-prometheus/gauges/number-of-sessions package
prometheus-app-mixin: Public classes

R
reblocks-prometheus: The reblocks-prometheus system
reblocks-prometheus: The reblocks-prometheus package
reblocks-prometheus.asd: The reblocks-prometheus/reblocks-prometheus․asd file
reblocks-prometheus/app: The reblocks-prometheus/app system
reblocks-prometheus/app: The reblocks-prometheus/app package
reblocks-prometheus/core: The reblocks-prometheus/core system
reblocks-prometheus/gauges/number-of-pages: The reblocks-prometheus/gauges/number-of-pages system
reblocks-prometheus/gauges/number-of-pages: The reblocks-prometheus/gauges/number-of-pages package
reblocks-prometheus/gauges/number-of-sessions: The reblocks-prometheus/gauges/number-of-sessions system
reblocks-prometheus/gauges/number-of-sessions: The reblocks-prometheus/gauges/number-of-sessions package

S
System, reblocks-prometheus: The reblocks-prometheus system
System, reblocks-prometheus/app: The reblocks-prometheus/app system
System, reblocks-prometheus/core: The reblocks-prometheus/core system
System, reblocks-prometheus/gauges/number-of-pages: The reblocks-prometheus/gauges/number-of-pages system
System, reblocks-prometheus/gauges/number-of-sessions: The reblocks-prometheus/gauges/number-of-sessions system