charmlibs.interfaces.otlp
The otlp library.
OTLP integration library for Juju charms, providing OTLP endpoint information for communicating OTLP data and associated Loki and Prometheus rules.
Features
- Provider/Requirer pattern: Enables charms to share OTLP endpoint information and rules content
- Define endpoint support: Providers and requirers define what OTLP protocols and telemetries they support.
- Rules interface: Add rules to a 'RuleStore' object and provide that to the requirer for publishing.
- Automatic topology injection: Inject Juju topology labels into rule expressions and labels with metadata if the labels are not already labeled.
Getting started
To install, add charmlibs-interfaces-otlp to your Python dependencies. Then in your Python code, import as:
from charmlibs.interfaces.otlp import OtlpProvider, OtlpRequirer
Provider Side
from charmlibs.interfaces.otlp import OtlpProvider
class MyOtlpServer(CharmBase):
def __init__(self, *args):
super().__init__(*args)
self.framework.observe(self.on.ingress_ready, self._publish_endpoints)
self.framework.observe(self.on.update_status, self._access_rules)
def _publish_endpoints(self, event):
OtlpProvider(self).add_endpoint(
protocol="grpc",
endpoint="https://my-app.ingress:4317",
telemetries=["logs", "metrics"],
).add_endpoint(
protocol="http",
endpoint="https://my-app.ingress:4318",
telemetries=["traces"],
).publish()
def _access_rules(self, event):
for relation_id, rule_store in OtlpProvider(self).rules.items():
pass # do something with rule_store.logql and/or rule_store.promql
Requirer Side
from charmlibs.interfaces.otlp import OtlpRequirer, RulesStore
class MyOtlpSender(CharmBase):
def __init__(self, framework: ops.Framework):
super().__init__(framework)
self.framework.observe(self.on.update_status, self._access_endpoints)
self.framework.observe(self.on.update_status, self._publish_rules)
def _publish_rules(self, _: ops.EventBase):
rules = (
RuleStore(JujuTopology.from_charm(self))
.add_logql(SINGLE_LOGQL_ALERT, group_name='test_logql_alert')
.add_promql(SINGLE_PROMQL_RECORD, group_name='test_promql_record')
.add_logql(OFFICIAL_LOGQL_RULES)
)
OtlpRequirer(self, rules=rules).publish()
def _access_endpoints(self, _: ops.EventBase):
OtlpRequirer(
self,
protocols=["grpc", "http"],
telemetries=["logs", "metrics", "traces"],
).endpoints
Documentation
For complete documentation, see the charmlibs documentation.
Contributing
See CONTRIBUTING.md in the repository root.
Metadata
Release files for charmlibs-interfaces-otlp 0.5.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 | Actions |
|---|---|---|---|---|
| charmlibs_interfaces_otlp-0.5.0.tar.gz | 55.3 kB | With provenance | Details for charmlibs_interfaces_otlp-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| charmlibs_interfaces_otlp-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for charmlibs_interfaces_otlp-0.5.0-py3-none-any.whl |
Total release size: 67.9 kB
Release files / charmlibs_interfaces_otlp-0.5.0.tar.gz
| Download URL | charmlibs_interfaces_otlp-0.5.0.tar.gz |
|---|---|
| Size | 55.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a2a963f32235afe8ffac17f04ad15e6da6dadd0f00aeaf687387214e33fde987
|
|
BLAKE2b-256 checksum How to use checksums |
3f5242f01198ae391dfffbcd27cc4dc031e6189d2be299e37b18f56e16d237e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 30, 2026.
Transparency logRelease files / charmlibs_interfaces_otlp-0.5.0-py3-none-any.whl
| Download URL | charmlibs_interfaces_otlp-0.5.0-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9719475bd8cc8b1a7f9a14c8565686c77e8b9c643ca7759cb63ef8783d964e06
|
|
BLAKE2b-256 checksum How to use checksums |
aa4da2b6398e3072f452ee7e247e093a3bcc3483147a408e78c2f5d562df2a8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 30, 2026.
Transparency logSecurity for charmlibs-interfaces-otlp 0.5.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
Both files in this release have been uploaded with provenance metadata.
Attestation for charmlibs_interfaces_otlp-0.5.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 Apr 30, 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.