charmlibs.interfaces.sloth
Sloth integration library for Juju charms, providing SLO (Service Level Objective) management with the Sloth operator for generating Prometheus recording and alerting rules.
Features
- Provider/Requirer pattern: Enables charms to share SLO specifications with Sloth
- Raw YAML interface: Provider passes raw YAML strings; validation happens on requirer side
- Automatic topology injection: Optionally inject Juju topology labels into Prometheus queries
- Multi-service support: Provide SLO specs for multiple services in a single YAML document
Getting started
To install, add charmlibs-interfaces-sloth to your Python dependencies. Then in your Python code, import as:
from charmlibs.interfaces.sloth import SlothProvider, SlothRequirer
Provider Side
from charmlibs.interfaces.sloth import SlothProvider
class MyCharm(ops.CharmBase):
def __init__(self, *args):
super().__init__(*args)
self.sloth_provider = SlothProvider(self)
def _provide_slos(self):
slo_config = '''
version: prometheus/v1
service: my-service
slos:
- name: requests-availability
objective: 99.9
sli:
events:
error_query: 'sum(rate(http_requests_total{status=~"5.."}[{{.window}}]))'
total_query: 'sum(rate(http_requests_total[{{.window}}]))'
'''
self.sloth_provider.provide_slos(slo_config)
Requirer Side
from charmlibs.interfaces.sloth import SlothRequirer
class SlothCharm(ops.CharmBase):
def __init__(self, *args):
super().__init__(*args)
self.sloth_requirer = SlothRequirer(self)
def _on_config_changed(self, event):
# Get validated SLO specs from all related charms
slos = self.sloth_requirer.get_slos()
# Process SLOs and generate rules
Documentation
For complete documentation, see the charmlibs documentation.
Contributing
See CONTRIBUTING.md in the repository root.
Metadata
Release files for charmlibs-interfaces-sloth 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| charmlibs_interfaces_sloth-0.1.0.tar.gz | 45.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| charmlibs_interfaces_sloth-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 54.7 kB
Release files / charmlibs_interfaces_sloth-0.1.0.tar.gz
| Download URL | charmlibs_interfaces_sloth-0.1.0.tar.gz |
|---|---|
| Size | 45.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e05f68d7d096df49a24a6f0eebbbb265da12ea2d6801f5027f57c0d679fbd0f6
|
|
BLAKE2b-256 checksum How to use checksums |
ced72393442e9715d55b30b946f9a36f00aacdfae4f101cc793f25993f241dfb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 13, 2026.
Transparency logRelease files / charmlibs_interfaces_sloth-0.1.0-py3-none-any.whl
| Download URL | charmlibs_interfaces_sloth-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f41fbe4f38d8bb8668375e91015c9fdb7bcf63f8f2005fcd4d3f607d6fb5aa09
|
|
BLAKE2b-256 checksum How to use checksums |
a46f1e895e6f0640742e0ff5b0d23b06f00a6f88aedd843272fb3afeca530167
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 13, 2026.
Transparency logSecurity for charmlibs-interfaces-sloth 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for charmlibs_interfaces_sloth-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.