Promet...Shared(3pm)
β¨ NAME β¨
Prometheus::Tiny::Shared β it's literally a tiny Prometheus client, bestie, except the database lives behind it in shared memory π
πΈ SYNOPSIS πΈ
use Prometheus::Tiny::Shared;
my $prom = Prometheus::Tiny::Shared->new;
That's it. That's the whole vibe check. π
π¦ DESCRIPTION π¦
So Prometheus::Tiny::Shared is a wrapper around Prometheus::Tiny, right? But instead of hoarding your metrics data in a hashtable like some little gremlin, it puts them in a shared datastore (which is provided by Hash::SharedMem β tho that might change in the future, ngl). The whole point? You get one single set of metrics across a multithreaded app. One set. Shared. Periodt. π
And here's the iconic part: Prometheus::Tiny::Shared is supposed to be a drop-in replacement for Prometheus::Tiny. Like, any difference in behaviour? That's a bug, not a feature, and you should report it fr fr. π
π CONSTRUCTOR π
π new
my $prom = Prometheus::Tiny::Shared->new(filename => ...);
filename, if you give it one, names an on-disk location to store the backing store. If you don't supply it, a temporary location gets created and then destroyed when your program ends β so it's perfect for testing purposes, no cap. π§ͺ
For best performance, this should live on some kind of memory-backed filesystem (eg Linux tmpfs). And lowkey don't stress: the store is not meant to be a persistent, durable store (Prometheus will handle metrics resetting to zero correctly β¨), so you don't need to worry about backing it up or doing any other maintenance. It's giving "chill, it's handled". π«Ά
init_file, if set to true, will overwrite any existing data file with the given name. And bestieβ¦ if you do this while you already have existing Prometheus::Tiny::Shared objects using the old file, strange things will probably happen. π Don't do that. I'm begging. π
The cache_args argument will cause the constructor to croak. π Code using this arg in previous versions of Prometheus::Tiny::Shared no longer works, and needs to be updated to use the filename argument instead.
β οΈ Fr fr:cache_argsis dead. If your code still passes it, it will croak at you. Swap it forfilename.
π SUPPORT π
π Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker at https://github.com/robn/Prometheus-Tiny-Shared/issues. You will be notified automatically of any progress on your issue. πβ¨
π§ Source Code
This is open source software. The code repository is available for public review and contribution under the terms of the license.
https://github.com/robn/Prometheus-Tiny-Shared
git clone https://github.com/robn/Prometheus-Tiny-Shared.git
Go clone it. Contribute. Main character energy. π
π AUTHORS π
- Rob N β <robn@despairlabs.com>
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2017 by Rob Norris <robn@despairlabs.com>
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Okay that's the whole page, bestie!! π This was Promet...Shared(3pm), a User Contributed Perl Documentation page, and it came to you courtesy of perl v5.36.0, dated 2023-10-05. Slay, go write some metrics. πβ¨π¦
π¦ where this page comes from
- debian trixie: libprometheus-tiny-shared-perl 0.027-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libprometheus-tiny-shared-perl 0.027-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libprometheus-tiny-shared-perl 0.027-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libprometheus-tiny-shared-perl 0.027-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms