Skip to content

Add PebbleLogForwarder to the otlp library#425

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/add-logforwarder-component
Draft

Add PebbleLogForwarder to the otlp library#425
Copilot wants to merge 2 commits into
mainfrom
copilot/add-logforwarder-component

Conversation

Copilot AI commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

The otlp interface lacks a K8s log forwarding utility analogous to LogForwarder in loki_push_api. Charms transitioning from loki_push_api to otlp need a way to configure Pebble's native log forwarding to OTLP endpoints.

Changes

  • _log_forwarder.py: New PebbleLogForwarder class with a build_otlp_layer() static method that converts OtlpRequirer.endpoints into a Pebble Layer with type: opentelemetry log targets. Only endpoints advertising "logs" telemetry are included. Optional JujuTopology injects COS-standard labels.
  • __init__.py: Export PebbleLogForwarder, add usage documentation for K8s charms.
  • test_log_forwarder.py: 10 unit tests covering single/multiple endpoints, topology labels, telemetry filtering, enable/disable targets.

Usage

from charmlibs.interfaces.otlp import OtlpRequirer, PebbleLogForwarder
from cosl.juju_topology import JujuTopology

endpoints = OtlpRequirer(charm, protocols=["http"], telemetries=["logs"]).endpoints
layer = PebbleLogForwarder.build_otlp_layer(
    endpoints, topology=JujuTopology.from_charm(self),
)
container.add_layer(f"{container.name}-log-forwarding", layer, combine=True)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • documentation.ubuntu.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue Apr 14, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add LogForwarder component in otlp library Add PebbleLogForwarder to the otlp library Apr 14, 2026
Copilot AI requested a review from sed-i April 14, 2026 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a LogForwarder component in the otlp library

2 participants