Promet...Shared(3pm)

πŸ“¦
version 0.027 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ 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_args is dead. If your code still passes it, it will croak at you. Swap it for filename.

🌈 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>

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