Skip to main content

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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for charmlibs-interfaces-sloth 0.1.1
File Size Uploaded Provenance Actions
charmlibs_interfaces_sloth-0.1.1.tar.gz 45.7 kB With provenance Details for charmlibs_interfaces_sloth-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for charmlibs-interfaces-sloth 0.1.1
File Interpreter ABI Platform Actions
charmlibs_interfaces_sloth-0.1.1-py3-none-any.whl Python 3 none any Details for charmlibs_interfaces_sloth-0.1.1-py3-none-any.whl

Total release size: 55.0 kB

Release files / charmlibs_interfaces_sloth-0.1.1.tar.gz

Download URL charmlibs_interfaces_sloth-0.1.1.tar.gz
Size 45.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1c17ab2a7cf3e17a7ed789a8f8023b8dbd66c3c3c034590ba3b7af2fa55d959b
BLAKE2b-256 checksum
How to use checksums
b26528b0c894969a5aaf8d449cf780b41e353fb1d56fabee9bd55a36895bd85c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / charmlibs_interfaces_sloth-0.1.1-py3-none-any.whl

Download URL charmlibs_interfaces_sloth-0.1.1-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1fe7321e370c3e08032d7f96cc6838283beed41573e33f34ffa953e59b03e109
BLAKE2b-256 checksum
How to use checksums
4a90a400f11fb8fbe20b8f1c4991e493880710ec70794e402eb55bb955fd6565
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Security for charmlibs-interfaces-sloth 0.1.1

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for charmlibs_interfaces_sloth-0.1.1.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 Nov 24, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page